fix(desktop): a timed-out login-shell probe no longer skips the server's PATH repair #21771
main fromrefs/pull/21771/head·merged by maria-rcks View on GitHubProblem#
On macOS the desktop captures PATH from the login shell with a 5 s cap. When that probe times out, which happens on a cold boot or on the relaunch right after an auto-update, the desktop still reports the shell environment as prepared. Since #17384 the bundled server trusts that flag and skips its own login-shell probe, so every provider spawns against launchd's PATH for the whole run, and Settings reports Codex and Claude as not installed while both are. Short of setting an absolute binary path for each provider, quitting and reopening is the only way out.
#19966 made the Windows branch of installShellEnvironment report a real result, but wrote the POSIX branch as installPosixEnvironment(config).pipe(Effect.as(true)), while the installIntoProcess interface comment says "false leaves server hydration enabled".
Seen twice on 2026-10-19 on 0.1.1-nightly.20261019.3360, both times on the relaunch after an update: the login-shell probe ran 6051 ms and 5205 ms and timed out, installIntoProcess recorded Success, and the provider probes failed to spawn claude --version and codex app-server seconds later. Reopening the app loaded the same shell in 2727 ms and 3016 ms.
Change#
installPosixEnvironment now returns whether a login shell returned a PATH, and installShellEnvironment passes that through. A timed-out or failed probe reaches the server as shellEnvironmentPrepared: false, so fixPath runs hydratePosixPath again, as it did before #17384: one more login-shell attempt a moment later, when the shell is usually warm. A launchctl-only PATH also reports false, because the login shell is what the server re-probes. Compatible with #24632 (@juliusmarminge's rebuild of #9232): its known-directory fallback would also report false here, as launchctl does. Windows is unchanged.
The cost is a server-side re-probe at startup, up to 5 s per login-shell candidate, paid only by users whose desktop probe already failed and who were running on a bare PATH anyway. It is the same synchronous call npx t3 makes on every start.
Not in this PR, and still open on the issue: a retry inside the desktop, a user-facing message that distinguishes a failed capture from a missing CLI, and re-capturing without a restart. @Gigioxx's #10537 built that fuller version before it was closed in cleanup; this is the smaller slice that restores the second attempt.
Scope and approval#
Refs #10534, triaged by @juliusmarminge as a real macOS desktop bug, with the server's second chance named in the triage: https://github.com/pingdotgg/t3code/issues/10534#issuecomment-5573001305. That second chance was lost when #17384 started trusting the flag. One underlying problem: one source file and its test.
Verification#
apps/desktop/src/shell/DesktopShellEnvironment.test.ts: two new assertions fail onmainwithexpected true to be false(no shell answers; launchctl-onlyPATH) and pass with the fix, and the macOS hydrate test now assertstrue.vp test runon this file: 13 passed, after merging currentmain. Lint, format andvp run check:changed upstream/mainare clean.- Real app,
vp run dev:desktopfrom this worktree on a fresh.t3, withZDOTDIRpointing at a.zshrcthat sleeps 8 s on its first interactive start, is fast afterwards, logs each start with its parent PID, and prepends/tmp/t3-10534-shell-onlytoPATHon every start that completes.- Before (upstream
main):desktop.shellEnvironment.runCommandOutput5115 ms withDesktopShellEnvironmentCommandTimeoutError, launchctl 10 ms,installIntoProcess5127 msSuccess. The server process (ELECTRON_RUN_AS_NODE=1) started with no marker directory in its spawnedPATH, and over the next 25 s the shell log shows one interactive start only, the desktop's. - After: the same timeout in the desktop (
runCommandOutput5115 ms,installIntoProcess5124 ms, same warning), and the server again started without the marker directory in its spawnedPATH. 1.4 s later the shell log shows a second interactive zsh whose parent is the server process (ELECTRON_RUN_AS_NODE=1), completing in 13 ms: the server's own probe, whosePATHhydratePosixPathmerges intoprocess.env. No hydration warning in the server output.
- Before (upstream
- Not checked: Linux; the server's merged
PATHread directly (the flag travels over a file descriptor andprocess.envchanges are not visible from outside, so the merge rests onos-jank.test.ts); and the case where the server's own probe also exceeds 5 s, as in the issue's original cold-boot report, where this change does not help.
Claude Fable 5.1 and Claude Opus 5.5 via T3 Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
cc0b565Macroscope's review found this PR approvable — This is a small, well-scoped desktop bug fix that preserves successful shell setup while allowing the server’s existing PATH repair to run after a failed or timed-out login-shell probe. The added tests cover the changed result semantics, and no defaults, static-analysis suppressions, schemas, or sensitive areas are modified.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Warning
Review limit reached#
Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.
Next included review available in 37 minutes.
View limit details
-
Limit details: You’ve used all 10 included reviews currently available.
Review configuration:
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 0a3b561
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f35c6196-4529-4c1b-9f3c-4f1b7e130e39
Commits-
Reviewing files that changed from the base of the PR and between e481b1fb0f4c2184c9e74f1b8c56ef3c3127d9dd and 6a7743ef2ad7496d289eed6ac5aed72dd30a41cb.
Files selected for processing: 2-
apps/desktop/src/shell/DesktopShellEnvironment.test.tsapps/desktop/src/shell/DesktopShellEnvironment.ts
-
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: b808f7f
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1c30d2ec-2fc5-4eb7-9073-a93d4b65ab25
Commits-
Reviewing files that changed from the base of the PR and between cc0b565cdc5aae4a412905098e19617c04552aa4 and e481b1fb0f4c2184c9e74f1b8c56ef3c3127d9dd.
Files selected for processing: 2-
apps/desktop/src/shell/DesktopShellEnvironment.test.tsapps/desktop/src/shell/DesktopShellEnvironment.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
Walkthrough
-
POSIX shell preparation now reports whether the login-shell probe found a PATH. A PATH from
launchctlcan still be merged into the process environment, but does not count as successful preparation. Tests check successful hydration, fallback behavior, and an empty probe result.Changes: POSIX Shell Preparation
Priority:Layer / File(s) Summary Resolve POSIX shell preparation status
apps/desktop/src/shell/DesktopShellEnvironment.ts,apps/desktop/src/shell/DesktopShellEnvironment.test.tsinstallPosixEnvironmentreturns whether the login-shell probe found a PATH. macOS and Linux propagate this result. Tests asserttruefor login-shell hydration andfalsefor launchctl-only fallback and an empty probe result. NormalEstimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- pingdotgg/t3code#24054: Changes
runCommandOutputto prevent shell probes from blocking on unread stderr, which can affect the PATH-capture behavior covered here. - pingdotgg/t3code#21913: Fixes login-shell PATH capture failure caused by a full stderr pipe and adds a regression test for that probe path.
Suggested reviewers:
juliusmarminge - pingdotgg/t3code#24054: Changes
Merge Risk:
Minimal · up toe481b-
The change correctly allows server PATH repair when desktop shell probing fails, with no remaining merge-blocking risk identified.
Security architecture risk:
Low · up tocc0b5-
The change corrects startup recovery without adding a public entrypoint or broader privileges. Its scope is local shell execution and environment preparation. Actual timeout and interruption recovery were not exercised, leaving limited uncertainty around failure handling.
Retained concerns No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The changed behavior is bounded to local desktop preparation and the bundled server's environment for that startup. It enables an additional existing shell-recovery pass after incomplete desktop preparation rather than introducing another externally callable interface.
Trust Boundaries and Controls
- inferred — Influence over local shell selection, shell initialization, or PATH remains security-relevant because recovery executes login shells and changes executable resolution. Those environment sources were already trusted by desktop preparation and server recovery before this PR; the inspected change adds no privilege or authentication bypass.
Resilience and Maintainability Implications
- observed — The added failure test supplies empty output; it does not exercise a real timed-out or externally interrupted child. Scoped termination supports the intended cleanup path, but actual OS-level cleanup and the case where server recovery also times out remain unverified.
-
Pre-merge checks:
4-
Check name Status Explanation Title check The title names the main change: a timed-out macOS login-shell probe no longer causes the server to skip its PATH repair. It uses a conventional commit prefix and fits the changeset, which makes insta… Description check The description follows the template. It has Problem, Change, Scope and approval, and Verification sections. The Problem section gives the 5 s timeout, the effect on the server, and dated logs. The Ch… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title names the main change: a timed-out macOS login-shell probe no longer causes the server to skip its PATH repair. It uses a conventional commit prefix and fits the changeset, which makes installPosixEnvironment report whether a login-shell PATH was found and passes that result through installShellEnvironment. The title is specific and does not use vague terms.
Full details: Description check
-
Explanation
The description follows the template. It has Problem, Change, Scope and approval, and Verification sections. The Problem section gives the 5 s timeout, the effect on the server, and dated logs. The Change section explains the POSIX result pass-through, the launchctl-only case, and the Windows exclusion. Scope cites issue
#10534with a triage comment and states one source file and its test. Verification lists the focused test results, lint and check results, and a real-app run with before and after evidence. It also lists what was not checked: Linux, the server's merged PATH read directly, and the case where the server's own probe also times out. The template asks for the model and harness, and the author provides them at the end. Minor gap: the Scope section links a triage comment but does not explicitly confirm the maintainer approval of this exact fix direction, so a reviewer may want to confirm that link covers this fix.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Note
Written by
gpt-6.1-solon behalf of Mariathanks @tiliakoos. your capture-result fix and regression assertions are preserved, along with your commits. i merged main (
0a3b561bc090) and removed the extra path variable and comments. the final diff is two files, 20 insertions and 4 deletions. failed shell capture, including launchctl-only fallback, leaves server path repair enabled. successful capture and windows behavior stay intact.verification:
- both regression assertions failed against main (
expected true to be false). all 36 focused shell, backend-configuration and server path tests passed with the fix. - blacksmith
vp run check:changed github/mainpassed formatting, lint, knip, affected typechecks and tests. - real isolated linux bash processes reproduced the timeout and exercised the production desktop service followed by server
fixPath: main returnedtrue, made one probe, and the executable failed withENOENT; this head returnedfalse, made two probes, and executed it. nonzero-exit recovery also passed. successful capture stayed at one probe.
unverified: packaged electron/bootstrap file-descriptor transport, native macos/windows, and live provider sessions. no ui components changed. coderabbit's new review was skipped by its review limit; its earlier review had no actionable findings.
two independent gpt-6.1-sol reviews found no blockers on
6a7743ef2ad7496d289eed6ac5aed72dd30a41cb.ci on that head: 19 successful checks, eight skipped, no failed or pending checks. nothing was merged.
- both regression assertions failed against main (
juliusmarminge added labelsbugfix
juliusmarminge added labelspr:gate-failed
Note
Written by
gpt-6.1-solon behalf of MariaVerified in a real dev environment#
verified as-is at
6a7743ef2ad7496d289eed6ac5aed72dd30a41cbon a linux boat vm. no source changes or pushes.- reproduced on
github/main(f120c51134c6), installed in a separate worktree. launched real electron with an initial path excluding codex and a real bash login profile that sleeps eight seconds on its first interactive start. the desktop hit its five-second timeout, started the bundled server over bootstrap fd3, and made only one shell probe. the web client reported that it could not startcodex. - repeated on this exact pr head. the desktop hit the same timeout, then the bundled server made a second login-shell probe. the web client discovered codex. a real
gpt-6.1-solturn executed terminal commands and reportedPATH_REPAIR_CODEX_OK,/home/user/.local/bin/codex, and/home/user/path-repair-verification. - created the project through add project → local folder, using a real git repository. drove the dev web client with repository playwright and
/usr/bin/google-chrome. no mocks, fixtures, replay turns, or provider executable stand-ins. - nearby checks passed: a same-thread follow-up returned
FOLLOWUP_CODEX_OK; successful first capture used one shell probe and returnedSUCCESSFUL_CAPTURE_CODEX_OK; a first shell exiting 17 caused a server retry and returnedNONZERO_RECOVERY_CODEX_OK. project/thread history survived restart. one rapid restart hit the ownership guard while shutdown was pending; that attempt was discarded and repeated after port release. - blacksmith ran the existing desktop shell, backend configuration, and server path tests: 36 passed across three files. the runtime builds passed. existing head ci has no failing or pending checks.
short runtime transcript:
main: desktop bash timeout (5000ms); 1 shell probe; codex unavailable in client pr: desktop bash timeout (5000ms); 2 shell probes; codex turn completed pr: successful capture; 1 shell probe; codex turn completed pr: desktop bash exit 17; 2 shell probes; codex turn completedmain after the shell timeout:

pr after the same timeout, with a completed real codex turn:

same-thread follow-up interaction, including terminal execution and completion. inspected the recording and exercised uploaded playback and seeking:

Not verified#
native macos/windows, macos launchctl fallback, packaged desktop distribution, ios/android, and other providers. those platforms/providers were not available or were outside this linux codex scenario. persistent shell failure where the server's retry also times out was not exercised; this change only restores the second attempt. linux electron development startup, its actual bootstrap fd3 transport, the running bundled server, web client, and real codex provider were exercised.
- reproduced on
maria-rcks merged this5e35f6e
maria-rcks closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes