Route Vault resume through cmux restore - #9924
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughVault session resume now uses structured restore launches for supported agents. Restore snapshots and startup input propagate through workspace and terminal creation. Unsupported agents use an explicit legacy fallback. Tests cover launch construction, persistence, placement, and copied-command access. ChangesStructured session resume launch
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant SessionIndexView
participant SessionEntryResumeLaunch
participant TabManager
participant Workspace
participant TerminalPanel
SessionIndexView->>SessionEntryResumeLaunch: build resumeLaunch
SessionEntryResumeLaunch-->>SessionIndexView: return startup input and restore snapshot
SessionIndexView->>TabManager: create workspace with launch data
TabManager->>Workspace: pass startup restore agent
Workspace->>TerminalPanel: seed input and restored-agent state
🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmuxTests/SessionEntryResumeLaunchTests.swift`:
- Line 140: Update the test setup around controlSurfaceRestoreRecord so it
supplies the Vault startup snapshot environment through the binding instead of
passing nil, allowing the CLAUDE_CONFIG_DIR assertion to validate propagated
state; if the restore contract intentionally excludes this environment, remove
the expectation instead.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: dafd4033-eab4-4ca6-b090-a287ffb2f348
📒 Files selected for processing (2)
cmux.xcodeproj/project.pbxprojcmuxTests/SessionEntryResumeLaunchTests.swift
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cmuxTests/SessionEntryResumeLaunchTests.swift (1)
80-91: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the registered-agent working directory.
This test sets
cwdto/tmp/custom-projectand uses.preserve, but it does not verifylaunch.workingDirectory. Add the assertion so a regression in registered-agent working-directory propagation cannot pass this test. The PR objective requires this behavior.Proposed assertion
let launch = try `#require`(entry.resumeLaunch) `#expect`(launch.strategy == .restoreVerb) + `#expect`(launch.workingDirectory == "/tmp/custom-project") `#expect`(🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmuxTests/SessionEntryResumeLaunchTests.swift` around lines 80 - 91, Extend the test around the existing launch assertions to verify that launch.workingDirectory preserves the registered agent’s configured /tmp/custom-project path when cwd is set with .preserve. Keep the existing restore strategy, input, and resume-argument assertions unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/SessionIndexModels.swift`:
- Around line 300-315: Replace all test references to SessionEntry.resumeCommand
with copyResumeCommand, while leaving unrelated resumeCommand APIs unchanged.
After no tests depend on the compatibility property, remove the resumeCommand
alias from SessionEntry and retain copyResumeCommand as the rendered
shell-command property.
---
Outside diff comments:
In `@cmuxTests/SessionEntryResumeLaunchTests.swift`:
- Around line 80-91: Extend the test around the existing launch assertions to
verify that launch.workingDirectory preserves the registered agent’s configured
/tmp/custom-project path when cwd is set with .preserve. Keep the existing
restore strategy, input, and resume-argument assertions unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1365be8d-8099-4ad7-a512-d16a3caef6fe
📒 Files selected for processing (10)
Sources/ControlSurfaceResumeTarget.swiftSources/HermesAgentIndex.swiftSources/Panels/TerminalPanel.swiftSources/SessionEntryResumeLaunch.swiftSources/SessionIndexModels.swiftSources/SessionIndexView.swiftSources/TabManager.swiftSources/Workspace.swiftcmux.xcodeproj/project.pbxprojcmuxTests/SessionEntryResumeLaunchTests.swift
|
Review follow-up for 78b2492:
All four inline AI threads have concrete replies and are resolved. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 85f460a. Configure here.

Summary
Vault resumes now use the same shell-free structured restore lifecycle as relaunch restoration from #9265.
SessionEntryResumeLaunch.cmux restore <kind> <session-id>selector.SessionRestorableAgentSnapshotused by session relaunch..legacyCommandcompatibility strategy.Single lifecycle owner
RestoredAgentLifecycleCoordinatornow owns the snapshot, resume phase, and resume working-directory rescue target for both Vault-originated and relaunch-originated restoration. Workspace restore, Dock restore, Vault-created workspaces/tabs/splits, clear, reset, and surface transfer all seed or remove those fields through the same lifecycle operation.Vault state is seeded immediately after a workspace terminal, focused-pane tab, or split/drop terminal is successfully inserted. Session persistence therefore captures the restored chat before hooks or process scanning run. On close and reopen, the persisted snapshot produces the same short restore selector when automatic agent resume is enabled.
The same seed retains the local session directory while the restored agent owns the terminal, so a transient home/default cwd report cannot poison later split or new-tab inheritance (the #7155 rescue behavior). Registered agents whose cwd policy is
.ignoredeliberately seed no rescue directory.The previous immutable
TerminalPanel.startupRestoreAgentside channel and responder fallback were removed. Clearing lifecycle state removes responder availability, durable agent state, and cwd rescue together, so an old Vault session cannot resurface after the panel advances to another session.Package boundary
The Vault adapter remains in the app target because it converts app-owned
SessionEntry,AgentSpecifics, registration, and persistence snapshot types for one app consumer. Extracting that adapter alone into aCmuxVaultResumemicro-package would duplicate those DTOs and violate cmux's whole-domain/multi-consumer package rule. Reusable shell-free argv and restore planning remains centralized inCMUXAgentLaunch.Behavior coverage
The app-host behavior suite covers:
The regression tests are wired into the Xcode test target. Repository project, test-wiring, package-group, lockfile, diff, and budget guards pass. Per task constraints, no local
xcodebuildtests or XCUITests were run; behavior tests run in CI.Issue: #9923
Closes #9923