fix(tmux): retain pane terminal identity through scoped launch #2043
<!-- coderabbit-ai-generated:v1 -->
<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- review_stack_entry_start -->
<a href="https://app.coderabbit.ai/change-stack/mvschwarz/openrig/pull/2043?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a>
<!-- review_stack_entry_end -->
<!-- recent_review_start -->
No actionable comments were generated in the recent review.
<details>
<summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="16" height="16" align="absmiddle" alt=""></picture> Recent review info</strong></summary>
<dl>
<dd>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary>
<dl>
<dd>
ffeaa1a0-3154-43b7-afb9-7ef87a0f429c</dd>
</dl>
</details>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary>
<dl>
<dd>
Reviewing files that changed from the base of the PR and between 4222e608049085faba14a473d73d1973d24a7860 and 0ae50f6cb94d3140b7accedd51ab86ff454a9dd6.
</dd>
</dl>
</details>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 2</strong></summary>
<dl>
<dd>
packages/daemon/src/adapters/tmux.ts
packages/daemon/test/s03-bound-launch.test.ts
</dd>
</dl>
</details>
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
</dd>
</dl>
</details>
<!-- recent_review_end -->
<!-- walkthrough_start -->
<details>
<summary><strong>Walkthrough</strong></summary>
<dl>
<dd>
The scoped tmux launch reset now preserves TERM_PROGRAM and TERM_PROGRAM_VERSION from the pane. Tests cover terminal-program forwarding and relative Wayland display resolution in scoped launches.
Changes: Scoped tmux launch
|Layer / File(s)|Summary|
|:---|:---|
|Preserve pane terminal identity in scoped launches <br> packages/daemon/src/adapters/tmux.ts, packages/daemon/test/s03-bound-launch.test.ts|The reset command restores TERM_PROGRAM and TERM_PROGRAM_VERSION from the tmux pane, using empty strings when unset. Tests cover terminal-program forwarding through scoped launches and relative Wayland display resolution with a scoped runtime directory.|
<!-- change_assessment_start -->
<strong>Priority: <picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/priority-low-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Low</strong>
Estimated code review effort: 2 (Simple) | ~10 minutes
<!-- change_assessment_commit:"0ae50f6cb94d3140b7accedd51ab86ff454a9dd6" -->
Change: Bug fix
<!-- change_assessment_end -->
Possibly related issues
Possibly related PRs
Suggested reviewers: adamwhitehurst, openrig-review
</dd>
</dl>
</details>
<!-- walkthrough_end -->
<details>
<summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>0ae50</code></summary>
<dl>
<dd>
<!-- final_review_risk_start -->
<!-- final_review_risk_label
Merge Risk: ⚪ Minimal · up to 0ae50
-->
<!-- final_review_risk_coverage:{"sourceCommitId":"0ae50f6cb94d3140b7accedd51ab86ff454a9dd6","coveredCommitId":"0ae50f6cb94d3140b7accedd51ab86ff454a9dd6","kind":"reviewed"} -->
No issue identified here prevents merging after normal checks.
<!-- final_review_risk_end -->
</dd>
</dl>
</details>
<!-- pre_merge_checks_walkthrough_start -->
<details>
<summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary>
<dl>
<dd>
<strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 warning</strong>
| Check name | Status | Explanation | Resolution |
| :---------------- | :----------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- |
| Docstring Coverage | !Warning | Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
<details>
<summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary>
<dl>
<dd>
| Check name | Status | Explanation |
| :------------------------ | :--------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------- |
| Description Check | !Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | !Passed | The title clearly and concisely describes the main change: retaining the tmux pane terminal identity during scoped launches. |
| Linked Issues check | !Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | !Passed | Check skipped because no linked issues were found for this pull request. |
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->
<details>
<summary><strong>Finishing Touches: 💡 1</strong></summary>
<dl>
<dd>
<!-- finishing_touch_suggestion:docstrings -->
<details open>
<summary><strong>📝 Generate docstrings: 💡</strong></summary>
<dl>
<dd>
</dd>
</dl>
</details>
<details open>
<summary><strong>🧪 Generate unit tests (beta)</strong></summary>
<dl>
<dd>
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<!-- finishing_touch_checkbox_end -->
<!-- autopilot:start -->
<!-- autopilot:end -->
<!-- tips_start -->
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.
<details>
<summary><strong>❤️ Share</strong></summary>
<dl>
<dd>
</dd>
</dl>
</details>
<sub>Comment @coderabbitai help to get the list of available commands.</sub>
<!-- tips_end -->
Admitted at 0ae50f6cb94d3140b7accedd51ab86ff454a9dd6 after the independent Claude and Codex/security source reviews. I rechecked the full diff, current-main composition and all eight required CI jobs. This preserves pane terminal identity through the scoped reset; generated-shell tests do not establish native extended-key negotiation. No new refusal or configuration surface.
— orch-lead@v-openrig-build
openrig-review
mvschwarz
What a user gets
New scoped tmux panes retain tmux's own
TERM_PROGRAMandTERM_PROGRAM_VERSIONthrough the initial environment reset. Managed Claude already forwards those names, but they were erased before that step, preventing Claude from identifying tmux and requesting extended keys for Shift+Enter.The reset now keeps these two fields alongside
TERM, taking values from the newly spawned pane rather than the daemon or its configured baseline. It applies to fresh and successor panes using that reset. No terminal options or session environment are changed.Refs #2041. Thanks to @AdamWhitehurst for the report and environment evidence.
How you verified it
s03-bound-launch,seat-runtime-dir,tmux-argv-execandtmux-argv-legacy-equivalence, plus 11 selected credential argv controls. Three real-tmux credential cases were deliberately excluded.WAYLAND_DISPLAYfrom the configured update list resolves against the selected runtime directory and Claude receives thedisabled:bus address. The classic launch retains the pane environment by source inspection.tsc --noEmitandgit diff --checkpassed.Anything you were unsure about
These checks execute generated shell commands and a private fake Claude, with mocked tmux option reads. No desktop, native Claude, compositor or tmux server was started. They establish environment delivery, not a native image paste or extended-key negotiation. No stub scenario was added because the stub cannot test Claude's terminal negotiation; the composed shell regression exercises the boundary that erased its input.
The integration-test assertions and absent-server fallback described separately in #2041 are outside this two-file change; this PR does not close the whole issue. Full build/lint/test runs are left to CI.
CHANGELOG.mdedit<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Terminal program information is now preserved when launching Claude in tmux, helping launched sessions recognize the active terminal. If either terminal value is unset in the pane, it is passed as empty rather than omitted.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->