Skip to content

fix(daemon): clarify historical seat-clean recovery - #1206

Merged
mvschwarz merged 1 commit into
mvschwarz:mainfrom
XTLine:fix/clarify-historical-clean-recovery
Oct 13, 2026
Merged

mvschwarz merged 1 commit into
mvschwarz:mainfrom
XTLine:fix/clarify-historical-clean-recovery

Conversation

@XTLine

@XTLine XTLine commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What a user gets

When rig seat clean finds a live older session, its recovery advice now names and shell-quotes that session for rig capture --, asks the operator to end it manually only if it is no longer needed, and explains that rig seat stop targets the latest session. Previously that advice could stop a newer occupant and leave the actual blocker alive. Ordinary current managed sessions retain the existing stop advice.

This is the clean-path counterpart of the historical-session guidance discussed in #1156. It does not add a historical-session selector or change cleanup, stopping, launch, or liveness decisions.

How you verified it

Base: cb79b8c980ec120c8db28d5aaf2c4bb3cc540c61; tested tree: f7ef7a0088aa67c9e26e32820897206dd15688f3 (the two-file patch in this PR). Linux x86_64, Node 24.19.0.

  • Red control on unmodified service code: all six new guidance cases failed; 24 pre-existing service tests passed
  • The regression exercises the real SeatLifecycleService, SessionRegistry, and SQLite database with simulated tmux liveness. Before any explicit stop, clean preserves session rows, binding and lineage and issues no kill. Following the old advice either kills newer B or reports B absent; older A still blocks cleanup
  • Five complete relevant suites passed together on the final patch: daemon seat-lifecycle-service, seat-lifecycle-route, seat-fresh-launch; CLI seat-lifecycle-verbs, seat (178 tests; --maxWorkers=1 --no-file-parallelism). The adopted/binding-only controls cover spaces, an apostrophe, and a leading hyphen in the exact capture operand
  • npm run build passed on the final patch
  • npm run lint passed on the final patch
  • npm run test:repo with a writable npm cache: 285 passed, 5 failed, 1 skipped. Four failures were rsync missing; the same four failures reproduced on pristine main. With an official local rsync, the two affected script files passed (31 tests), and first-run references, docs guard, skill mirrors, and context-pack checks passed separately. The fifth failure was an instance-isolation fixture whose nested test process hit its 50-second timeout; the focused rerun passed both instance-isolation tests. The aggregate command was not rerun after these environment corrections

Anything you were unsure about

The service tests simulate tmux and do not prove native terminal or provider behavior. No usable native tmux runtime is available in this executor, so no native/stub-agent scenario was run. Full daemon/CLI/TUI/UI package suites and the CI-only installed-package scenario were not run; the five relevant test files above were run in full.

rig capture -- <quoted-session> was checked through the CLI and daemon code: the supplied name is passed directly to the capture transport, which probes and captures that exact tmux session rather than resolving the seat's latest session.

If this is security-related

Not applicable.

  • 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

Summary by CodeRabbit

  • Bug Fixes
    • Updated live-session cleanup guidance to recommend rig seat stop only when it can target the active session. For other live sessions, the guidance directs operators to inspect and end the selected session manually.
    • Session names in the guidance are now safely quoted, including names with spaces, apostrophes, or leading hyphens.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a5a044c8-b09f-4725-8da0-8b4e2f5c39c0
📥 Commits

Reviewing files that changed from the base of the PR and between cb79b8c and 33b7f93.

📒 Files selected for processing (2)
  • packages/daemon/src/domain/seat-lifecycle-service.ts
  • packages/daemon/test/seat-lifecycle-service.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

📝 Walkthrough

Clean-seat guidance now recommends rig seat stop only for the latest unclaimed live session. For other live sessions, it gives a quoted rig capture command and explains that stop targets the latest session. Tests cover these cases and verify that clean does not mutate state.

Changes: Live-seat clean guidance

Layer / File(s) Summary
Conditional clean guidance and tests
packages/daemon/src/domain/seat-lifecycle-service.ts, packages/daemon/test/seat-lifecycle-service.test.ts
The service gives different recovery instructions based on whether the live session is the latest and unclaimed. Tests cover older and claimed sessions, state preservation, and shell quoting for session names.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: aschenbath

Merge Risk: ⚪ Minimal · up to 33b7f

No actionable merge-blocking risk is established for the revised clean-seat guidance. It is mergeable after normal checks.

Pre-merge checks · Passed 5
Passed Passed checks (5 passed)
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: improved recovery guidance for historical sessions during daemon seat cleaning.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openrig-review openrig-review left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 33b7f93. When rig seat clean refuses because a live session other than the seat's current managed one blocks it, its advice now names and shell-quotes that session for rig capture --, says to end it only if it's no longer needed, and explains that rig seat stop targets the latest session. The old advice could stop a newer occupant and leave the blocker alive. Only the advice text changes: the refusal code and message and every cleanup, stop, launch and liveness decision are main's, and an ordinary current managed session gets main's exact advice. Required CI passed at this head.

— dev60-planner@v-openrig-build

@mvschwarz
mvschwarz merged commit 8d0ce8e into mvschwarz:main Oct 13, 2026
10 checks passed
@mvschwarz

Copy link
Copy Markdown
Owner

Thanks, @XTLine, for the rig seat clean fix. It's merged. Once this ships, when an older live session blocks rig seat clean, the advice names that session and says how to check it, instead of recommending a stop that could end a newer session. An ordinary current session gets the same advice as before.

@mvschwarz mvschwarz moved this from Todo to Done in OpenRig roadmap Oct 19, 2026
@mvschwarz mvschwarz added this to the 0.6.12 milestone Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants