fix(terminal): identify T3 Code to integrated shells#22827

draft3
main
fix/issue-8450
opened3d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 2h ago

Problem

The integrated terminal did not identify T3 Code to shells, so shell prompts and terminal detection inherited the parent terminal identity or fell back to generic behavior.

Change

Set TERM_PROGRAM=t3code and TERM_PROGRAM_VERSION from the server app version in the shared shell spawn path. Open and restart use the same path. Existing COLORTERM behavior, user environment passthrough, and filtering are unchanged.

Scope and approval

Fixes #8450

Triaged bug via the automated issue flow.

  • Manager.test.ts: 42 → 43 tests, 43 passing after implementation. The new open/restart regression fails on the tests-only commit because the parent terminal identity remains.
  • Scoped lint passes (one existing warning); server typecheck passes with existing suggestions.
  • No regex, parser, dependency, schema, client, or render changes.

Verification

References #8450.

Validation

Evidence

Fixture matrix.

Linux browser integrated terminalBeforeAfter
Real app, bash, node-pty; command `envgrep -E 'TERMCOLORTERM'`

Before output: COLORTERM=truecolor, TERM=xterm-256color; TERM_PROGRAM and TERM_PROGRAM_VERSION absent. After adds TERM_PROGRAM=t3code, TERM_PROGRAM_VERSION=0.1.1, matching the server package version. The app ran with T3CODE_HOME unset and explicit isolated home /home/ubuntu/wt/issue-8450/.t3, web port 7015, server port 15055. The transcript includes the checked-out after SHA. A new shell was opened after the dev server reloaded the implementation.

What else changed: no render paths changed. Runtime output adds the two terminal identity variables; TERM and COLORTERM remain as before. No screenshot/pixel diff is applicable to this server environment change.

Unverified surfaces: native Windows ConPTY and Electron desktop/macOS, including packaged desktop version. Base inherited identity, open/restart and unrelated passthrough/filtering are covered by the service test; session runtime identity override precedence was inspected in code, not independently exercised. The fixed T3 identity also replaces an explicitly supplied TERM_PROGRAM/TERM_PROGRAM_VERSION. Mixed-case Windows inherited identity keys were not exercised.

Model: GPT-6.1-Sol. Harness: Codex through T3 Code. Independent reviewers: Codex GPT-6.1-Sol and Claude Opus 5.5, both VERDICT: MERGE with no confirmed findings. Proof audit pass 1 accepted the evidence plan; pass 2 returned SUFFICIENT. New and restarted shells receive the identity; already-running shells retain their old environment.

Checks

All checks passed

Added 2 commits

  • test(terminal): add takeover regression tests for terminal identity3595ba7
  • fix(terminal): identify integrated shells as t3code8c937f8
Synced from GitHub

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire4.9 KiB5.0 KiB+23 B (+0.5%)6.8 KiB✅
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
CodexLive turn WebSocket wire1.2 KiB1.2 KiB+23 B (+1.9%)2.0 KiB✅
CodexLive turn WebSocket decoded20.8 KiB20.9 KiB+41 B (+0.2%)29.3 KiB✅
CodexLive turn messages12+1 (+100.0%)8✅
ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiB✅
ClaudeLive turn messages220 (0.0%)8✅

Baseline: 8d3b061 · PR result: acaee88 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Added 1 commit

  • Merge branch 'main' into fix/issue-8450acaee88