You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(ssh): let a second desktop move onto a host another desktop already set up - #35879
When two computers use the same SSH host, each remembers which project it had selected. The host's Orca server treated a different selection from the second computer as a conflict, so it refused to set the second computer up at all. A selection isn't saved work, so the host now keeps its own selection and takes the second computer's projects.
What Changed
Before: a desktop moving its SSH state onto the host's Orca server (orcad) sends its focus along with its projects: the selected project, worktree, workspace, host, and tab. The server refused with orcad_migration_dormant_focus_conflict:<field> whenever it already had a different focus. Another desktop's focus always differs, so the second desktop failed on every retry, and only a plain SSH terminal worked.
After: the server no longer treats focus as conflicting saved state. A host that already has focus keeps all five focus fields together, clearing any it never set, so none is borrowed from the incoming desktop. A host with no focus still takes the desktop's focus, as before. Real conflicts are refused exactly as before: ids, sessions, worktree metadata, automations.
Why
Focus is per-desktop UI state. Each desktop writes its own focus into the host's session and reads its own local copy back first. So the host's stored focus is just whichever desktop wrote last, and the server only uses it as a hint. Refusing a migration over it blocked every second desktop and protected nothing. mergeWorkspaceSessions already preferred the host's focus for the fields it merged. This change makes that hold for all of the focus fields together.
The WSL project mover already strips desktop focus for the same reason. Its comment no longer cites this refusal.
Thanks to the reporter for the clear two-desktop setup and the exact error code.
Visual Proof
N/A. This is server-side migration validation. The visible change is that the second desktop connects instead of showing the conflict error.
Testing
Automated tests added/updated
New test with two desktops and one host, through the real stage and commit path. Desktop A migrates first. The host names only a project, with its optional focus fields unset. Desktop B then migrates a different project with its own focus. On main this fails with exactly orcad_migration_dormant_focus_conflict:activeRepoId. With the fix, it commits, imports B's project, and leaves the host's focus whole. The test also fails if only the fields the host set are kept.
Ran src/main/persistence/migrating-orcad-catalog, src/main/persistence/moving-wsl-projects, and the runtime migration-catalog tests. They all pass, apart from three WSL timing tests that time out the same way on main on this heavily loaded machine.
pnpm check:changed --maxWorkers=2 passes.
Not run locally: the Docker managed-orcad e2e lane. Its Linux orcad template build doesn't run on this Mac; CI covers that lane.
Review
Codex review: clean on the final head. The first pass found that optional focus fields the host never set were still borrowed from the desktop; that's fixed and covered by the test.
Independent review: no P0 or P1.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Mixed versions: the refusal happens on the server, so a new desktop on an older server is still refused until that server updates. A new server accepts manifests from old and new desktops unchanged. I didn't add a desktop-side workaround that strips focus and retries: the manifest is digest-checked and recomputed during cutover, and the root fix belongs on the server.
Remote and folder workspaces: the focus fields cover worktree and folder workspace keys alike.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
…dy set up
Moving a desktop's SSH state onto the host's Orca server refused with
orcad_migration_dormant_focus_conflict whenever the host already had a
focused project from another desktop. Focus is each desktop's own
selection, not saved state, so two desktops always differ and the second
could never move, on every retry.
The host now keeps its own focus as a unit and takes a desktop's focus
only when it has none, which is what the merge already did for the
fields it borrowed. Older servers still refuse until they update.
Fixes#35585
Session preparation no longer rejects differing focus fields between the host and incoming sessions. If the host has any focus fields set, preparation preserves those values and sets its unset focus fields to null. A migration test checks that a second desktop’s repository is added while the host’s existing project focus remains and optional workspace and execution-host focus remain unset.
Priority: Normal
Severity of issue fixed: Medium
Merge Risk: Minimal · up to 156f0
The focus migration is mergeable; an additional test would strengthen coverage of fully populated host focus.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: allowing a second desktop to migrate onto a host that another desktop already configured.
Description check
The description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, testing, compatibility considerations, and checklist status. It a…
Linked Issues check
Issue [#35585] requires a second desktop to use an SSH host after another desktop migrated it. prepareOrcadMigrationWorkspaceSession no longer rejects focus differences. When the host has any focus,…
Out of Scope Changes check
The changes stay within issue [#35585]. Production changes update SSH-state migration focus handling. The migration-catalog test covers the reported two-desktop case. The WSL test and comment remove a…
Full details: Description check
Explanation
The description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, testing, compatibility considerations, and checklist status. It also documents the unrun Docker e2e lane and known timing-test timeouts.
Full details: Linked Issues check
Explanation
Issue [#35585] requires a second desktop to use an SSH host after another desktop migrated it. prepareOrcadMigrationWorkspaceSession no longer rejects focus differences. When the host has any focus, sessionFocus preserves all SESSION_FOCUS_FIELDS and converts unset host fields to null. Other dormant-state conflict checks remain. The new migration-catalog test exercises stage and commit, imports the second repository, and verifies that the host focus remains intact. This implements the issue's coding requirement.
Full details: Out of Scope Changes check
Explanation
The changes stay within issue [#35585]. Production changes update SSH-state migration focus handling. The migration-catalog test covers the reported two-desktop case. The WSL test and comment remove an obsolete focus-conflict expectation and document the updated behavior. No unrelated product behavior is changed.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
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.
Add a case where the host has non-null focus in every focus field.
The new commit-path test only sets activeRepoId to a non-null value. It sets the host's activeWorktreeId and activeTabId to null, and it leaves the host's workspace key and execution-host focus unset. The overlay in prepareOrcadMigrationWorkspaceSession copies all five focus fields. The PR states that a host with focus keeps all five together. The current test does not exercise that overlay for non-null worktree, tab, workspace key, or execution-host values. A regression that drops a non-null host tab, for example, would still pass. This is a coverage gap, not a current production failure.
Keep the existing test unchanged and add this case beside it:
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
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
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
When two computers use the same SSH host, each remembers which project it had selected. The host's Orca server treated a different selection from the second computer as a conflict, so it refused to set the second computer up at all. A selection isn't saved work, so the host now keeps its own selection and takes the second computer's projects.
What Changed
orcad_migration_dormant_focus_conflict:<field>whenever it already had a different focus. Another desktop's focus always differs, so the second desktop failed on every retry, and only a plain SSH terminal worked.Why
Focus is per-desktop UI state. Each desktop writes its own focus into the host's session and reads its own local copy back first. So the host's stored focus is just whichever desktop wrote last, and the server only uses it as a hint. Refusing a migration over it blocked every second desktop and protected nothing.
mergeWorkspaceSessionsalready preferred the host's focus for the fields it merged. This change makes that hold for all of the focus fields together.The WSL project mover already strips desktop focus for the same reason. Its comment no longer cites this refusal.
Linked Issue
Fixes #35585
Thanks to the reporter for the clear two-desktop setup and the exact error code.
Visual Proof
N/A. This is server-side migration validation. The visible change is that the second desktop connects instead of showing the conflict error.
Testing
orcad_migration_dormant_focus_conflict:activeRepoId. With the fix, it commits, imports B's project, and leaves the host's focus whole. The test also fails if only the fields the host set are kept.src/main/persistence/migrating-orcad-catalog,src/main/persistence/moving-wsl-projects, and the runtime migration-catalog tests. They all pass, apart from three WSL timing tests that time out the same way on main on this heavily loaded machine.pnpm check:changed --maxWorkers=2passes.Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)