Repository navigation
fix(persistence): a paired server's workspaces keep their saved tabs across desktop restarts - #33926
Merged
Merged
Conversation
…across desktop restarts Main's per-repo terminal topology revision fences window saves so a stale save cannot undo main's own membership change. The window never sends revisions, so on a runtime partition, which mirrors a paired server, one removal or main-side close froze every workspace of that repo: from then on each window save had its terminal rows rebased onto the prior rows, and every restart reopened those workspaces on the server's per-device tab pick. On runtime partitions the fence now lasts only through the race it guards: a repo main changed is fenced for RUNTIME_PARTITION_TOPOLOGY_FENCE_MS, then the window's saves win again. Local and SSH partitions keep the permanent fence.
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 seconds. View limit details
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 |
…losed after a restart (#21236)
…cy tombstones on runtime partitions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On a desktop paired to a managed SSH server, Orca stopped saving which tabs your server workspaces had. A safety lock that blocks stale saves, meant to last a moment, never unlocked once the desktop removed a workspace or closed a tab on its own. So after every restart Orca forgot your tabs and reopened those workspaces wherever the server last pointed, often on the second tab. The lock now releases after a few seconds.
What Changed
Before:
[], groups[], active tabnull.After:
Mechanism:
setHostWorkspaceSessionrunssanitizeWorkspaceSessionTerminalRetirements→rebaseWorkspaceSessionTerminalMembership.terminalTopologyRevisionByRepoId[repo] > 0, any write that doesn't raise that revision has its terminal rows replaced by the prior rows. That is main's fence against a stale window save undoing main's own change.runtime-partition-topology-fence.ts. On runtime partitions, a repo main changed (a write that raises its revision, or a removal) stays fenced forRUNTIME_PARTITION_TOPOLOGY_FENCE_MS(10s), measured on a monotonic clock. After that, window saves are the membership again. Revisions are still carried forward.Why
The fence exists for the race between main's change and a window save already in flight. The window's saves debounce at 150ms, and a save held by a closed persistence gate can land a few seconds later. After that, every window save has seen main's change.
Alternatives considered:
Known limit: after the window, a very stale window save, one captured more than 10s before it is delivered, could bring back a row main removed. A listed workspace's rows are replaced by the server's first frame after a restart.
Follow-up (the real fix): the window echoes the topology revision it has seen, and main pushes revision bumps to it, so the fence can tell a stale save from a fresh one exactly with no time bound.
Linked Issue
Fixes #21236
The same freeze kept a mirrored tab the server had closed on disk for days: every window save that dropped it was rebased back onto the prior rows. Thanks to @yulin0629 for the detailed persisted-state evidence in #21236.
It also fixes the second half of a wrong-tab-on-switch-back report from a managed SSH orcad host; #33761 fixed the first half (keyboard tab switches never reached the server).
Visual Proof
N/A. This is a persistence fix with no UI change.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New tests in
worktree-removal-session-partition-fencing.test.ts:Existing tests that a stale window save inside the window cannot bring back a removed worktree's rows pass unchanged.
The equal-repo-id per-host fence test runs on SSH partitions, where the permanent fence still applies.
Evidence from the user's machine, read-only: their
runtime:<omarchy>partition had a revision on the repo, and 56 of its ~70 server workspaces saved as empty rows. That included workspaces they were actively using.pnpm typecheck, lint and the PR static checks pass.AI Disclosure
Review
Codex review is clean on the final head (base pinned at 7b5f50d). An independent review found no P0–P2 issues.
Agent skill upstream boundary
Notes