Skip to content

fix(terminals): automation runs, CLI tabs and folder-workspace browser tabs follow the owner - #27246

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

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

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​348 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​340
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​251 $\color{#cf222e}{\Huge{\mathbf{−}}}$​94 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​157

ELI5

Three actions picked the wrong machine. An automation run on a paired server looked "unavailable" even though the server still had it open. A browser tab asked for by a CLI on this computer was refused just because a paired server was the selected "Active Server". And a paired server could not open a browser tab for a folder workspace at all. Each now follows the machine that owns the workspace.

What Changed

Automation runs on a paired server (#21213).

  • Before: opening such a run showed "Run terminal is unavailable." and only the saved snapshot, while orca terminal read on the server showed the live run.
  • After: if this window already shows the server's pane, View run opens it. If it does not yet, Orca opens the workspace and asks the server to focus the run's tab and pane; the pane is selected when it arrives. "Run terminal is unavailable." appears only when the server says it has no such tab.
  • Mechanism: a run records the server's tab, pane and PTY ids. This window shows that pane as a mirrored tab (web-terminal-<host tab>) whose PTY id is the server's terminal handle, so comparing the server's PTY id with local state could never match. resolveAutomationRunTerminalTarget now also checks the mirrored tab: the same pane, bound to a live PTY from the owning server. The owner comes from resolveOwner (which never reads the Active Server setting). If there is no mirrored pane yet, the action calls the existing session.tabs.activate with a focus intent, the same path tab clicks use.

Local CLI browser tabs with a paired server selected (#22275).

  • Before: orca tab create --worktree path:<local worktree> failed with "Browser tabs are unavailable while a remote runtime is active" whenever a paired server was the Active Server. Tab close and profile change failed the same way.
  • After: these requests work for every workspace this computer runs (local or its own SSH). They are refused, with a message that says why, only when the tab or the fallback active workspace belongs to a paired server.
  • Mechanism: the renderer bridge for browser:requestTabCreate/Close/SetProfile replaced its Active Server check with an owner check. An explicit worktree id from main is trusted, because main already resolved it against this computer's own catalog.

Browser tabs in a paired server's folder workspace (#21353).

  • Before: "New Browser Tab" in a remote folder workspace with Server (streamed) placement failed with "The paired runtime could not create a managed browser tab."
  • After: the server creates the page for the folder workspace, as it already did for a git worktree.
  • Mechanism: browser.tabCreate used the folder-aware resolver only for client-hosted pages. Every other placement used the git-worktree resolver, which answers selector_not_found for folder: ids. It now uses resolveBrowserWorkspace for every placement (list and close already did).

Why

Each fix replaces a focus- or shape-based guess with the workspace's real owner, using primitives that already exist: resolveOwner, the session mirror's tab ids, session.tabs.activate with focus intents, and resolveBrowserWorkspace. There is no new RPC, so nothing changes on the wire. An older server still refuses folder browser tabs until it updates, which is today's behavior.

Alternatives considered:

  • Storing the server's raw PTY id on mirrored tabs. Rejected: it adds a second identity to the mirror, and pane identity (a UUID per pane) plus "PTY from the owning server" is enough to find the pane.
  • Keeping the focus guard and adding an exception for an explicit worktree. Rejected: tab close and profile change would still read focus, and a server-owned tab could still be closed locally while focus was on this computer.

Linked Issue

Fixes #21213
Fixes #22275
Fixes #21353

Visual Proof

N/A. This machine is load-capped, so no Electron runs here. The behavior is covered by acceptance tests that fail on origin/main (see Testing).

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Acceptance tests. Each was run against the origin/main versions of the source files first and failed there:

  • automation-run-workspace-action.paired-server.test.ts: the mirrored pane opens; with no mirror the server is asked to focus the host tab and pane; "unavailable" appears only when the server refuses. On main, 2 of 3 fail (the third checks the refusal toast, which main also shows).
  • browser-request-ipc-bridge.owner.test.ts: with a paired server as Active Server, an explicit local create succeeds; falling back to a server-owned active workspace is refused; closing a local page works and closing a server-owned page is refused. All 3 fail on main.
  • browser-tab-create-folder-workspace.test.ts: a server-placement browser.tabCreate for id:folder:… creates the page. On main it fails with selector_not_found.

Also ran: pnpm tc, focused vitest (automations, hooks/ipc-events, i18n, runtime browser: 1175 tests), oxlint, check:code-quality:changed, owner-routing ratchet, localization catalog/extraction/coverage checks.

Review

P0/P1 review: own review plus an independent reviewer (see comments).

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

  • SSH: a workspace this computer reaches over its own SSH counts as owned here, so local CLI browser requests for it are allowed. A server's nested SSH target counts as the server's.
  • Folder workspaces: covered by the third fix and by resolveOwner's folder arm.
  • Mixed versions: no RPC or stream change. A new client with an old server still gets selector_not_found for folder browser tabs, and session.tabs.activate is an existing method.
  • Two now-unused locale strings were removed and two new English strings were added.

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)

…r tabs follow the owner

- An automation run on a paired server opens its mirrored pane, or asks the
  server to focus it when the mirror has not loaded it yet, instead of
  reporting "Run terminal is unavailable." while the server still runs it.
- This desktop's CLI browser tab create/close/profile requests are refused
  only for a workspace a paired server owns, not whenever a paired server is
  the Active Server.
- browser.tabCreate resolves folder workspaces for server-hosted pages, as it
  already did for client-hosted ones.
@OrcaWin
OrcaWin requested a review from brennanb2025 as a code owner October 10, 2026 12:44
@OrcaWin

OrcaWin commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

P0/P1 review: own review plus an independent reviewer. The cross-model reviewer could not be started (the orchestration run was fenced: consumer_fenced). Result: no P0/P1 findings.

Two P2 notes were fixed in d45df1f:

  • A browser tab whose workspace has an ambiguous owner is now refused instead of allowed.
  • A run whose workspace cannot be revealed now says "Workspace is not available."

Two P2 notes were left as they are:

  • The mirrored pane is matched by pane id and by which server owns it, not by the server's PTY id, because this window never sees that id.
  • The run page's owner lookup recomputes on store changes while the page is open. This costs performance only.

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