fix(restore): leave a seat joined with rig attach as an external CLI attached #1834
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
mvschwarz
What a user gets
Someone who joined a seat with
rig attachas an external CLI (Claude Desktop, say), ranrig 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 atawaiting-decisionor 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
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_attacheddoesn't count against the rig: a restore whose other seats resumed still readsfully_restored, andrig up --existingexits 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 --existingandrig startprint the reason beside the status, asrig updoes forawaiting-decisionandfailed. An attached seat doesn't turnrig start's ready label into[mixed].rig up --existing --plan,rig statusand the recovery view forecastleave-attachedfor the seat, with the same reason text, no--freshrequirement and no runtime prompt. Before, it forecast a decision, a resume or a fresh start, none of which restore now does.left_attachedwith 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. TheleftRunningcomment now says the claim is kept only without--delete.A new public
codevalue: a single-seatrig launch <rig> <seat>on an attached seat answers HTTP 409 withcode: "left_attached"and its reason, instead of launching a replacement. The way out isrig 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:
restore-orchestrator.test.ts) of a rig with a tmux seat and an attached external seat: the external seat's result isleft_attachedwith the unclaim hint, its claim staysrunning, itsexternal_clibinding is unchanged, tmux is never asked about it, and no session is created for it. The tmux seat beside it still launches (fresh-primed). Aresumedseat plus aleft_attachedseat rolls up asfully_restored.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 returnsleft_attached.restore-plan-preview.test.ts), with and without--fresh: an attached seat forecastsleave-attachedwith the unclaim hint, no fresh requirement and no runtime prompt.running, the seat isleft_attached, and the rig readsfully_restored.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:
- The targeted launch: a tmux occupant was launched for the external seat (Codex's
launchHarnesscalled withattachmentType: "tmux").- The full restore: the claim reads
detached.5a758d89plus 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.5d9bd016): daemon 565 of 565 acrossrestore-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-preconditionsandself-attach-service. CLI 202 of 203 acrossdown,launch,up,up-restore-decisionandstart; the one not run is an existingit.skipinup.test.ts.tsc) passed in the same run. CI runs the full suite.38ed75cd): CI, all 10 checks green (12:38:19Z). Not run on the executor.rig downandrig up --existingwith a real attached Claude Desktop.Anything you were unsure about
attention_requiredandawaiting-decisioncount against the rig, so every down and up of a rig with an attached app would exit 1, andawaiting-decision's interactive offer starts a fresh session, which would replace the app.left_attachedreads asn-ain the node inventory's continuity outcome, like other unknown outcomes.- The
Attach:hint afterrig uppicks 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 readsfailedinstead ofleft_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.CHANGELOG.mdedit🤖 Generated with Claude Code