Repository navigation
fix(codex): run native Windows on the user's own ~/.codex - #19215
brennanb2025 wants to merge 10 commits into
Conversation
Windows was excluded from the real-home hook lane by a bare platform check, so every Windows pane fell back to the managed mirror and exported Orca's CODEX_HOME into the interactive shell. Anything the user then ran inherited it -- including Codex's own installer, which derives its install root from CODEX_HOME, installs into Orca's directory, and then refuses to retarget the global bin junction because that junction points into the real ~/.codex. The exclusion existed only because the lane's guard was the POSIX startup-file probe. That probe answers "will the shell re-export CODEX_HOME somewhere else?" -- a question Windows does not need it for: the persisted user/machine environment block is inherited at process creation, so setx and Control Panel values are already in process.env, where hasCustomCodexHomeOverride reads them. On Windows the probe returned undefined, which reads as a false all-clear; that is why the guard was on the platform rather than the value. Guard the lane on isLaunchEnvOverrideVisible() instead, which is true on win32 and defers to the probe elsewhere. The rc parser stays POSIX-only. Known blind spot, unchanged in kind from what the probe already accepts: a CODEX_HOME assigned inside a PowerShell profile or a Git Bash startup file is shell-runtime state in neither source. Worst case is a status-blind pane -- Orca still only ever mutates ~/.codex, the one path it can clean on downgrade, and it keeps a pristine pre-Orca backup before touching it. Managed multi-account and custom-CODEX_HOME users are unaffected and stay on the mirror.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Windows users who define CODEX_HOME in PowerShell or Git Bash startup files can be routed to the wrong Codex account or configuration. This should be fixed before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 29.17% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 35 files. (1 skipped: 1 unsupported.) Full details: Description checkExplanation The description is detailed and on topic, but it does not satisfy the repository template because it omits the required Linked Issue entry and several required checklist confirmations, including the Agent skill upstream boundary and final validation checklist. Resolution Add a valid issue reference in the required
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
isLaunchEnvOverrideVisiblepredicate — new seam inshell-startup-env.tsreturningtrueon win32 (env block inherited at process creation) and deferring to the POSIX startup-file probe elsewhere; carries a clear doc comment.- Windows lane routing —
isHostSystemDefaultRealHomeSelectedno longer short-circuits on win32, so a native host with no customCODEX_HOMEtakes the real-home lane, aligning it withisHostSystemDefaultSessionMigrationEligible(which already keyed off the override). - Test harness —
isLaunchEnvOverrideVisibleadded to the mock so the singleshellStartupEnvProbeSupportedknob still governs lane routing for the suite's managed-fallback cases. - Tests — the Windows ownership test flips its pin and adds env-set and launch-env-set override cases;
shell-startup-env.test.tspins win32 launch-env authority.
The change is well-scoped and the reasoning holds: on Windows the persisted user/machine environment block is inherited at process creation, so hasCustomCodexHomeOverrideForLaunch already saw setx/Control Panel values in process.env; the old !isShellStartupEnvProbeSupported() guard was the only thing keeping Windows on the mirror. The blind spot (a CODEX_HOME assigned in a PowerShell profile or Git Bash startup file) is documented honestly as degradation-not-corruption, and the ship gate on real-Windows verification via setRealHomeLaneGate is the right call since Linux CI can't exercise the inheritance claim. Verified green locally: shell-startup-env.test.ts, runtime-home-windows-profile-ownership.test.ts, and the harness-dependent routing/retained-auth/per-account-home suites.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: cf70ee34-f52b-4808-833e-05cc2f56c4a8
📒 Files selected for processing (5)
src/main/codex-accounts/runtime-home-service-home-routing.tssrc/main/codex-accounts/runtime-home-service-test-harness.tssrc/main/codex-accounts/runtime-home-windows-profile-ownership.test.tssrc/main/pty/shell-startup-env.test.tssrc/main/pty/shell-startup-env.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| normalizeCodexRuntimeSelection(settings).host !== null || | ||
| !isShellStartupEnvProbeSupported() | ||
| ) { | ||
| if (normalizeCodexRuntimeSelection(settings).host !== null || !isLaunchEnvOverrideVisible()) { |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- target file ---'
sed -n '110,185p' src/main/codex-accounts/runtime-home-service-home-routing.ts
printf '%s\n' '--- direct definitions/usages ---'
rg -n -C 4 'isLaunchEnvOverrideVisible|hasCustomCodexHomeOverrideForLaunch|normalizeCodexRuntimeSelection|real-home|managed' src/main
printf '%s\n' '--- relevant tests ---'
rg -n -C 5 'profile|PowerShell|Git Bash|CODEX_HOME|isLaunchEnvOverrideVisible|hasCustomCodexHomeOverrideForLaunch' src test tests 2>/dev/null || trueRepository: stablyai/orca
Length of output: 50370
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings
Length of output: 35500
🏁 Script executed:
#!/bin/bash
set -e
log=/tmp/coderabbit-shell-logs/shell-output-vmx3XT
printf '%s\n' '--- target-file excerpts from prior output ---'
rg -n -A45 -B10 'runtime-home-service-home-routing\.ts' "$log" | head -n 240
printf '%s\n' '--- direct source symbols ---'
rg -n -C 8 'isLaunchEnvOverrideVisible|hasCustomCodexHomeOverrideForLaunch|normalizeCodexRuntimeSelection|real-home' src/main/codex-accounts src/main --glob '*codex*' --glob '*runtime-home*'
printf '%s\n' '--- focused tests ---'
rg -l 'isLaunchEnvOverrideVisible|hasCustomCodexHomeOverrideForLaunch|runtime-home-service-home-routing|CODEX_HOME' src/main/codex-accounts src/main --glob '*.test.ts' | while read -r f; do
echo "### $f"
rg -n -C 5 'isLaunchEnvOverrideVisible|hasCustomCodexHomeOverrideForLaunch|runtime-home-service-home-routing|CODEX_HOME|profile|Git Bash|PowerShell' "$f"
doneRepository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- files in codex-accounts ---'
git ls-files src/main/codex-accounts
printf '%s\n' '--- routing file outline and relevant sections ---'
wc -l src/main/codex-accounts/runtime-home-service-home-routing.ts
cat -n src/main/codex-accounts/runtime-home-service-home-routing.ts | sed -n '1,220p'Repository: stablyai/orca
Length of output: 16704
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- shell startup environment implementation ---'
rg -n -C 12 'export function (isLaunchEnvOverrideVisible|hasCustomCodexHomeOverrideForLaunch)|function (isLaunchEnvOverrideVisible|hasCustomCodexHomeOverrideForLaunch)|isLaunchEnvOverrideVisible' src/main/pty/shell-startup-env.ts src/main/codex/codex-real-home-path.ts
cat -n src/main/pty/shell-startup-env.ts | sed -n '1,180p'
printf '%s\n' '--- real-home override helper ---'
cat -n src/main/codex/codex-real-home-path.ts | sed -n '1,180p'
printf '%s\n' '--- routing tests ---'
for f in src/main/codex-accounts/runtime-home-real-home-lane-routing.test.ts src/main/codex-accounts/runtime-home-windows-profile-ownership.test.ts; do
echo "### $f"
rg -n -C 12 'real-home|CODEX_HOME|override|profile|launchEnv|isHostSystemDefaultRealHomeSelected|isLaunchEnvOverrideVisible' "$f"
doneRepository: stablyai/orca
Length of output: 31277
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- route consumers and launch environment construction ---'
rg -n -C 8 'isHostSystemDefaultRealHome\(|isHostSystemDefaultRealHomeSelected\(|getSelectedHostCodexHomeRoute\(|getRuntimeHomePath\(|CODEX_HOME|ORCA_CODEX_HOME' src/main/codex-accounts/runtime-home-service.ts src/main/codex-accounts/runtime-home-service-*.ts src/main/pty src/main/providers --glob '*.ts' | head -n 500
printf '%s\n' '--- focused routing test file ---'
cat -n src/main/codex-accounts/runtime-home-real-home-lane-routing.test.ts | sed -n '1,260p'Repository: stablyai/orca
Length of output: 50369
Keep the managed fallback for profile-only CODEX_HOME.
On Windows, isLaunchEnvOverrideVisible() treats the inherited environment as complete, despite the documented blind spot for PowerShell profiles and Git Bash startup files. hasCustomCodexHomeOverrideForLaunch(launchEnv) then sees no override, so isHostSystemDefaultRealHomeSelected() selects real-home while the launched shell can export another CODEX_HOME. Session discovery, migration, and auth synchronization can then target ~/.codex instead of the shell's home. Keep the managed fallback unless a shell-specific probe or trust result proves that no profile override exists. Add a regression test for a profile-only custom CODEX_HOME.
| isShellStartupEnvProbeSupported: () => testState.shellStartupEnvProbeSupported, | ||
| // Why: the lane reads this, not the raw probe flag. Keeping the one knob | ||
| // authoritative stops a win32-forcing case from silently re-enabling it. | ||
| isLaunchEnvOverrideVisible: () => testState.shellStartupEnvProbeSupported |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Separate the launch-visibility mock from the startup-probe mock.
Production isLaunchEnvOverrideVisible() returns true on Windows even when isShellStartupEnvProbeSupported() returns false. This mock returns the same testState.shellStartupEnvProbeSupportedvalue for both functions, so the harness cannot model the Windows case added by this change. Tests that disable the startup probe can therefore exercise the mirror fallback instead of real-home routing. Add a separatelaunchEnvOverrideVisible` test control, or make the mock platform-aware.
…duction cannot reach Review found the new predicate is total: isLaunchEnvOverrideVisible() is `win32 || !win32`, so it never returns false and the routing site's second disjunct is unreachable. The behaviour is what was intended -- the win32 lane block is gone and POSIX is untouched -- but the expression read as a live platform decision, and the surrounding comments then compounded that. Deleting the seam outright would push ~30 mirror-lane cases onto a new lever across 135 service constructions, so keep it as the single named gate and say plainly in its doc that it is total today and why it still earns a name. Correct three comments that now describe an impossible state: - the fixtures claimed the mirror is "still live wherever the shell-startup probe is unavailable (Windows)" and that production "still uses" it there. Since the win32 block is gone, production reaches the mirror only via a host account selection, a custom CODEX_HOME, or an incapable trust-grant host. The knob is a test-only lane lever now, and says so. - the new test claimed lane routing and session migration "read the same override". They agree only on process env: migration takes no launchEnv. Pin that asymmetry instead of implying agreement -- a launch-scoped CODEX_HOME steers the lane while migration stays eligible.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
isLaunchEnvOverrideVisibledoc comment — now states plainly that the predicate is total today (win32 || !win32, never false in production) and why it still earns a named seam: one mock lever across the runtime-home harness instead of pushing ~30 mirror-lane cases onto a new lever across 135 service constructions.- Fixture knob comments — corrected to describe the mirror as reached via host-account selection, a custom
CODEX_HOME, or an incapable trust-grant host, not by platform; theshellStartupEnvProbeSupportedknob is now labeled a test-only lane lever rather than a mirror of a platform gate. - Asymmetry pin — the ownership test now asserts that a launch-scoped
CODEX_HOMEsteers lane routing off the real home whileisHostSystemDefaultSessionMigrationEligible()(which reads onlyprocess.env) stays eligible, and corrects the prior "read the same override" comment that implied false agreement.
The changes are documentation corrections plus one new characterization test; no production behavior changed. The new assertion is exact and verified against getLaunchEnvValue's process-env fallback semantics. runtime-home-windows-profile-ownership.test.ts (3 tests) and shell-startup-env.test.ts (51 tests) pass.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…t Windows fallback Review pass 2 caught commit 2 reintroducing exactly what it set out to remove. "migration reads no launchEnv" is false: only the eligibility precheck is launch-env-blind. beginHostSystemDefaultSessionMigrationLaunch forwards launchEnv into invalidateBackfillAfterManagedSystemDefaultLaunch, which re-checks hasCustomCodexHomeOverrideForLaunch and refuses. The assertion was right; the prose was not. Point it at the precheck and name the case that pins the launch-side refusal. Also cover the gap that pass 2 identified: nothing exercised the mirror lane on Windows through realHomeLaneGate() === false. That is the likeliest real Windows fallback -- an older codex binary whose trust grant is refused -- and it is the reach behind the first-launch rollback path, which is newly live on Windows and whose closest existing tests are skipIf(win32). The shape it pins is deliberate: selection is true while the lane is false, because the lane is selected before the grant is attempted.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Incapable-host fallback test — added a Windows case pinning that a trust-grant-incapable host still reports
isHostSystemDefaultRealHomeSelectedtrue whileisHostSystemDefaultRealHomeis false, capturing the "selection precedes the grant" shipped shape the mirror fallback relies on. - Asymmetry comment correction — reworded the launch-scoped
CODEX_HOMEpin to distinguish the eligibility precheck (which takes nolaunchEnv) from the migration launch (which re-validates the home path and refuses), replacing the prior "reads the same override" phrasing that implied false agreement.
The new test is meaningful coverage: it would fail if isHostSystemDefaultRealHome ever stopped consulting realHomeLaneGate(), and it directly exercises the incapable-host path the PR description flags as a ship gate that Linux CI can't reach. The comment cross-reference (runtime-home-real-home-lane-routing.test.ts's toBeNull() case) is accurate, and the "precheck blind / launch re-checks" distinction matches beginHostSystemDefaultSessionMigrationLaunch re-validating eligibility and the home path. Verified the file passes (4 tests).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Review pass 3 found one more instance of the class commit 2 set out to purge, in a file this PR does not otherwise touch: the per-account mirror case said "a Windows host keeps the shared system-default mirror". That was true before this change and is false after it -- the mirror there comes from the host account selection on the line below, not from the platform. Also name which of the two toBeNull() cases the precheck comment points at; the file has one for a missing path and one for a launchEnv CODEX_HOME, and only the second is the launch-side refusal being cited.
…ndows-real-home-lane # Conflicts: # src/main/codex-accounts/runtime-home-settings-test-fixtures.ts
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Merge of
origin/main— brought the branch up to date with base374c676; the only PR-relevant conflict was inruntime-home-settings-test-fixtures.ts. createSettingsfixture resolution — kept the PR'ssetShellStartupEnvProbeSupportedForTest(...)mirror-lane lever and its comment, and adopted main's sharedcreateCodexAccountSettings(fakeHomeDir, overrides)factory in place of the hand-written settings literal.
The conflict resolution is faithful: the mirror-lane defaulting lever is preserved, workspaceDir still resolves to testState.fakeHomeDir, and no production file changed in this delta. All 45 src/main/codex-accounts test files (338 tests) pass locally, including runtime-home-windows-profile-ownership.test.ts.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Review + validation statusFour adversarial review passes (converged CLEAN), two readiness-checklist passes, a precedent review, and validation on a real Windows host. Three rounds of fixes pushed; Validated on real WindowsRun against a dev build of this branch (HEAD
The baseline contrast is the proof. In a pane under the shipped Orca on that same box: That is the reported bug reproduced first-hand — the exact directory the Codex installer picked up. On this branch, (b) (c) From the dev main-process log: Zero occurrences of What review changedNot one finding was in the logic — the predicate swap was correct from the first commit. Every defect was prose: four files carried comments asserting a "Windows keeps the mirror" rule that this diff deletes, including two files the PR does not otherwise touch. Removing a platform rule invalidates every comment that explained it, and no test catches that.
PrecedentAligned. Treating the inherited Windows environment block as authoritative rather than resolving a shell environment is the established position, as is installing a self-gated hook into the user's real config dir instead of relocating the config home — which Orca already does ( Open items
Note for Windows CI
|
…ndows-real-home-lane
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
The reported failure, proven fixed on real WindowsThe earlier validation showed Dev build of this branch, isolated profile ( A — lane state Same box under the shipped build: both variables are B — the installer's own derivation ( $codexHome = if ([string]::IsNullOrWhiteSpace($env:CODEX_HOME)) {
Join-Path $env:USERPROFILE ".codex"
} else { $env:CODEX_HOME }
$standaloneRoot = Join-Path $codexHome "packages\standalone"C — the guard that threw (L659-664), run against a real NTFS junction whose Same box, same junction, two derived roots, opposite outcomes. That isolates the variable. Limits, stated plainly
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: bb7f3511-15c1-4506-9dc9-388989859cdc
📒 Files selected for processing (28)
src/main/__fixtures__/shell-wrapper-snapshots/local-bash-rcfile.txtsrc/main/daemon/daemon-foreground-confirmation-protocol.test.tssrc/main/daemon/daemon-protocol-version.test.tssrc/main/daemon/daemon-protocol-version.tssrc/main/daemon/daemon-pty-router.test.tssrc/main/daemon/pty-subprocess-test-harness.tssrc/main/daemon/pty-subprocess-windows-shell-launch.test.tssrc/main/daemon/pty-subprocess/native-pty-spawn.tssrc/main/daemon/pty-subprocess/shell-launch-plan.tssrc/main/daemon/pty-subprocess/spawn-environment.tssrc/main/daemon/types.tssrc/main/ipc/pty-daemon-spawn-agent-home-env.test.tssrc/main/ipc/pty-spawn-env-terminal-basics.test.tssrc/main/ipc/pty/host-env/assembly.tssrc/main/ipc/pty/ipc/spawn-options.tssrc/main/powershell-osc133-bootstrap-windows-clm.test.tssrc/main/powershell-osc133-bootstrap.test.tssrc/main/powershell-osc133-bootstrap.tssrc/main/providers/local-pty-provider-windows-shell-launch.test.tssrc/main/providers/local-pty-shell-ready-bash-rcfile.tssrc/main/providers/local-pty-shell-ready-wrapper-generation.test.tssrc/main/providers/local-pty-utils-windows-fallback.test.tssrc/main/providers/local-pty-utils.tssrc/main/providers/local-pty-windows-spawn-environment.tssrc/main/providers/windows-shell-args.test.tssrc/main/providers/windows-shell-args.tssrc/main/pty/codex-default-home-shell-startup.test.tssrc/main/pty/codex-default-home-shell-startup.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Post-profile reset marker —
src/main/pty/codex-default-home-shell-startup.tsadds a one-shotORCA_CODEX_DEFAULT_HOME_AFTER_PROFILEmarker that the PowerShell OSC133 bootstrap and the Git Bash shell-ready rcfile consume after profile scripts ('1'→unset CODEX_HOME; a path → restore that explicit default home), closing the previously accepted PowerShell/Git-Bash profile blind spot. - Daemon env reconciliation —
reconcileDaemonCodexDefaultHomeMarkerandscrubCodexDefaultHomeMarkerForWindowsShellkeep the marker coherent across a persistent daemon's inherited env and drop it before shells that cannot consume it (cmd.exe,wsl.exe, non-Git-Bash bash), at both the primary spawn and each fallback attempt. - Windows launch plumbing —
buildPtyHostEnvsets the marker only for native Windows real-home launches (win32, non-WSL, no custom override); Git Bash keeps its shell-ready wrapper without a Codex preflight; the daemon protocol bumps to v37 so a stale daemon is replaced while its sessions stay attachable. - Tests — new pure-function, bash-rcfile, PowerShell CLM, IPC env-assembly, and daemon-router cases pin the marker's set/scrub/reconcile behavior and v36-legacy compatibility.
I traced the marker set/reconcile/scrub path end-to-end (including the persistent-daemon inherited-CODEX_HOME case, where the reset is deliberately dropped to avoid clobbering user-owned state) and confirmed the reset block runs after profile sourcing in the rcfile. The Linux-runnable suites pass locally (codex-default-home-shell-startup, shell-startup-env, local-pty-shell-ready-wrapper-generation, pty-spawn-env-terminal-basics, pty-daemon-spawn-agent-home-env — 140 tests). The Windows-gated PowerShell CLM cases still can't run on Linux CI, so the standing real-Windows ship gate from the PR description remains the right call.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/pty/shell-startup-env.ts (1)
32-52: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winDo not select the Windows real-home route when startup-file overrides are not visible.
isHostSystemDefaultRealHomeSelected()treatswin32as authoritative, so aCODEX_HOMEvalue assigned only by a PowerShell profile or Git Bash startup file is missed. The real-home route then sends the unset-after-profile marker, and both shell wrappers removeCODEX_HOME. Fix this shared visibility boundary for both shells. Keep Git Bash’s OSC 133 wrapper unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: ed73eedd-e07e-41fc-9a45-7e7276d28950
📒 Files selected for processing (3)
src/main/daemon/pty-subprocess-windows-shell-launch.test.tssrc/main/pty/codex-default-home-shell-startup.test.tssrc/main/pty/codex-default-home-shell-startup.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Final review status — code clean; Windows Electron QA still requiredReviewed and pushed through same-model adversarial fix/re-review loops plus opening and final readiness checks. Final HEAD is Findings fixed
The final design uses a trusted, one-shot post-profile instruction for PowerShell and Git Bash, keeps Git Bash integration independent of managed preflight, makes Electron's prepared home authoritative for that daemon child only, and keeps v36 attachable while fresh work uses v37. The TypeScript and JSON packaged compatibility artifacts now both declare v37. Correction to my earlier status comment: profile-only Review verdict
Validation
Remaining gateA new Grok-driven Windows Electron run could not start because the Grok account had zero credits. No new screenshots were produced; the existing Windows screenshots on this PR predate the final shell/daemon correction. Recommendation: code review is clean, but land only after full exact-head CI completes and native-Windows Electron validation covers final HEAD with PowerShell and Git Bash profile/startup |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/codex-accounts/runtime-home-service-home-routing.ts (1)
147-152: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winTreat Windows profile-defined
CODEX_HOMEas a custom-home override.isLaunchEnvOverrideVisible()returns true on Windows, whilegetCustomCodexHomeOverrideForLaunch()cannot inspect PowerShell profiles or Git Bash startup files. A profile-only override therefore selects the real-home lane. The PTY marker then clears or replacesCODEX_HOMEafter profile startup, so the pane can run with~/.codexinstead of its configured custom home. Change this selection boundary to retain the managed mirror when a Windows startup-file override can exist, or resolve the profile value before selecting the real-home lane.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 853373fc-d433-4e16-acd6-40e6f1870989
📒 Files selected for processing (2)
src/shared/local-build-compatibility-contract.jsonsrc/shared/local-build-compatibility-contract.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — one stale-comment nit inline.
Reviewed changes
- Authoritative daemon reconciliation —
reconcileDaemonCodexDefaultHomeMarkernow applies main's prepared default-home selection over daemon-only inherited state (unset or setCODEX_HOME, clearORCA_CODEX_HOME) instead of conservatively dropping the marker. This is what actually makes a real-home request take effect on a persistent daemon whose inheritedprocess.envholds Orca's stale managedCODEX_HOME. - Packaged protocol contract alignment —
local-build-compatibility-contract.jsonand.tsbumpeddaemonProtocolVersion36→37 and appended 37 toattachableDaemonProtocolVersions, restoring thelocal-build-compatibility-contract.test.tsinvariant againstPROTOCOL_VERSION. - Tests — the reconcile and Windows-shell-launch cases are rewritten to pin the authoritative behavior (exact equality on
env, including the unset and explicit-path cases), plus a new "no selection preserves daemon-only custom home" case.
The flip is correct: when main emits the marker it has already ruled out a visible custom override, so the daemon's inherited CODEX_HOME/ORCA_CODEX_HOME can only be Orca's own managed value, which is exactly what a real-home launch must override. The tests would fail under the previous conservative implementation, so they're meaningful coverage.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Marker scrub keyed off the resolved launch —
scrubCodexDefaultHomeMarkerForLaunch(env, supportsCodexDefaultHomeAfterProfile)replaces the shell-path predicate, and the capability flag is threaded throughWindowsShellLaunchArgs,WindowsShellSpawnAttempt, andLocalPtyLaunchPlanfrom the site where each shell's launch args are actually built (PowerShell true; Git Bash true only with a materialized wrapper; cmd/wsl/unknown absent). - Git Bash fallback now drops the marker —
getGitBashLaunchCommandreports support only when the shell-ready wrapper exists, so a failed wrapper write launches--login -iwith the one-shot marker scrubbed instead of leaking it unconsumed into the pane and its children. - Stale rationale removed — the retired "reconciliation may preserve a daemon-only custom home" comment in
shell-launch-plan.tsis gone, which retires the one open prior-review thread. - Tests — new daemon and in-process cases pin the wrapper-materialization-failure path (plain login args, marker absent);
scrubCodexDefaultHomeMarkerForLaunchis covered fortrue/false/undefined; and the Windows fallback test asserts the cmd.exe fallback removes the marker.
The refactor is behavior-preserving for every consuming shell and strictly narrows retention: the only case that changes is a Git Bash whose wrapper did not install, which previously kept a marker nothing could consume. Verified locally that the touched suites pass (codex-default-home-shell-startup, windows-shell-args, local-pty-utils-windows-fallback, pty-subprocess-windows-shell-launch, local-pty-provider-windows-shell-launch, local-pty-shell-ready-wrapper-generation — 105 tests).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Review status: code clean; packaged update proof still blockedReviewed and validated exact head One material issue was found and fixed during review: Git Bash wrapper materialization could fail open while retaining a one-shot home marker that the launched shell could not consume. Marker retention now comes from the resolved launch's actual consumer capability. Successful PowerShell and wrapped Git Bash launches consume it; unsupported, unwrapped, and degraded paths remove it while still allowing the terminal to launch. Validation completed:
Windows evidence:
This review is not gap-free. A true packaged protocol-v36 → v37 NSIS update and daemon reattach remains blocked. Exact-head CI produces an unpacked Windows app rather than an NSIS installer, and the updater harness must run on disposable Windows because it replaces the registered installation and shortcuts. The available high-spec host has a live production Orca install and no usable Windows Sandbox or admin-accessible VM, so I did not risk that installation. Closing the remaining material gap requires an exact-head v37 installer, a protocol-v36 baseline installer, and the repo's updater E2E on disposable Windows CI. An explicit managed-account pane was also not opened because no managed account was added; live custom-home routing and focused tests covered the same managed/custom selection boundary. |
|
Closing as superseded: a merged PR already covers this change. Merged #24356 (bd6d7b9) 'run Windows Codex on the real ~/.codex' removed the isShellStartupEnvProbeSupported Windows guard from runtime-home-service-home-routing.ts and added powershell-profile-env.ts; same goal and (Stale-PR cleanup 2026-10-20, approved by Brennan. Reopen if something here is still missing on main.) |





Problem
On native Windows, the system-default Codex route stayed on Orca's managed mirror and exported Orca's
CODEX_HOMEinto the interactive shell. Programs launched from that pane inherited the private home. In the reported case, Codex's installer derived its install root from that variable, staged into Orca's directory, and then rejected the user's real global bin junction as "not managed by this installer."Root cause
The real-home lane was disabled by a Windows platform guard because its original eligibility check depended on a POSIX startup-file probe. Windows persisted environment values are already present in the launch environment, but PowerShell profiles and Git Bash startup files can still change
CODEX_HOMEafter process creation. Persistent terminal daemons add a second boundary: their inherited environment can outlive Electron and must not silently disagree with the home Electron prepared and attributed.Change
CODEX_HOMEis selected and the Codex hook trust grant succeeds.ORCA_CODEX_DEFAULT_HOME_AFTER_PROFILEinstruction reapplies the prepared default home after PowerShell or Git Bash profiles load, then removes itself.Scope and compatibility
Managed multi-account and genuine custom-
CODEX_HOMEusers remain on their existing managed/custom routes. The change adds no mobile-facing behavior, SSH or relay-wire change, settings or persisted-state schema change, dependency, or new subprocess. Folder workspaces remain supported.Validation
3310201848c2e3d763481132246560bb1850dce8; no remaining P0–P2 findings.pnpm tc:node, changed-file code quality, formatting, commit hooks, andgit diff --checkpassed.origin/mainis conflict-free.Windows Electron proof
Windows high-spec validation ran the exact PR checkout in hidden renderers with
ORCA_BACKGROUND_LAUNCH=1, isolated user-data and profile roots, and Playwright over CDP. App identity matched this branch and worktree; renderers reported zero console errors and the v37 daemon remained healthy.codex --versionlaunched from the tested real-home pane and exited successfully.CODEX_HOMEremained on Orca's managed mirror and did not enter the real-home lane.Remaining release evidence
This review is not claiming gap-free packaged-updater coverage. A true packaged protocol-v36 → v37 NSIS update and daemon reattach remains blocked. The exact PR CI builds the Windows app with
electron-builder --dirand does not publish an exact-head NSIS installer. The repository updater harness requires a disposable Windows environment because the NSIS install replaces the registry-registered copy and its shortcuts. The available high-spec host has a live production Orca installation and no usable Windows Sandbox or admin-accessible VM, so running the harness there would risk that installation.Closing this evidence gap requires an exact-head v37
orca-windows-setup.exe, a protocol-v36 baseline installer, and the repositorywin-update-e2eworkflow on disposable Windows CI. An explicit managed-account pane was also not opened because no managed account was added; the equivalent managed/custom routing was exercised through a live explicit-custom-home launch and focused tests.