← Back to Pull requests

fix(handover): name the committed occupant in the seat's tmux session #4225

Closed
unknown closed this pull request without merging on Nov 30, 2026 18:53 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 17:10 UTC
Author

The problem

An in-place seat handover starts the successor with the new occupant generation in its pane's own environment, but the seat's tmux session keeps the predecessor's. rig seat handover --recover commits the same way.

That stale entry has readers:

  • A later launch in that session that passes no generation takes the session's. seat-launch-environment.ts builds the launch's identity from it.

  • A new pane, window or bare respawn inherits it.
  • Either one starts, and reports its hook activity, as the previous occupant, which the generation check then reads as a mismatch.

    This closes a path seen at source, not one observed failing in use. Whether a production relaunch after a handover reaches the first reader hasn't been traced to the end.

    What changes

  • At the handover's commit, the seat's tmux session gets the successor's generation and runtime. It uses the same write a runtime switch's commit already makes (setRuntimeSwitchEnvironment, "so a later pane or respawn in it starts as the successor's"). It's one call, not a new writer.

  • What a person gets: a later pane or relaunch in that session starts as the seat's current occupant, not the previous one.

  • Only a launched successor has a generation reserved, so a handover to a discovered session is unchanged.

  • A failed write is a warning on the committed handover, which stands. Nothing new refuses.
  • How it was checked

  • Red first, at main:

  • - the real-tmux handover environment test (seat-env-handover-native.test.ts) finds the session still naming the previous generation after each handover;
    - two new --recover cases (claude-handover-recover.test.ts) see no write.
  • Green:

  • - every daemon test file that builds the handover service: 15 passed and 2 skipped (gated end-to-end files), 694 tests;
    - npm run lint passed.
  • Not this change: startup.test.ts has four "assembled classic clear" cases that fail on that test machine with "isolated account launch unavailable". They fail the same way on unchanged main there, so hosted CI decides them.

  • Not run: a real --recover of a live Claude successor. The recovery cases use the existing recovery fixture.
  • 🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    After a successful seat handover, the successor’s runtime and occupant generation are now recorded in the tmux session, helping later panes and relaunches use the correct occupant.
    * If the session update fails, the handover still completes and includes a warning that a later pane or relaunch may start as the previous occupant.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 355 lines (+266 / -89) across 4 files Reviewer: openrig-review Review duration: 103m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 355 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.351
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4225"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 42.5% (MEDIUM) · Higher = larger blast radius
    42.5%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 16.8% · Safe to merge
    16.8%