fix(launch): the first seat on a new tmux server gets the scoped environment too #2047
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 485 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.370
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #2047"
general
weight: 0.35
openrig-review
What a user gets
The first seat launched on a new tmux server now gets the same scoped environment as every later seat. It no longer gets the daemon's whole environment.
Before, the scoped launch read the default shell,
default-commandandupdate-environmentfrom the running tmux server. Whenrig uplaunched a rig while no tmux server was running yet, those reads failed. The launch then fell back to the previous behaviour, "Scoped tmux environment unavailable; retaining the previous environment for this launch". So that first seat inherited everything the daemon carries, such asANTHROPIC_BASE_URL,OPENAI_BASE_URLandCLAUDE_CODE_USE_BEDROCK, while later seats didn't.Now, when those options can't be read, the empty tmux server is started first, the same way a first start of one seat already does, and the options are read again. A server started this way loads the person's tmux config, so their default shell and
update-environmentapply to the first seat too.The seat-environment integration test was asserting the old inherited environment, which #1573 removed on purpose. On Linux it failed. On macOS, where CI runs it, it passed without checking anything, because there's no
/proc. It now asserts today's behaviour:CLAUDE_CONFIG_DIR,CODEX_HOME, the daemon'sPATH,HOME,OPENRIG_HOME);It runs on Linux only, and is skipped on macOS rather than passing there.
Reported by @AdamWhitehurst in #2041 (items 3 and 4). Refs #2041.
How you verified it
mainata16735a9,npm ci, daemon and CLI built.-
mainwith the old test: the "existing server" case fails. A seat doesn't getANTHROPIC_BASE_URL,OPENAI_BASE_URLorCLAUDE_CODE_USE_BEDROCK, and itsPATHis the daemon's, so the old expectations no longer hold. The "daemon" case passes.-
mainwith the updated test: the "existing server" case passes. The "daemon" case fails: the only seat, the first on the new server, hasANTHROPIC_BASE_URL,CLAUDE_CODE_USE_BEDROCKandOPENAI_BASE_URL. That's the reported fallback, throughrig up.- With this change (daemon rebuilt): both integration cases pass.
tmux-agent-environment.test.ts(real tmux on a private socket, so it runs on macOS too).- The setup: no server is running; the person's
~/.tmux.confsets the default shell and an observingdefault-command; a daemon-only variable is set.- With this change, the first seat sees the selected value and not the daemon-only one, and no fallback warning is logged.
- With
main'stmux.tsit sees the daemon-only value and not the selected one. That's on Linux and macOS.tsc --noEmitpasses. 559 tests pass across 15 tmux, launch, first-start, restore and teardown test files, with the integration file reported as skipped (2 tests). Single worker.npm testandnpm run lint, which are left to CI.Anything you were unsure about
new-sessionwould otherwise have started it with the daemon's environment.CHANGELOG.mdedit🤖 Generated with Claude Code