[codex] fix: mark desktop shell env probes#3502
Conversation
Co-authored-by: Codex <codex@openai.com>
…-marker [codex] fix: mark desktop shell env probes
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
ApprovabilityVerdict: Approved This is a targeted bug fix adding environment markers to shell probes with comprehensive test coverage. The implementation is minimal and self-contained, affecting only internal shell environment resolution behavior without user-facing changes. You can customize Macroscope's approvability policy. Learn more. |
Summary
T3CODE_RESOLVING_ENVIRONMENT=1.TERM=dumbonly when the inherited environment has noTERM, while preserving existingTERMvalues.Root cause
The desktop shell environment capture runs the user login shell to hydrate PATH and related variables, but the probe did not give shell startup files a marker to distinguish env resolution from normal interactive startup and could run without a TERM value.
Impact
Shell rc files can now cheaply skip prompt-only or TTY-only startup while desktop env hydration remains unchanged for PATH, SSH_AUTH_SOCK, Homebrew, and XDG values. Existing Windows PowerShell probing and non-shell child process environments are unchanged.
Validation
PATH="$HOME/.vite-plus/bin:$PATH" vp test run src/shell/DesktopShellEnvironment.test.ts --passWithNoTests- passed, 1 file passed, 9 tests passedPATH="$HOME/.vite-plus/bin:$PATH" vp check- passed, 0 errors; 20 existing unrelated warningsPATH="$HOME/.vite-plus/bin:$PATH" vp run typecheck- passed, completed successfullyCloses #3490
Note
Low Risk
Scoped to desktop shell probing spawn options; PATH/SSH merge behavior unchanged and Windows paths are explicitly untouched.
Overview
POSIX login-shell probes used to hydrate desktop
PATHand related vars now spawn with an env overlay:T3CODE_RESOLVING_ENVIRONMENT=1so shell rc files can detect env resolution, plusTERM=dumbwhen the inherited env has noTERM(existingTERMis kept). Probes useextendEnv: trueso those values merge with the current process environment.runCommandOutputgains optionalenv/extendEnvand passes them through to child process spawn options. Windows PowerShell probes are unchanged (no overlay). Tests assert POSIX probe options and that Windows commands do not set probe env.Reviewed by Cursor Bugbot for commit 6b2ccc9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Mark desktop POSIX login shell env probes with
T3CODE_RESOLVING_ENVIRONMENTandTERM=dumbENVIRONMENT_RESOLUTION_MARKERconstant andloginShellProbeEnvhelper in DesktopShellEnvironment.ts to build a consistent env for POSIX login shell probes, injectingT3CODE_RESOLVING_ENVIRONMENT=1andTERM=dumbwhenTERMis not inherited.runCommandOutputto accept optionalenvandextendEnvflags, threading them intoChildProcess.make; POSIX probes now spawn withextendEnv=trueand the constructed env.Macroscope summarized 6b2ccc9.