[codex] fix: mark desktop shell env probes#3502
Conversation
|
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. |
5e8c2d6 to
c79ac4d
Compare
Co-authored-by: Codex <codex@openai.com>
c79ac4d to
4dbc687
Compare
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 POSIX login-shell child spawns during env hydration; Windows and launchctl paths are untouched.
Overview
POSIX login-shell probes used to hydrate desktop PATH and related vars now spawn with
extendEnv: trueand an overlay env:T3CODE_RESOLVING_ENVIRONMENT=1plusTERM=dumbwhen the parent has noTERM, or the inheritedTERMwhen set. Shell startup can detect env resolution and avoid prompt/TTY-only work without changing what gets captured.runCommandOutputgains optionalenv/extendEnvpassed through to child process spawn; only POSIXreadLoginShellEnvironmentuses them. Windows PowerShell probes stay unchanged (no extra env options).Tests assert POSIX probe args/env and that Windows commands do not get the POSIX overlay.
Reviewed by Cursor Bugbot for commit 4dbc687. 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 4dbc687.