Repository navigation
fix(orcad): orca open-url opens the page on the paired desktop - #30782
Conversation
…server without a server browser
…sktop-hosted pages
…e tabs and desktop-hosted pages
…heir desktop leaves
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
…esktop again, not an SSH setting (#31120) Every orcad turned on the SSH host browser bridge, so since open-url began going through it (#30849) a user-started serve with no desktop refused with SSH-settings advice. Only a client's managed launch enables the bridge now; a started server answers browser_host_unavailable (#30782). Co-authored-by: E2E Test <e2e@test.local>
ELI5
When Orca runs as a server (
orca serve) and a desktop is paired with it,orca open-urlon the server should open the page in that desktop's Orca browser. On the default server runtime (orcad) it failed with "Browser automation is unavailable on this host." It now opens the page on the paired desktop, as it did before orcad became the default.What Changed
Before: on a paired
orca serverunning orcad,orca open-url --url …failed withbrowser_unavailable. The only workaround wasORCA_SERVE_RUNTIME=electron.After:
orca open-urlopens the page in the paired desktop's browser, inside the server's workspace. Its network goes through the server, sohttp://localhost:3000on the server works. If no desktop is hosting pages for the server yet, it refuses withbrowser_host_unavailableand says what to do: open a browser tab in one of the server's workspaces on a paired, up-to-date desktop.Mechanism:
Server (orcad). orcad sent every browser command to a local browser engine (an Electron sidecar or Chromium). With no engine, every command failed. A page hosted on a desktop never needs that engine: it lives in this runtime's own lease and page registries, which orcad already had. orcad now handles these commands itself, with or without an engine:
open-urltab create, andtab list/current/show/switch/closeThe creation code is one Electron-free module,
browser-client-page-opening.ts, and the Electron runtime now uses it too.Capability. orcad now advertises
browser.clientHost.v1from that registry (the newclientHostingWithoutEnginefactory option), so its health no longer depends on the engine. Report browser placement support from the installed provider #26559 had withdrawn the capability because creation failed; creation now works.Desktop. A desktop only places a tab on the runtime for a host that streams pages (
browser.screencast.v1). It now also does this for a runtime that advertises full client hosting. That makes tabs in a paired orcad workspace desktop-hosted, which attaches the leaseopen-urlneeds. Managed SSH deployments are excluded: they keep their SSH-routed desktop tabs and the desktop browser bridge. "Reopen on server" is hidden for a runtime known to have no browser of its own.With an engine. Tab commands see one list: engine tabs first, then desktop-hosted pages. One selection rule decides which tab is current, and it matches the page that workspace automation without
--pagealready drives.Why
There were two ways to show a server's page on a desktop:
localhoston the wrong machine.I chose 2. It is safe on any network and correct for a server's
localhost, and it reuses the existing lease, tunnel and automation routing with no new protocol.Reference check: a mature remote editor forwards its server CLI's "open URL" to the attached client over an allowlisted channel, and the client opens it with port tunnelling. This is the same shape as option 2. Review rounds 2–5 kept finding places where the engine and the page registry disagreed about which tab was "current". After round 3 the design was reworked to give that one owner: one logical tab list and one selection rule (
yieldClientPageSelection), matching the dispatcher's existing routing. This was simpler than patching each finding.Wire compatibility. Nothing new goes on the wire; every capability string already exists.
open-urlreturns the clearerbrowser_host_unavailable.browser.clientHost.v1, so the desktop behaves as before.Linked Issue
Fixes #30731
Visual Proof
Desktop (background-launched, hidden) after
orca open-urlwas run against an isolated orcadorca serve. The page was served on the server's loopback and rendered in the desktop's browser tab, placed on the client:Linux server (real host), macOS desktop. An isolated orcad
orca servewith no browser engine ran on a real Linux host. A paired desktop reached it through an SSH port forward, launched in the background. The page was served only on the Linux host's127.0.0.1:46732, which the Mac cannot reach directly. It rendered in the desktop's tab, so its network went through the server:macOS, local e2e (
tests/e2e/orcad-serve-open-url-on-desktop.spec.ts):Before (main):
orca open-urlreturnsbrowser_unavailable, "Browser automation is unavailable on this host." The issue reproduces on 1.4.230.Testing
Fail on main, pass here:
src/main/orcad/orcad-client-hosted-browser.test.ts:open-urland tab commands with no engine, the refusal text, paired versus CLI placement, the engine-plus-desktop list and selection, and close by index or current.browser-capabilities-part-02.spec.ts.client-creation-action-policy.test.ts.client-hosted-browser-unavailable-notice.test.tsx.E2E:
tests/e2e/orcad-serve-open-url-on-desktop.spec.ts, a real orcadorca servewith a paired, background-launched desktop, verified locally on macOS (ORCA_E2E_ORCAD_SERVE=1):open-urlreturnsbrowser_host_unavailablewith guidance.open-urlsucceeds.tab listshows it.tests/e2e/ssh-orcad-browser-capabilities.spec.ts(Docker lane): updated. A managed SSH orcad now advertises client hosting truthfully, but its desktop keeps SSH-routed tabs, soopen-urlrefusesbrowser_host_unavailable.Live on Linux (real host, isolated):
/tmpdirectory on the Linux host. That host has no Orca install, so there was no engine, as in the report.HOMEandORCA_USER_DATAon a free loopback port, reached from the Mac throughssh -L. Nothing outside the temp directory was touched, and everything was removed afterwards.browser.clientHost.v1.orca open-url(on the Linux host) returnedbrowser_host_unavailablewith the guidance text.orca open-url --url http://127.0.0.1:46732/succeeded.placement: client.orca tab liston the server listed it as active.Static checks: the full static-analysis job ran locally (lint, code-quality gates, every ratchet), with typecheck for node and web.
Review
Codex (GPT-6.1 sol, high) and Opus reviewed the change across nine Codex rounds. The final Codex round and the final Opus pass found nothing. Every earlier finding was fixed:
tab list/show/switch/closefailed on an engine-free host.Agent skill upstream boundary
Notes
open-urlrefusesbrowser_host_ambiguous, as the existing lease selection already does. Picking the desktop that owns the caller's terminal is a follow-up.orca servetoday.browser_unavailable.invalid_argument.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)