Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): offer client-only recovery when another server owns the T3 home #30333

ClosedKunstderfug(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/30333/headopened View on GitHub

Problem

When a background server owns the desktop's T3 home, the desktop starts another backend, receives exit 78, and quits with service update/uninstall advice. Updating an already-current service cannot resolve the ownership conflict. The supported Local environment switch is inaccessible during this startup failure.

Addresses the startup-recovery portion of #22820.

Change

Offer Quit (the default) or Disable local environment and restart in the home-ownership dialog. The latter persists the existing localEnvironmentEnabled setting and uses the existing graceful relaunch path. The restarted desktop can reach Settings > Environments, where the user can explicitly pair with the running server using t3 pair.

Route the ownership refusal through startup state so the startup recovery layer owns the dialog and lifecycle action. If saving the setting fails, show the error and quit without relaunching. Retain older-service update/removal guidance and explain that updating does not allow two servers to share a home.

Scope and approval

This is focused configuration of the established client-only desktop capability, already exposed by Settings > Environments > Local environment. It exposes that same choice at the point where startup currently prevents reaching the setting. The default stays enabled; disabling requires an explicit choice.

The maintainer's direction on automatic attachment is respected: this does not discover, authenticate to, or automatically attach to a server. It does not terminate or reconfigure the service, bypass ownership checks, or change pairing. This is submitted under CONTRIBUTING.md's established-capability configuration route, not as a claim of prior feature approval.

The shared exit-78 response still does not distinguish older-service and current-owner causes. Secondary WSL backend recovery is outside this PR.

Verification

  • Regression test first failed against the original quit-only behavior: choosing recovery left localEnvironmentEnabled enabled. The final tests use the real settings store and temporary filesystem, covering quit, persisted opt-in recovery with unrelated settings retained, and actual settings-write failure without relaunch.
  • vp test run apps/desktop/src/app/DesktopHomeRecovery.test.ts apps/desktop/src/app/DesktopStartupRecovery.test.ts apps/desktop/src/backend/DesktopBackendPool.test.ts: 14 tests passed across 3 files.
  • vp run check:changed: format, lint, both knip passes, affected-package typechecks, and the 14 focused tests passed.
  • vp run build:desktop: passed. Final desktop packaging build also passed after the dialog copy was finalized.
  • Native macOS arm64 / Electron 44.10.0: started the built server against an isolated T3 home seeded with the repository's synthetic desktop-launch database fixture, then launched the built desktop against that same home. The ownership dialog appeared. Choosing recovery restarted into client-only mode; Settings showed Local environment off and Add environment available. The separate server still returned HTTP 200 from /.well-known/t3/environment. The original pool behavior was also rebuilt and reproduced the quit-only outcome without changing the setting.
  • The native owner was a directly launched server exercising the same ownership lock, rather than a newly registered launchd service. Windows/Linux, secondary WSL, pairing, and a distributed installer were not manually tested. No live user T3 home was used.

Before

The original fatal dialog, from ruxir-ig's Linux report, is shown below. This is a reporter-provided screenshot, not the macOS reproduction above.

Original quit-only ownership dialog

After

Desktop restarted in client-only mode

Local environment off with pairing settings reachable

Native recovery dialog accessibility transcript

The macOS alert was verified through native accessibility; its capture rendered blank, so the attached transcript records its actual text and actions. The screenshots show the real restarted application and reachable setting, not a mockup.

Implemented with GPT-6 in Codex.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Independent Worker16 source review of the exact candidate head only. The recovery flow is a useful, narrow answer to #22820: it preserves the one-owner lock, makes the existing Local environment choice reachable, persists it before relaunch, and leaves the running service/data intact. The new tests cover Quit, successful opt-in recovery with an unrelated WSL setting retained, and settings-write failure without relaunch. The recorded CI run #41706989317 is SUCCESS on this exact head; the selected desktop Test job logs show DesktopStartupRecovery.test.ts 11/11, DesktopBackendPool.test.ts 1/1, and DesktopHomeRecovery.test.ts 3/3 (plus the broader selected suite). No claim is made that this is current-main composition or packaged cross-platform acceptance.

      I am requesting one P2 correction: the new recovery dialog is unowned. ElectronDialog.showMessageBox accepts an optional BrowserWindow, and without it calls Electron.dialog.showMessageBox(options); the API comment explicitly says to pass owner so the box cannot fall behind its window. This is the same Linux startup/splash failure documented by #31179 and addressed in the still-open, overlapping #31193 path. This PR moves the ownership callback out of DesktopBackendPool and into DesktopStartupRecovery/DesktopHomeRecovery, but does not carry the current main-or-first window into the new dialog. Please preserve the parented-dialog behavior here and add a regression for StateDirOwned while the splash is the first non-auxiliary window.

      Integration is also not accepted: this candidate is 490 commits behind current main, and #31193 independently changes DesktopBackendPool.ts. The original author retains all seven changed paths and branch; maintainers/landing owner retain integration and landing decisions.

    3. tanstack-source added labelsbug

    4. This has been a draft with no activity for more than three days, so it is being closed: the open pull requests are kept to work that is ready to be looked at.

      Nothing is lost, the branch stays. When the work is ready, open a new pull request for it; this one will not be reopened.

    5. juliusmarminge closed this

Sign in to join this conversation.