Skip to content

Keep remote worktree creation from navigating paired clients - #25793

Merged
nwparker merged 6 commits into
mainfrom
nwparker/jump-bug
Oct 6, 2026
Merged

nwparker merged 6 commits into
mainfrom
nwparker/jump-bug

Conversation

@nwparker

@nwparker nwparker commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Creating a workspace on a remote Orca host could pull every connected desktop away from its current work and scroll its sidebar to the new workspace. Remote work now appears in the list while each viewer keeps its own selection.

What Changed

Host and CLI worktree creation/activation now target the host desktop by default. Paired desktop creation stays with its caller. Catalog updates still reach all viewers; navigation reaches them only for an explicit clients or all request.

Older CLIs automatically sent navigation: 'all' for --activate / --run-hooks. The host recognizes the existing CLI provenance marker and normalizes that automatic broadcast. Activation events now carry an optional navigation target, and updated clients ignore unaddressed broadcasts from older hosts. Explicit remote activation resolves the workspace on the publishing host, including when local and remote repository IDs collide.

Accepted navigation is canceled if bridge cleanup, reconnection, or re-pairing happens while repository/worktree discovery is pending.

Hosts with no ready renderer provision shells, setup, and default tabs through the existing host terminal provisioning path in the background. This covers headless hosts and attached renderers that crash or reload, with availability checked after creation finishes. Git worktrees, folder workspaces, and SSH creation paths are covered.

Why

The defect was an authority mistake: CLI/host activation was treated as a command to every subscriber. Earlier isolation checks covered paired UI callers but deliberately retained host/CLI broadcasts. The renderer then used normal activation and sidebar reveal, producing both symptoms. Fixing the producer defaults and validating intent at the receiving client addresses mixed versions and other creation entry points; suppressing sidebar scrolling alone would still switch the workspace.

Linked Issue

Direct maintainer report; no pre-existing issue linked.

Visual Proof

Reported defect: a remotely created workspace became selected in the reporting client's sidebar.

Reported remote workspace jump

The following two captures are the same automated scenario with the fix, before and after a remote create. They are not screenshots of two different builds. A hidden host and a separately paired Electron desktop use real IPC, WebSocket RPC, Git, and rendered UI. The client starts in “My local work”; an older CLI-shaped remote create requests activation. The remote row appears, while the local workspace and sidebar position stay selected. A subsequent deliberate click opens the remote workspace.

Before the remote operation:

Local workspace before remote creation

After the remote operation:

Remote catalog updated while local workspace stays selected

Testing

  • Exercised and visually inspected the rendered Electron flow locally on macOS, with hidden windows and ORCA_BACKGROUND_LAUNCH=1.
  • Automated tests added/updated.

The renderer regression failed before its intent guard was added: an unaddressed legacy activation called the navigation handler. It passes with the guard. Initial focused suites passed 1,417 tests, one skipped, across 11 files. After the review fixes, four renderer suites passed 18 tests and an expanded runtime/CLI/RPC/Explorer selection passed 1,439 tests, one skipped, across 10 files. Coverage includes real two-client WebSocket isolation, reconnects, explicit broadcasts, legacy CLI arguments, host/headless execution, folders, mocked SSH provisioning, renderer crashes/reloads, and cancellation during both asynchronous discovery stages.

pnpm tc, pnpm run check:code-quality:changed, and git diff --check passed. The E2E-mode app build and paired-worktree-activation-isolation.spec.ts passed (one test). Linux, Windows, and live SSH were not exercised locally.

To repeat the UI check:

ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test tests/e2e/paired-worktree-activation-isolation.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1

Review

Three adversarial self-review passes and two automated review follow-ups completed:

  1. Traced host/CLI/paired navigation authority, legacy requests, explicit broadcasts, and local/folder/SSH headless provisioning.

  2. Found that an accepted activation could survive bridge disposal or connection replacement while awaiting discovery. Added regressions for disposal during repository discovery and connection replacement during worktree discovery; both failed before the fix. Extended existing generation/revision checks through both awaits and added a same-ID re-pairing regression.

  3. Reviewed the follow-up diff, cleanup and re-pairing behavior, host identity collisions, mixed versions, and test oracles; repeated the relevant tests and rebuilt the hidden Electron scenario. No remaining actionable findings.

  4. CodeRabbit identified a retained-notifier gap during renderer crashes/reloads. Four Git/folder regressions failed before the availability fix and now pass. All creation paths share the renderer-readiness decision and evaluate it after their creation awaits; SSH coverage includes losing the renderer during the remote request. Corrected a stale CLI comment and the CI RPC assertion that still expected default broadcast navigation.

  5. The automated follow-up found that explicit all requests also need host background provisioning. Four Git/folder regressions reproduced the omission; reusing the existing host-target predicate makes them pass. After integrating current main, the final focused selection passed 1,399 tests, one skipped, across 11 files; typechecking and changed-code gates passed again. The rebuilt hidden paired-desktop E2E passed again (one test). Main independently corrected the unrelated Explorer assertion, so that file is absent from this PR. The automated final-commit follow-up reported no actionable comments.

No independent human reviewer approval is claimed. Final-commit CI completed successfully: 22 checks passed, 21 intentionally skipped. PR Checks passed on attempt 2 after retrying a setup-node event-file parse failure and a runner shutdown; neither required a code change. Both actionable review threads are resolved, and the final automated review reported no actionable comments.

Agent skill upstream boundary

  • Not applicable; no upstream agent skill code or fixtures copied.

Notes

The wire field is optional JSON, with no new stream opcode. Older clients understand explicitly published activation; updated hosts stop publishing implicit navigation to them. Against an older host, an updated client also ignores legacy explicit activation because that host cannot distinguish it from an implicit broadcast; opening the row manually still works. Mobile creation retains host-renderer provisioning. No new platform-specific process, path, or keyboard behavior, and no additional polling.

Checklist

  • Focused on workspace navigation isolation and the provisioning that previously depended on it.
  • Explained the user-facing change, mechanism, and approach.
  • Visual evidence attached outside the repository.
  • Adversarial self-review completed.
  • Cross-platform, SSH, folders, mobile, and mixed-version behavior considered.
  • Typecheck, changed-file quality gates, focused tests, and E2E build passed locally; CI covers the full repository gates.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 031e7b91-ef9e-4a28-a61b-afa2442f1eb5
📥 Commits

Reviewing files that changed from the base of the PR and between 6cee979 and 13f2efb.

📒 Files selected for processing (3)
  • docs/reference/remote-wire-compatibility.md
  • src/main/runtime/orca-runtime-get-worktree-terminal-provisioning-host.ts
  • src/main/runtime/orca-runtime-worktree-provisioning-availability.test.ts

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


📝 Walkthrough

Walkthrough

Worktree creation and activation now default to host navigation in the relevant runtime and CLI paths. CLI-provenance requests that specify all are normalized to host. Host-side creation can provision worktree resources in the background when the renderer is unavailable or not ready. Runtime clients process only client-addressed activation events, scope discovery to the publishing host, and cancel activation when the bridge or connection state becomes stale.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 13f2e

Worktree creation with an explicit all-client navigation request now falls back to host background provisioning when the host renderer is unavailable. No concrete merge-blocking risk remains in the reviewed changes.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 801d6

The change reduces unintended control of paired viewers without establishing broader execution privileges. A limited recovery concern remains: creation during a host renderer crash or reload can leave setup and terminal initialization without an available owner.

Retained concerns

  • Medium · reliability · inferred: Host-only activation can strand creation-time provisioning during renderer unavailability. A crashed or reloading window retains its notifier, so the new background-provisioning predicate is false. Without the independently spawned-startup alternative, setup and default tabs are delegated to a host activation notification that the suspended sender drops without replay. Legacy CLI requests previously targeting all viewers are now normalized to host, removing the paired-renderer consumer for this case. The inspected recovery paths rediscover the workspace but do not replay its creation-time payload.
Security review details

Security Blast Radius

  • inferred — The relevant authority scope is the publishing runtime, its selected repository execution host, and its connected viewers. Explicit all navigation can still target both host and client surfaces, but that capability existed at the base; the PR narrows default fanout rather than extending it.

Trust Boundaries and Controls

  • observed — Navigation parameters are routing intent, not authentication. RPC handlers receive paired identity and client kind from authenticated context separately from request parameters. Remote workspace-creator context rejects missing paired identity, and authorization tests cover mismatches between request credentials and the authenticated channel.
  • observed — Remote activation checks execution-host identity and revocation freshness across repository and worktree discovery. Bridge cleanup, SSH-state generation changes, connection generation changes, or pairing-revision changes cancel pending navigation before selection is committed.

Resilience and Maintainability Implications

  • inferred — The ownership handoff is reliable on successful provisioning, but notifier presence is not equivalent to renderer availability. Consequently, narrowing navigation can remove an incidental fallback without transferring creation-time work to the runtime during renderer suspension. This is a lifecycle-containment concern, not an established privilege escalation.

Hardening Proposals

  • proposed — Separate renderer liveness from notifier existence when assigning provisioning ownership. Preserve host-only navigation while allowing runtime provisioning or durable reconciliation when activation delivery is unavailable.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 31 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the main change: remote worktree creation no longer navigates paired clients.
Description check ✅ Passed The description covers the change, motivation, linked-issue status, visual proof, testing, review, compatibility notes, and checklist. It provides specific test results and identifies platforms not te…
Full details: Docstring Coverage

Explanation

Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 31 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/cli/index-worktree-create-agent.test.ts (1)

84-84: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Update the stale comment above this assertion.

Lines 82-83 say that --activate must stay "an explicit all-surface reveal". The assertion now expects navigation: 'host'. The comment now describes the opposite of the tested behavior. Change it to state that CLI activation targets the host desktop.

Proposed fix
-      // Why: the CLI pairs as a runtime device but has no viewer, so --activate must
-      // stay an explicit all-surface reveal rather than caller-scoped navigation.
+      // Why: the CLI has no viewer, so --activate targets the host desktop rather
+      // than navigating paired clients.
       navigation: 'host',

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c3ad70af-13d8-45e8-8906-aa6d63a3a91c
📥 Commits

Reviewing files that changed from the base of the PR and between 4e64fa9 and 801d633.

📒 Files selected for processing (26)
  • docs/reference/remote-wire-compatibility.md
  • src/cli/handlers/worktree.ts
  • src/cli/index-worktree-create-agent.test.ts
  • src/cli/index-worktree-create-target.test.ts
  • src/main/runtime/multi-client-navigation-isolation.integration.test.ts
  • src/main/runtime/orca-runtime-activate-managed-worktree.ts
  • src/main/runtime/orca-runtime-create-managed-remote-worktree.ts
  • src/main/runtime/orca-runtime-create-managed-worktree.ts
  • src/main/runtime/orca-runtime-notify-ssh-state-changed.ts
  • src/main/runtime/rpc/methods/worktree-create-args.ts
  • src/main/runtime/rpc/methods/worktree-create-navigation.test.ts
  • src/main/runtime/rpc/methods/worktree.ts
  • src/main/runtime/runtime-folder-worktree-create.test.ts
  • src/main/runtime/runtime-folder-worktree-create.ts
  • src/main/runtime/runtime-local-worktree-terminal-startup.test.ts
  • src/main/runtime/runtime-local-worktree-terminal-startup.ts
  • src/main/runtime/runtime-remote-managed-worktree-create.test.ts
  • src/main/runtime/runtime-remote-managed-worktree-create.ts
  • src/renderer/src/hooks/ipc-events/runtime-client-ipc-bridge-ownership.test.ts
  • src/renderer/src/hooks/ipc-events/runtime-client-ipc-bridge.ts
  • src/renderer/src/hooks/ipc-events/worktree-event-runtime-activation.test.ts
  • src/renderer/src/hooks/ipc-events/worktree-event-runtime.ts
  • src/shared/runtime-client-events.ts
  • src/shared/runtime-navigation.test.ts
  • src/shared/runtime-navigation.ts
  • tests/e2e/paired-worktree-activation-isolation.spec.ts

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e8cb8e87-b124-4ce9-8679-8974d98eb5bf
📥 Commits

Reviewing files that changed from the base of the PR and between 801d633 and 6cee979.

📒 Files selected for processing (16)
  • docs/reference/remote-wire-compatibility.md
  • src/cli/index-worktree-create-agent.test.ts
  • src/main/runtime/orca-runtime-create-managed-remote-worktree.ts
  • src/main/runtime/orca-runtime-create-managed-worktree.ts
  • src/main/runtime/orca-runtime-get-worktree-terminal-provisioning-host.ts
  • src/main/runtime/orca-runtime-tests/worktree-setup-and-startup-part-03.spec.ts
  • src/main/runtime/orca-runtime-tests/worktree-setup-and-startup-part-04.spec.ts
  • src/main/runtime/orca-runtime-worktree-provisioning-availability.test.ts
  • src/main/runtime/rpc/methods/worktree.test.ts
  • src/main/runtime/runtime-folder-worktree-create.test.ts
  • src/main/runtime/runtime-folder-worktree-create.ts
  • src/main/runtime/runtime-local-worktree-terminal-startup.test.ts
  • src/main/runtime/runtime-local-worktree-terminal-startup.ts
  • src/main/runtime/runtime-remote-managed-worktree-create.test.ts
  • src/main/runtime/runtime-remote-managed-worktree-create.ts
  • src/renderer/src/components/right-sidebar/file-explorer-watch-reconcile.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/runtime/runtime-remote-managed-worktree-create.test.ts
  • docs/reference/remote-wire-compatibility.md
  • src/main/runtime/orca-runtime-create-managed-worktree.ts
  • src/cli/index-worktree-create-agent.test.ts

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

# Conflicts:
#	src/renderer/src/components/right-sidebar/file-explorer-watch-reconcile.test.ts
@nwparker
nwparker merged commit 6a9ba9d into main Oct 6, 2026
69 of 72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant