Skip to content

fix(terminals): terminal IDs, agent rows and dashboard rows follow the owner - #27243

Merged
OrcaWin merged 2 commits into
mainfrom
OrcaWin/d4-d4-v2a
Oct 10, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
OrcaWin/d4-d4-v2a

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

When Orca is connected to another Orca server, some terminals and agents live on that server. Three buttons still asked this computer about them, and this computer does not know them. Now they ask, or tell, the server that actually owns them.

What Changed

  • Copy Terminal ID. Before: on a terminal that runs on a paired Orca server, it showed "Unable to copy terminal ID" (or copied nothing). After: it copies the server's own terminal ID, the one that server's orca CLI accepts. Mechanism: such a pane is already bound to an ID of the form remote:<server>@@<handle>, and that handle is the server's terminal ID. The copy now reads it from the pane's binding. Before, it asked this desktop's runtime, which has no record of a server-owned pane. Local and SSH panes keep asking this desktop's runtime, which does own them.
  • Agent rows (sidebar) and Agent Dashboard "open". Before: clicking a row for an agent on a paired server only changed this window's selection, so the owning server never heard which tab you picked. If that tab had not reached this window yet, nothing happened at all. After: the click also sends the same "this client opened this tab" request that a tab-strip click sends, to the server that owns the workspace (looked up from the workspace, not from the focused "Active Server"). The request names the exact split pane, so the server wakes and selects that pane, not the first one. It also records a focus intent, so a tab that has not arrived yet gets focused when it does. The intent is guarded by the tab that was visible at the click, so if you move to another tab before it arrives, it does not pull you back. Workspaces this computer runs itself (local, SSH) make no extra call.
  • Agent Dashboard preview message. Before: a card for an agent on a paired server said "No live terminal — this agent's pane has closed", which reads as if the agent died. After: it says "No preview for this remote session — open the workspace to view the terminal", the same message SSH cards already show. Live previews from the owning server are a separate change (terminalPreview.*, D4-V2c).

Why

The bug in all three is that the action asked or told the wrong machine. Copying the handle from the pane's existing binding needs no network call and works while the server is briefly unreachable. Re-resolving through the server was the alternative, and it adds a failure mode for no gain, because the binding is kept current whenever the server reissues the handle. For row clicks, the tab strip, command palette and tab number shortcuts already send session.tabs.activate to the owner. Rows now share one small helper for that instead of each growing their own path. The preview message follows the SSH rule in docs/reference/ssh-execution-boundary.md: if this client cannot see a pane, that proves nothing about the pane's state (unverifiable), and it is never evidence the pane exited.

Linked Issue

Fixes #11664
Fixes #15553
Fixes #25688
Refs #12739, #22196: the tests show that a row click now reaches the owning server with the right tab. The full click-to-focus behaviour on a real paired server still needs to be confirmed in the multi-host fixture before these close.

Visual Proof

N/A. This changes clipboard contents, a server request and a one-line message. These are covered by unit tests. On this machine, launching Electron is not allowed for agents.

Testing

  • Each acceptance test was written first and run against origin/main source, where it fails. With this change they all pass:

    • terminal-handle-copy.test.ts: a paired-server pane copies term_on_server and never calls this desktop's runtime. An unreadable remote: id is refused.
    • terminal-preview-unavailable-message.test.ts: hostKind: 'remote' and remote: pty ids get the remote message.
    • WorktreeCardAgents.activation.test.tsx: hydrated and not-yet-hydrated live rows notify the owner.
    • reveal-dashboard-agent.test.ts: a dashboard reveal notifies the owner, and a failed reveal touches nothing.
    • terminal-tab-owner-activation.test.ts: the owner comes from the workspace, the pane and visible-tab guard are passed on, and local workspaces make no call.
    • web-runtime-session-tab-activate-close.test.ts: session.tabs.activate carries the picked pane, and the focus intent records both the pane and the guard.
  • pnpm tc:web, focused pnpm test (57 files around the changed code), oxlint, pnpm run check:code-quality:changed, owner-routing and max-lines ratchets all pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Self-review plus an independent read-only review (P0/P1 only).

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

  • No wire change: session.tabs.activate already exists and is what tab clicks send. Old servers handle it the same way.
  • SSH and local panes keep the existing paths. Folder workspaces owned by a paired server resolve their owner through getRuntimeEnvironmentIdForWorktree, which already covers the folder arm.
  • Cross-platform: no paths, shortcuts or platform checks are involved.

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)

m4air added 2 commits October 10, 2026 05:07
…e owner

Copy Terminal ID on a paired-server pane copies the owning server's handle
instead of asking this desktop's runtime, which has no record of that pane.
Sidebar agent rows and dashboard reveals tell the workspace's owning server
which tab was opened, as a tab-strip click does. A paired-server dashboard card
with no preview says the session is remote instead of claiming its pane closed.
…later navigation

The row and dashboard reveal now send the exact split pane to the owner and
record it in the focus intent, guarded by the tab visible at the click, so a
later navigation away is never overridden when the tab arrives.
@coderabbitai

coderabbitai Bot commented Oct 10, 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: 9de1fd39-1c4e-4d5b-a105-064a9c8187db

📥 Commits

Reviewing files that changed from the base of the PR and between aea19ae and 5f81903.


📒 Files selected for processing (14)
  • src/renderer/src/components/dashboard-popout/terminal-preview-unavailable-message.test.ts
  • src/renderer/src/components/dashboard-popout/terminal-preview-unavailable-message.ts
  • src/renderer/src/components/dashboard/reveal-dashboard-agent.test.ts
  • src/renderer/src/components/dashboard/reveal-dashboard-agent.ts
  • src/renderer/src/components/sidebar/WorktreeCardAgents.activation.test.tsx
  • src/renderer/src/components/sidebar/WorktreeCardAgents.tsx
  • src/renderer/src/components/terminal-pane/terminal-handle-copy.test.ts
  • src/renderer/src/components/terminal-pane/terminal-handle-copy.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-menu-copy-actions.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.ts
  • src/renderer/src/lib/terminal-tab-owner-activation.test.ts
  • src/renderer/src/lib/terminal-tab-owner-activation.ts
  • src/renderer/src/runtime/web-runtime-session-tab-activate-close.test.ts
  • src/renderer/src/runtime/web-runtime-session-tab-lifecycle.ts

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



📝 Walkthrough

Walkthrough

The changes recognize paired-server hosts and remote-runtime PTY IDs when selecting the unavailable-preview message. Terminal ID copy now receives the pane’s PTY ID and can copy a handle extracted from a remote-runtime PTY ID. A new helper activates terminal tabs through the owning web runtime session. Dashboard and sidebar agent activation flows call this helper, and the activation request can include a leaf ID and the currently visible local tab ID.


Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 5f819

No actionable issue remains from the reviewed changes. Real paired-server click-to-focus behavior still needs the planned manual confirmation.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 14 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main changes to terminal IDs and owner-based activation for agent and dashboard rows. It is concise and related to the changeset.
Description check Passed The description is complete and follows the required template. It explains the user impact, implementation, rationale, linked issues, visual-proof exception, testing, review status, compatibility cons…
Linked Issues check Passed [ #11664, #15553 ] copyTerminalHandleForPane detects a remote-runtime PTY, extracts the server handle, awaits the clipboard write, and avoids the local runtime lookup. Unreadable remote IDs fail. Ot…
Out of Scope Changes check Passed The changed code stays within the linked bug scope. Remote PTY parsing and clipboard handling implement [#11664] and [#15553]. Remote preview messaging and owner-routed agent activation implement [#25…

  • Fix all pre-merge checks with AI
✨ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant