Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe rebasing logic now treats missing Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Missing terminal-tab maps no longer prevent host-session staging from completing. The focused test covers the reported case, and no concrete merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
Records the retained adapted contribution from #25925 in replacement PR #26848. Co-authored-by: Sangin <[email protected]>
|
Thank you @silee9019 for tracking this down and for the clear write-up and repro. The same quit-time crash (#25924) was fixed by #26848, which landed first: it fills in the missing tab maps at the start of the shared host-session save ( |
ELI5
When you quit Orca, it saves a snapshot of every host's tabs first. If one of your paired remote runtimes has no terminal tabs open, saving that runtime's snapshot crashed. The crash cancelled the quit, so Cmd+Q, closing the window, and "Restart to update" all failed on the first try. This PR makes the save treat "no tabs listed" as "no tabs", so quitting works on the first try again.
What Changed
Before (user-visible): On the first Cmd+Q, window close, or update restart, Orca shows
Renderer shutdown checkpoint was not completed: Failed to stage renderer state before unload.and stays open. A second attempt quits only because it skips saving the session.After: The first attempt saves the session and quits.
Mechanism: The renderer splits the session by owning host before the quit stage (
splitWorkspaceSessionByHost). A remote host's slice getstabsByWorktreeonly when some worktree routes to that host, so a paired runtime with no terminal tabs sends a slice without that key. In the main process,setHostWorkspaceSession→sanitizeWorkspaceSessionTerminalRetirements→rebaseWorkspaceSessionTerminalMembershipruns whenever the prior partition hasterminalTopologyRevisionByRepoId(an empty{}counts). It then calledObject.keys(incoming.tabsByWorktree)and threwTypeError: Cannot convert undefined or null to object.rebaseWorkspaceSessionTerminalMembershipnow readsincoming.tabsByWorktree ?? {}andprior.tabsByWorktree ?? {}at every access, and the prior partition's tabs are kept.Why
The main process already accepts partial renderer payloads on this path. The debounced patch path sends partial slices too, and
setHostWorkspaceSessionexists to rebase them onto the stored partition.rebaseWorkspaceSessionTerminalMembershipis the one function every host-partition writer goes through, so a guard there also covers future senders that omit the key. I considered making the renderer always add an emptytabsByWorktreeto every remote slice. That would fix only this one sender and leave the main-process invariant unenforced.Linked Issue
Fixes #25924
Visual Proof
N/A for screenshots: nothing on screen changes, only whether the app quits. Below is the main-process log for the same quit on the same profile. The profile is a copy of a real one with two paired runtimes, one of them with no terminal tabs. Remote endpoints were pointed at an unreachable address so that no live runtime was touched. Each build was quit once, by sending a quit request and clicking "Close" in the "remote host unreachable" confirmation.
Before (
mainat7faa9f7cd3,pnpm dev):After (this branch,
pnpm dev; also a packaged arm64 build ofv1.4.221with only this commit cherry-picked):Testing
New test
src/main/persistence/loading-store/store-host-partition-partial-stage.test.tsdrives the realStore. It seeds aruntime:host partition that has a tab andterminalTopologyRevisionByRepoId, then stages a slice withouttabsByWorktreethroughstageWorkspaceSessionBeforeUnload. It asserts that the call does not throw and that the prior tab is kept.origin/maincad8ea4fa7source)pnpm test src/main/persistence/loading-store/store-host-partition-partial-stage.test.tsTypeError: Cannot convert undefined or null to objectpnpm test <new test> workspace-session-membership-scaling.test.ts mobile-session-terminal-persistence-retirement.test.ts store-runtime-authored-session-writes.test.ts renderer-shutdown-checkpoint.test.tspnpm tc:nodepnpm run check:code-quality:changed,oxlint,oxfmt --checkon the changed filesPlatforms: macOS (arm64) only. The change is platform-independent main-process code. I did not run full
pnpm lint,pnpm build, or the fullpnpm testlocally, and I am relying on CI for those.AI Disclosure
The investigation and the fix were done with Claude Opus 5.5 (
claude-opus-5-5). The test and fix were drafted by Claude Sonnet 5.5. I reviewed the change and ran the verification above.Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
The persisted format and the IPC payloads are unchanged. The guard only changes behavior when
tabsByWorktreeis missing, which is exactly the case that used to throw.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)