Conversation
T3 Code resolves PATH by running the user's shell with -ilc, so rc files cannot tell the probe apart from a real terminal. Heavy interactive setup such as `mise activate` then runs during the probe and its session-only PATH leaks into every agent and terminal the app starts. Set T3CODE_RESOLVING_ENVIRONMENT=1 in the child environment of the desktop and server login-shell and PowerShell probes, mirroring VS Code's VSCODE_RESOLVING_ENVIRONMENT. The marker never reaches the app's own environment because only allowlisted variables are copied back. The install guide shows a POSIX check for rc files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
9691fff to
0e4adab
Compare
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a new environment signal to production shell probes in both shared/server and desktop startup paths, allowing user startup files to skip session-only setup. The implementation is small and tested, but it introduces cross-platform runtime behavior across files historically maintained by other contributors. You can add or adjust custom eligibility rules. Learn more. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughShell environment probes now pass ChangesShell environment probes
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Suggested reviewers: Merge Risk: ⚪ Minimal · up to The marker remains limited to shell probes; no issue identified here prevents merging after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The marker appears limited to environment-probe subprocesses, with no demonstrated path for it to enter the application’s environment. The remaining risk is limited but not fully resolved because the shared readers also accept caller-selected variable names. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
What Changed
T3 Code now sets
T3CODE_RESOLVING_ENVIRONMENT=1in the environment of the shell processes it spawns to read the user's environment:DesktopShellEnvironmenton desktop, andreadEnvironmentFromLoginShellinpackages/shared, which the server'sfixPathuses.Only the probe child gets the variable. It never lands in T3 Code's own
process.env, and it can't be captured back because the probes copy only allowlisted variables such asPATHandSSH_AUTH_SOCK. The rest of the inherited environment, the shell flags, timeouts, captured variables, and marker-string protocol are unchanged. Thelaunchctl getenv PATHfallback stays unmarked because it runs no user scripts.The install guide now explains the probe and shows how startup files can use the marker:
Why
T3 Code resolves
PATHby running$SHELL -ilc "<capture command>". The-imatters because many users setPATHin.zshrcor.bashrc, but it also makes the probe indistinguishable from a real terminal:[[ -o interactive ]]is true and there is no other reliable signal. Today the only way to detect it is to match T3 Code's internal__T3CODE_ENV_*strings in the command, which only works in zsh.So the full interactive setup runs during the probe, and the
PATHit produces is installed into the T3 Code process and inherited by every agent session and terminal. Some of that setup is meant for one live shell. For example,mise activateswaps mise's shims directory for the install directories of whatever tool versions are active at that moment. Agents then keep those pinned versions and miss newly installed tools until the app restarts. Slow startup files also eat into the probes' 5 second timeout.VS Code has the same kind of probe and sets
VSCODE_RESOLVING_ENVIRONMENT=1for exactly this reason. This gives startup files the same signal under a T3 Code name. Users who don't check it see no change.Notes for review:
$PROFILE, where slow prompt setup is common.-ifrom the probes and so skips.zshrcentirely. The marker keeps the default behavior and lets each user opt out in their own startup files.Testing
vp test run packages/shared/src/shell.test.ts apps/desktop/src/shell/DesktopShellEnvironment.test.ts: new and updated tests assert that the login-shell and PowerShell probes get the marker on top of the inherited environment, thatlaunchctldoes not, and that neither the process environment nor the captured environment contains it. Removing the marker makes the new tests fail.vp run --filter <package> testpasses for@t3tools/shared,@t3tools/desktop, andt3, except desktop'sscripts/browser-secret-native.test.mjs, which needslibsecret-1development headers that were not installed on the test machine.vp run --filter <package> typecheckpasses for all three packages, andvp lintpasses.ZDOTDIR, showed the startup file seeing the marker and returning early while the parent environment stayed clean. The snippet was also checked in dash, bash, and zsh. Not verified on macOS or Windows.Checklist
Written on behalf of jimeh by
claude-opus-5-5usingT3 Code.Summary by CodeRabbit
New Features
T3CODE_RESOLVING_ENVIRONMENT=1. The marker is set only for the probe process, not added to the parent environment.Documentation