Skip to content

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

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

[codex] fix: mark desktop shell env probes#3502
StiensWout wants to merge 1 commit 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 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: true and an overlay env: T3CODE_RESOLVING_ENVIRONMENT=1 plus TERM=dumb when the parent has no TERM, or the inherited TERM when set. Shell startup can detect env resolution and avoid prompt/TTY-only work without changing what gets captured.

runCommandOutput gains optional env / extendEnv passed through to child process spawn; only POSIX readLoginShellEnvironment uses 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_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 4dbc687.

@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: 0d43a003-c202-43ba-81ac-b6f574a65508

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.

@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.

@StiensWout StiensWout force-pushed the staging/fix-shell-env-capture-marker branch from 5e8c2d6 to c79ac4d Compare June 23, 2026 05:40
Co-authored-by: Codex <codex@openai.com>
@StiensWout StiensWout force-pushed the staging/fix-shell-env-capture-marker branch from c79ac4d to 4dbc687 Compare June 23, 2026 19:13
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