Skip to content

[codex] fix: mark desktop shell env probes#3502

Open
StiensWout wants to merge 2 commits into
pingdotgg:mainfrom
StiensWout:staging/fix-shell-env-capture-marker
Open

[codex] fix: mark desktop shell env probes#3502
StiensWout wants to merge 2 commits into
pingdotgg:mainfrom
StiensWout:staging/fix-shell-env-capture-marker

Conversation

@StiensWout

@StiensWout StiensWout commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a desktop POSIX login-shell probe environment overlay with T3CODE_RESOLVING_ENVIRONMENT=1.
  • Supplies TERM=dumb only when the inherited environment has no TERM, while preserving existing TERM values.
  • Adds focused tests for POSIX probe env options and unchanged Windows PowerShell probe behavior.

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 passed
  • PATH="$HOME/.vite-plus/bin:$PATH" vp check - passed, 0 errors; 20 existing unrelated warnings
  • PATH="$HOME/.vite-plus/bin:$PATH" vp run typecheck - passed, completed successfully

Closes #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 PATH and related vars now spawn with an env overlay: T3CODE_RESOLVING_ENVIRONMENT=1 so shell rc files can detect env resolution, plus TERM=dumb when the inherited env has no TERM (existing TERM is kept). Probes use extendEnv: true so those values merge with the current process environment.

runCommandOutput gains optional env / extendEnv and 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_ENVIRONMENT and TERM=dumb

  • Adds ENVIRONMENT_RESOLUTION_MARKER constant and loginShellProbeEnv helper in DesktopShellEnvironment.ts to build a consistent env for POSIX login shell probes, injecting T3CODE_RESOLVING_ENVIRONMENT=1 and TERM=dumb when TERM is not inherited.
  • Extends runCommandOutput to accept optional env and extendEnv flags, threading them into ChildProcess.make; POSIX probes now spawn with extendEnv=true and the constructed env.
  • Windows PowerShell probes are explicitly unaffected and do not receive these env options.
  • Adds tests covering POSIX probe env marking, TERM inheritance, and Windows probe isolation.

Macroscope summarized 6b2ccc9.

StiensWout and others added 2 commits June 22, 2026 10:02
Co-authored-by: Codex <codex@openai.com>
…-marker

[codex] fix: mark desktop shell env probes
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9a6fdc6d-0a33-464b-afe8-a93bcdb3b4d5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jun 22, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Shell environment capture runs interactive zsh without TTY/TERM, spamming gitstatus/zle/monitor/tput errors

1 participant