← Back to Pull requests

fix(tmux): retain pane terminal identity through scoped launch #2043

Merged
mvschwarz merged 2 files (38 lines) on Oct 25, 2026 22:36 UTC
View on GitHub
mvschwarz mvschwarz commented on Oct 25, 2026 17:39 UTC
Author

What a user gets

New scoped tmux panes retain tmux's own TERM_PROGRAM and TERM_PROGRAM_VERSION through 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

  • RED on main's reset: the composed scoped-reset/managed-launch tests lost the pane's terminal identity to synthetic daemon values; the present and empty cases failed.

  • GREEN: 121 checks across s03-bound-launch, seat-runtime-dir, tmux-argv-exec and tmux-argv-legacy-equivalence, plus 11 selected credential argv controls. Three real-tmux credential cases were deliberately excluded.

  • Present, empty and absent terminal values are covered, including a conflicting daemon baseline. Existing direct managed-launch controls remain covered.

  • A composed relative-Wayland control already passes on main after #2036: WAYLAND_DISPLAY from the configured update list resolves against the selected runtime directory and Claude receives the disabled: bus address. The classic launch retains the pane environment by source inspection.

  • Daemon tsc --noEmit and git diff --check passed.
  • 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.

  • One concern per PR; no version bump; no CHANGELOG.md edit

  • Tests added or updated where the change is testable

  • I listed the checks I ran, their results, and any checks I could not run
  • <!-- 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 -->

    Diff: 38 lines (+31 / -7) across 2 files Reviewer: openrig-review Review duration: 296m
    All Vouch review confidence checks passed
    Residual risk 0.02 = Change Risk (0.31) × (1 − Review Confidence (0.93)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.31 · 38 lines diff across 2 files
    0.31
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.98 · 1 substantive comment(s)
    0.98
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    92%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.219
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    3 items
    coderabbitai[bot] coderabbitai[bot] commented on Oct 25, 2026 17:39 UTC
    Bot

    <!-- 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&amp;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>

  • Source mode: Auto

  • Repository: Unavailable

  • Branch: Unavailable

  • File: No configuration file from this repository applied

  • Commit: Unavailable

  • Layers: defaults

  • Review profile: CHILL

  • Plan: Advanced

  • Run ID: 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

  • mvschwarz/openrig#2041 — Reports that the scoped reset removes terminal identity variables from managed Claude panes.
  • Possibly related PRs

  • mvschwarz/openrig#1907 — Introduced the scoped tmux launch reset extended by this change.

  • mvschwarz/openrig#1812 — Preserves selected environment values across scoped launches.

  • mvschwarz/openrig#1546 — Forwards pane terminal and display variables to managed Claude.
  • 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>

  • <!-- {"checkboxId":"3e1879ae-f29b-4d0d-8e06-d12b7ba33d98"} --> Commit to this branch

  • <!-- {"checkboxId":"7962f53c-55bc-4827-bfbf-6a18da830691"} --> Create a new PR
  • </dd>
    </dl>
    </details>
    <details open>
    <summary><strong>🧪 Generate unit tests (beta)</strong></summary>
    <dl>
    <dd>

  • <!-- {"checkboxId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Commit to this branch

  • <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create a new PR
  • </dd>
    </dl>
    </details>

    </dd>
    </dl>
    </details>

    <!-- finishing_touch_checkbox_end -->

    <!-- autopilot:start -->

  • <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

  • <!-- 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>

  • X

  • Mastodon

  • Reddit

  • LinkedIn
  • </dd>
    </dl>
    </details>

    <sub>Comment @coderabbitai help to get the list of available commands.</sub>

    <!-- tips_end -->

    openrig-review openrig-review approved these changes on Oct 25, 2026 22:36 UTC
    Approved Reviewer

    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

    Assignees
    mvschwarz mvschwarz
    Labels
    risk: low confidence: 92.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 31.4% (LOW) · Higher = larger blast radius
    31.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 92.7% · Lower = rushed or shallow review
    92.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 2.3% · Safe to merge
    2.3%