← Back to Pull requests

fix(restore): leave a seat joined with rig attach as an external CLI attached #1834

Closed
unknown closed this pull request without merging on Oct 23, 2026 12:40 UTC
View on GitHub
unknown unknown commented on Oct 23, 2026 10:55 UTC
Author

What a user gets

Someone who joined a seat with rig attach as an external CLI (Claude Desktop, say), ran rig down, and then followed down's own next step, rig up <rig> --existing, now gets that seat back as it was. Before, the restore read the app's claim as a dead tmux session, marked it detached, and then either stopped the seat at awaiting-decision or cleared its binding and launched a tmux occupant in the app's place. A launch that names the seat (rig launch <rig> <seat> or --seats) did the same.

The change

  • Restore skips the external claim when it classifies the rig's running sessions, so it's neither stale nor live and isn't marked detached. A targeted launch doesn't probe tmux for it either, so a tmux session that happens to share its name can't make it read as already running.

  • Its startup files don't hold it: restore doesn't launch the seat, so a missing required startup file no longer reports it failed, or stops a restore in which it's the only seat.

  • Each restore path returns a new per-seat result, left_attached, before any change (restoreNodeWithCompensation, shared by the full restore and a targeted launch). Nothing is launched, and the binding and claim stay as they were. The reason names the session, says OpenRig can't see whether the app still runs, and gives the way to run the seat under OpenRig instead: rig unclaim <session>, then launch it.

  • left_attached doesn't count against the rig: a restore whose other seats resumed still reads fully_restored, and rig up --existing exits 0. A launch that targets the seat isn't reported as launched (it joins the not-running launch statuses in the daemon and the CLI), so it prints the reason and exits 1.

  • rig up --existing and rig start print the reason beside the status, as rig up does for awaiting-decision and failed. An attached seat doesn't turn rig start's ready label into [mixed].

  • The restore forecast says the same thing: rig up --existing --plan, rig status and the recovery view forecast leave-attached for the seat, with the same reason text, no --fresh requirement and no runtime prompt. Before, it forecast a decision, a resume or a fresh start, none of which restore now does.

  • The as-built restore docs and the state taxonomy list left_attached with the other restore outcomes.

  • rig down's line now says what OpenRig did: "Not stopped: X. Joined with rig attach as an external CLI, which OpenRig doesn't stop or check." It used to say "Left running", a state OpenRig can't see. The leftRunning comment now says the claim is kept only without --delete.
  • A new public code value: a single-seat rig launch <rig> <seat> on an attached seat answers HTTP 409 with code: "left_attached" and its reason, instead of launching a replacement. The way out is rig unclaim <session>, then launch. A subset launch reports it per seat. No other new refusal, and no external liveness probe: an unknown claim stays unknown.

    Cost: source +52/−21 across 11 files, tests +95/−0 across 3 files, docs +12/−5 across 3 files (numstat).

    How you verified it

    New tests:

  • A full restore (restore-orchestrator.test.ts) of a rig with a tmux seat and an attached external seat: the external seat's result is left_attached with the unclaim hint, its claim stays running, its external_cli binding is unchanged, tmux is never asked about it, and no session is created for it. The tmux seat beside it still launches (fresh-primed). A resumed seat plus a left_attached seat rolls up as fully_restored.

  • A targeted launch (launch-node-subset.test.ts) of both seats, with a Codex adapter for the external seat so main's launch in its place actually runs: nothing is launched for the external seat, its claim and binding are unchanged, the tmux seat launches once, and the external seat returns left_attached.
  • The forecast (restore-plan-preview.test.ts), with and without --fresh: an attached seat forecasts leave-attached with the unclaim hint, no fresh requirement and no runtime prompt.

  • A fresh restore of a rig whose only seat is the external one, with a required startup file missing: the restore runs, the claim stays running, the seat is left_attached, and the rig reads fully_restored.

  • The targeted launch also checks that tmux is never asked about the claim's name.
  • Each test checks the seat's state before the new result word, so red fails on the bug, not on the word.

    Results, in a network-off Linux container at the exact commits:

  • Without the change (main plus the two test files): the two new tests fail on the bug, daemon 310 of 312.

  • - The targeted launch: a tmux occupant was launched for the external seat (Codex's launchHarness called with attachmentType: "tmux").
    - The full restore: the claim reads detached.
  • The two review edges, without their fix (the previous head 5a758d89 plus the new checks): daemon 311 of 313. The targeted launch asked tmux about the claim's name, and the restore of a rig whose only seat is external was refused.

  • With the change (5d9bd016): daemon 565 of 565 across restore-orchestrator, launch-node-subset, rig-teardown, down-route, restore-guidance-after-down, restore-attempt-receipt, restore-honesty-d1-continuity-order, restore-honesty-d1-consumers, stopped-seat-restore-contract, kernel-lost-restore, crash-cart-conductor, start-last-down-vs-detached, restore-preconditions and self-attach-service. CLI 202 of 203 across down, launch, up, up-restore-decision and start; the one not run is an existing it.skip in up.test.ts.

  • The full build (every package's tsc) passed in the same run. CI runs the full suite.

  • The forecast change (38ed75cd): CI, all 10 checks green (12:38:19Z). Not run on the executor.

  • Not run: a live rig down and rig up --existing with a real attached Claude Desktop.
  • Anything you were unsure about

  • A new result word. The existing ones each mislead here: attention_required and awaiting-decision count against the rig, so every down and up of a rig with an attached app would exit 1, and awaiting-decision's interactive offer starts a fresh session, which would replace the app. left_attached reads as n-a in the node inventory's continuity outcome, like other unknown outcomes.

  • Not changed:

  • - The Attach: hint after rig up picks the first running seat, which could be the external one.
    - A seat removed and recreated after the snapshot, then attached: restore keys seats on the snapshot's node IDs, so these guards miss its binding. Nothing replaces the app, because the launcher refuses the bound live node (already_bound), but the seat reads failed instead of left_attached, and a missing startup file on it can still stop a restore in which it's the only seat. Resolving live node IDs for restore as a whole would be its own change.

  • 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
  • 🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: mvschwarz Review duration: 104m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 650 lines diff across 8 files
    0.57
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #1834"
    general weight: 0.35
    Reviewers
    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: 57% (MEDIUM) · Higher = larger blast radius
    57%
    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: 22.5% · Safe to merge
    22.5%