Repository navigation
STA-4150: client-hosted remote browser (consolidated) - #15448
Merged
Merged
Conversation
Consolidates the 134-commit STA-4150 client-hosted remote browser stack with
106 commits of main. Resolution decisions, one per conflicted file:
- .github/workflows/pr.yml: union of both sides' Windows-boundary vitest specs
(feature's three browser client-page/route electron tests + main's two
node-pty wide-char tests).
- src/shared/runtime-types.ts: union of both new type imports
(RuntimeBrowserPlacement, TerminalExitCause).
- src/renderer/src/i18n/locales/en.json: union of sibling key groups
(feature's browser.pane.download.savedToRemote + main's annotate/navigate
groups); `pnpm run sync:localization-catalog` reported no further changes.
- src/main/browser/browser-cookie-import.ts: took main's STA-4300/STA-4601
rewrite (getStoragePath-derived partition dir, per-partition mutation lock,
in-lock Cookies-DB init probe) wholesale, then replayed the feature's four
deltas on top: the supportsPendingBrowserCookieImportReplay staging gate, the
-wal/-shm sidecar unlink in discardStagingFile, and the two comments.
- src/main/runtime/orca-runtime.ts (closeMobileSessionTab): kept main's
hardened terminal tail (closeTerminal + ownership clear +
delegatedMobileSessionTabClose) and main's throw-on-missing-notifier
contract, and layered the feature's three-way browser dispatch on top —
client-hosted page -> browserTabClose, offscreen tab ->
offscreen close + retireRuntimeOwnedBrowserSessionTab, otherwise the
hardened awaited notifier.closeSessionTab. The feature's helper split
(isOffscreenMobileSessionBrowserTab / retireRuntimeOwnedBrowserSessionTab)
replaces main's closeHeadlessMobileBrowserTab, which main did not change.
- src/renderer/src/store/slices/browser.ts: union — kept the feature's
client-host-first import fallback and added main's
supportsPartitionSkippedCookies capability flag to the RPC params. The
client-host IPC path stays flagless, matching main's local
browser:session:importFromBrowser handler (undefined, not false, so
partition-skip reporting stays on).
- browser-pane/stream-remote/remote-browser-screencast-subscription.ts:
main's rename depth for the relative imports plus the feature's e2e
screencast-subscribe observer.
- browser-pane/BrowserPane.tsx: main gutted this to a re-export of
assemble-chrome/browser-workspace-pane, so the feature's in-file additions
were relocated into main's modules rather than kept here:
* assemble-chrome/browser-workspace-pane.tsx — activeRemotePageHandle
selector and the ClientHostedBrowserPagePane vs RemoteBrowserPagePane fork.
* stream-remote/remote-browser-page-viewport.tsx — the Reopen-on-server
button beside Reconnect in the stream-error notice (new worktreeId prop
threaded from remote-browser-page-pane.tsx, since the button needs the
bare worktree id, not runtimeWorktree).
* navigate/use-browser-page-download-events.ts — emitBrowserRemoteDownloadToast
on download-finished.
* ClientHostedBrowserPagePane.tsx — BrowserTabPageState/BrowserPageUrlSetter
now import from main's describe-page/browser-page-types instead of being
redeclared, and BrowserAddressBar imports from assemble-chrome/.
Two feature-branch tests needed main-layout fixups:
- browser-cookie-import-route-partition-staging.test.ts: session mock gained
getStoragePath (main now derives the partition dir from the Session).
- ClientHostedBrowserPagePane.test.tsx: BrowserAddressBar module mock path
follows the move into assemble-chrome/.
docs/remote-browser-client-hosting.md and
docs/sta-4150-client-hosted-browser-progress.md remain untracked per policy.
Verification: pnpm run typecheck (3 projects) clean; vitest over
src/main/browser src/main/runtime src/main/ipc
src/renderer/src/components/browser-pane src/renderer/src/components/settings
src/renderer/src/store/slices src/shared -> 1846 files / 18603 tests passing;
config/scripts suite 111 files / 861 tests passing;
check:code-quality:changed 0 new findings across 1794 files;
check:max-lines-ratchet, check:reliability-gates, and all three localization
verify scripts pass.
|
Too many files changed for review (873 files, 100 file limit). |
This was referenced Aug 19, 2026
The lease shares one deadline across admission retries, so the first attach receives the remaining budget. A clock tick between capturing the deadline and reading it yields 14999, which the exact 15_000 assertion failed on (reproduced deterministically by advancing Date.now).
….185 rename The cross-version harness pins no baseline; it uses the newest stable tag at run time. v1.4.185 moved TabCreate out of browser-schemas.ts and renamed it to BrowserTabCreateParams, so the import silently yielded undefined and the old-server assertion crashed on .parse.
…rocess A destination connect timeout or a destination_error frame arriving before Opened retires the stream with socket.destroy(error) while no consumer holds the duplex yet, so the 'error' event is unobserved and Electron surfaces an uncaught-exception dialog per failed connection. Attach a base error listener at construction; real consumers still observe errors normally.
The shared per-page screencast made updateViewport a no-op once any frame had flowed: emitSnapshotFrame(true) bails when seq > 0, before device metrics are reapplied. A joining viewer then mutated the declared viewport without moving Emulation.setDeviceMetricsOverride, so its live frames failed the viewport-fit check and were dropped while the pane stretched the last stale frame — a frozen, zoomed, dead pane on static pages. Emit a non-initial snapshot instead. Also stop granting viewport ownership to subscribers that declared no size: normalizeScreencastViewport keeps undefined dimensions, so a sizeless owner cleared the emulation override for every viewer, on join and on owner-exit fallback.
…n parity
Typed queries parsed as hosts ('google maps' -> https://google%20maps/) because
the pane skipped the opt-in search-engine argument to
normalizeBrowserNavigationUrl; invalid input silently did nothing; and failed
navigations (did-fail-load) left a blank pane with no error surface. Enable the
search fallback with the user's configured engine, report invalid input as a
loadError like the other panes, and render BrowserLoadFailureOverlay with
retry/copy wired to the local guest, preserving the failure across the
trailing did-stop-loading.
The client-placement branch of browser.tabCreate never forwarded targetGroupId to markHeadlessBrowserSessionTabActive, so the snapshot rebuild coalesced the new tab into the leftmost group. The renderer's materialization check then required the requested group, timed out, rolled the tab back, and surfaced 'could not create a managed browser tab' — create-left, vanish, toast. Mirror the offscreen path's activate-gated marking, let the marker serve registry-published client pages on hosts without an offscreen backend, and accept a live tab outside the requested group (older runtimes) instead of destroying it.
…failures The address-bar submit semantics (search-engine fallback, Kagi session link, invalid-input loadError) and the did-fail-load ignore rules were copied into each browser backend, and the client-hosted pane shipped two bugs by missing a copy. Both now live in one module each — resolveBrowserAddressBarSubmission and resolveBrowserWebviewLoadFailure — which the local and legacy-remote panes call. buildLoadError is absorbed into the failure resolver so the ignore predicate and the BrowserLoadError shape cannot be adopted separately.
Each backend hand-rolled its own back/forward/reload/address-bar row, so the client-hosted pane drifted: different button sizing and no contextual-tour anchor. BrowserNavigationControlRow now owns that row and renders against a BrowserNavigationControls seam (canGoBack/canGoForward/loading + goBack/goForward/ reload/navigate) that each backend implements. The local pane keeps its reload dropdown and the legacy-remote pane its tooltip reload by passing them as reloadControl, and pane-specific tools stay trailing children, so neither pane's own chrome is rewritten. The client-hosted pane also moves onto the shared address-bar submit and load-failure modules, deleting its last private copies.
browserTabCreate had three placement branches, each hand-rolling its own post-create bookkeeping. That divergence has already shipped bugs twice: a wrapper that dropped targetGroupId, and the client branch never marking the session tab active, so a browser created from a right split landed in the left group and was rolled back with a confusing toast. publishCreatedBrowserSessionTab now owns bridge activation, split-group targeting, and the session-tabs notification for all three placements, with a rule table as the only place a placement may differ. Each branch keeps just its placement-specific work: client lease/proof, offscreen createTab, renderer IPC round-trip. The two activate defaults (client registry `active` is `!== false`, session-tab focus is `=== true`) are preserved and documented at the seam rather than collapsed. They agree for every shipped caller — web-runtime-session is the sole sender of client placement and always sends an explicit boolean — but collapsing them would silently change the omitted-activate case. Census tests pin the convergence: a placement that hand-rolls the focus marker or skips the seam fails.
…fscreen page browser.tabClose's offscreen branch only destroyed the guest, so an agent/CLI close on a headless host left paired clients holding a dead session tab until an unrelated republish; the session-tab close path (closeMobileSessionTab) already retires. Found by the tab-create convergence census.
… moves Two desktop-client bugs from live testing on the fixed runtime build: The '+' flow sent only targetGroupId, which steers snapshot-driven clients; desktop pane groups are client-owned and the tabs-sync reconciler only honors a recorded clientTargetGroupId (the file-preview flow already records one), so the new tab still landed in the first group. Record the client group too. The retained client-hosted webview is a fixed-position overlay synced to its pane's rect only on resize/scroll events. Dragging a tab across an even split moves the pane without resizing it, so the overlay kept painting at the old pane's coordinates — browser content visually merged over the neighboring pane's terminal while the real pane sat blank. Track position per animation frame, writing styles only when the rect changes.
…ting onDestinationClose/onDestinationEnd were the only destination handlers without a stream.connected guard, so a socket that closed before ever emitting 'connect' put Close/HalfClose on the wire for a stream the client had never seen Opened. The client treats that as a protocol violation and calls closeTunnel, retiring every stream on the tunnel — one stale connect attempt killed all in-flight browser connections on the runtime. Guard both handlers and degrade to a per-stream Error frame instead, and make the system-ssh SOCKS route emit an error before destroying an invalidated socket, matching its ssh2 and WSL siblings which already use socket.fail(). Extracts the open-admission path into browser-network-tunnel-open-admission.ts to keep the session under the max-lines budget; no behavior change there.
A failed reserveRetainedBytes/claimRetainedBytes went through failProtocolStream, which closes the whole session: every stream retired and onClose fired. But the host over-grants credit by construction — onDestinationConnected hands out 256 KB per stream for up to 128 streams against an 8 MB retained pool — so a peer sending only bytes the host authorized can exhaust the budget while staying fully conformant. There is no peer violation for failProtocolStream to answer. Fail just the stream that could not reserve, matching the adjacent per-stream destination_buffer_overflow case and the client's mirror-image handling. The two existing budget tests asserted the old whole-session teardown and now pin the per-stream contract.
…wport A later screencast subscriber takes viewport ownership of the shared page and re-emulates it at its own size, but no other subscriber is told. Non-owners kept mapping pointer coordinates against the CSS viewport they cached at join, so a phone joining in mobile view silently misplaced every click a desktop viewer made. Trust the cached CSS size (and this pane's requested size) only while frames still report the size this pane asked for; otherwise fall back to the per-frame device size, which the runtime keeps accurate for every subscriber.
…wed edit Every behavioral test here iterates the very lists the implementation iterates, so declassifying a field silently removed its pruning and its test case together and left the suite green. Spelling the three derived lists out makes a label change fail a test that says what the list is supposed to be. The comments record what the census could not: `notRepoScoped` was reading as a clean bill of health when it only means these two paths leave the field alone -- sleeping agent records are pruned by the owner-scanning pass and leak only on the profile-move path, and three other entries are known residue. The transfer-apply merge is called out as the one field list still hand-written.
Main's module-split refactors moved most of the conflicted code out from under
this branch, so several edits had to be relocated rather than merged in place.
Conflicts and how each was resolved:
.github/workflows/pr.yml
Main replaced the inline shell spec routing with config/scripts/pr-e2e-source-routing.mjs.
Ported both client-hosted-browser routes into that script as
client-hosted-browser.host-strip and client-hosted-browser.restart-survival, and rewired
pr-e2e-gate-contract.test.mjs to read the restart-survival route from PR_E2E_SOURCE_ROUTES
instead of scraping the workflow shell that no longer exists. Windows boundary test list is
a union of both sides.
src/main/global-fetch-call-site-audit.test.ts
Union, minus a stale entry: main moved the audited fetch out of opencode/hook-service.ts into
status-plugin-post-source.ts, so main's replacement wins and our browser-route entries stay.
src/main/persistence/loading-store/store.ts
Took main's file wholesale. Our only delta was the runtime-authored guard, which relocated to
main's new chokepoints: preserveRuntimeAuthoredWorkspaceSessionFields now runs at the top of
setLocalWorkspaceSession (loading-store/workspace-session-snapshot-publication.ts) and
setHostWorkspaceSession (loading-store/session-host-partitions.ts). Censused every writer of
state.workspaceSession / workspaceSessionsByHostId on both sides: the guarded and unguarded
sets match pre-split coverage, and stageWorkspaceSessionBeforeUnload still inherits it.
src/main/persistence/restoring-sessions/session-owner-fields.ts
Kept the census-driven delete loop and main's new host-identity-aware scan for
lastVisitedAtByWorktreeId. That field is now excluded from the plain loop alongside
terminalTopologyRevisionByRepoId, since it also carries `${executionHostId}|${worktreeId}`
keys that indexing by owner key would miss. Updated the pinned census list and added explicit
coverage for the bare-vs-host-qualified delete that left the it.each loop.
src/main/runtime/orca-runtime.ts
Import-block conflict only; merged main's widened runtime-browser-commands-factory import with
ours. Verified all 495 added lines from this branch survived the body auto-merge, including
persistClientHostedBrowserPages, rehydrateClientHostedBrowserPages, the boolean-returning
retireRuntimeOwnedBrowserSessionTab, and the ghost-row retirement ordering.
src/main/window/createMainWindow.ts
Main split this into main-window-*-lifecycle modules. The browser-host-id argv stamp stays with
the BrowserWindow construction; the will-attach-webview partition allowlist and did-attach-webview
guest policies moved to main-window-webview-security.ts; registerRendererDocumentNavigation and
the client-page attach/retire wiring moved to main-window-focus-lifecycle.ts. The privileged
navigation policy and plugin panel guard stayed in main's module: neither ordering this branch
established is load-bearing (the guard only handles subframes, the fence reads defaultPrevented
in a microtask). createMainWindow.test.ts now records every handler per event instead of the
last one, because two modules register will-navigate on the same webContents.
src/main/wsl/__fixtures__/wsl-invocation-allowlist.txt
Union, minus a stale entry: main moved the wsl.exe invocation out of claude-accounts/service.ts
into claude-command-process.ts.
src/renderer/src/components/Terminal.tsx
Combined main's #16306 MRU close with our plan-driven close options: closeBrowserTab now runs
before destroyWorkspaceWebviews at all three sites and keeps the plan's reason, main's
hasUnifiedEntry guard is kept, and the visual-neighbor selection main deleted stays deleted
because closeBrowserTab picks the MRU target itself. All browser-guest-paint-retention helpers
remain wired at their sites.
src/renderer/src/components/tab-group/useTabGroupTabCloseCommands.ts
Kept our closeBrowserItem plan helper and carried main's #16306 ordering into it. Applied the
same flip in runtime/browser-workspace-tab-close.ts, a close-tab handler this branch added
after main's commit and which main could not reach.
src/renderer/src/hooks/useIpcEvents.ts
Main reduced this to a shim over ipc-events/app-lifetime-ipc-bridge. Relocated all five edits:
the client-hosted certificate-failure carve-out to ipc-events/browser-state-ipc-bridge.ts, the
paired-device create comment to browser-request-ipc-bridge.ts, the plan-routed menu close to
tab-lifecycle-ipc-bridge.ts, and the browser-remote-viewer plus client-hosted-row channels and
their hydration to mobile-driver-ipc-bridge.ts. Added both channels to main's new
useIpcEvents-lifecycle.test.ts callback census.
src/renderer/src/web/web-preload-api.ts
Main split this into web/preload-api/*. Relocated the web-client no-op stubs into
web-runtime-api.ts, web-runtime-environments-api.ts, and web-browser-api.ts.
Integration fixes outside the conflicts: main's new orcad test fixtures and
external-chromium-tab-registry.ts predate this branch's RuntimeBrowserCommandHost members and
BrowserSessionTabSelectionOptions, so the fixtures gained the four registry accessors and the
external-Chromium create now passes an options object with focusesHost: true, preserving the
always-steer behavior that call had before create learned to stay local.
The renderer close-site census in runtime/browser-workspace-tab-close-census.test.ts was
repointed at the three ipc-events modules that now hold useIpcEvents.ts's seven closeBrowserTab
mentions (tab-lifecycle 2 plan-routed, browser-request 3 and session-tab 2 host-requested).
No wire changes: no RPC params or stream frames were touched by any conflict.
Four conflicts, all against module splits main landed on top of the previous merge (d456549). src/shared/runtime-types.ts Main's #16197 dissolved this into a re-export shell over five contract modules. Took the shell; our three additions moved to src/shared/runtime-session-contracts.ts, where the types now live: RuntimeMobileSessionBrowserTab's browserProfileId/executionHostKey/ placement, UNPUBLISHED_WORKTREE_PUBLICATION_EPOCH ('none', unchanged — the merge base already sends it), and RuntimeMobileSessionTabsResult.clientHostedPagesUnreconciled. The shell re-exports the epoch as a value so existing importers keep working. src/shared/remote-runtime-client.ts Main split the file into a handshake module, a request/response router and a subscription transport. Took main's shape and relocated our delta: the clientCapabilities threading stayed on the request path, and the subscription-side machinery moved into the transport. Two further splits were forced by the max-lines ratchet, which main shrank past both files when it split them and which may not grow again: sendRemoteRuntimeRequestOnSocket moved to remote-runtime-request-socket.ts, and the transport's outbound queues and nested-request machinery became remote-runtime-subscription-outbound.ts and remote-runtime-subscription-request-channel.ts. Behaviour is unchanged; remote-runtime-subscription-request.test.ts (out-of-order routing, capacity bound, reject-on-close, exactly-once memory release) passes untouched against the rewrite. src/main/ipc/ssh.ts Main's #16394 split it into focused modules. The browser-partition teardown followed removeRegisteredSshTarget into src/main/ipc/ssh-session-teardown.ts, ordering intact: release, clear, a 500ms delayed second pass for the prepare-racing-removal window, all inside the same target-lifecycle callback. The connection-manager resolver wiring stayed in registerSshHandlers, and getSshConnectionManager is re-exported from ssh-target-registry rather than defined here, so the browser network route can read it without pulling in ipcMain. src/shared/child-process/__fixtures__/child-process-import-allowlist.txt Comment-block union; both sides' entries had already merged cleanly. runtime-client-export-parity.test.ts pins the public surface, so it records the widened signatures and the new value export. No wire changes: every field added is optional and no opcode moved.
…dled replayClientHostedBrowserCloseIntents fires and forgets from the status refresh, and its synchronous list read sat outside any catch — a store without the map turned into an unhandled rejection that fails whole CI unit shards. Read the map tolerantly and pin the shape.
…kill oracle Electron reports the same ReportBadMessage kill as 'killed' on mac/Linux but 'crashed' on Windows; the oracle is that the renderer died at all.
… reconciliation spec browser.tabList on a headed host with no live browser tab activates the browser view and waits up to 8s for a webview registration before it answers, so the journey's 5s RuntimeClient timed out before the runtime ever replied — deterministically, since f8112e8 switched the host oracle to browser.tabList. Raise the client timeout past the wait.
The same Import menu silently reads either this desktop or the paired remote depending on where the environment's pages are hosted, and a remote-side import can raise a permission prompt on the remote's screen. Label the picker with the answering machine, describe the storage location on success toasts, and split the Google sign-in guidance into local / client-hosted / remote-side variants so it no longer reads as 'go to the other machine' when the workspace tab opens locally.
…into sta-4150-hardening-review-fixes # Conflicts: # src/renderer/src/i18n/locales/en.json # src/renderer/src/lib/browser-cookie-import-toast.test.ts # src/renderer/src/lib/browser-cookie-import-toast.ts
7 of 9 tasks
dallascrilley
pushed a commit
to dallascrilley/orca
that referenced
this pull request
Aug 27, 2026
Co-authored-by: Jinwoo-H <[email protected]>
paidaxingyo666
pushed a commit
to paidaxingyo666/Manta
that referenced
this pull request
Aug 28, 2026
Co-authored-by: Jinwoo-H <[email protected]> (cherry picked from commit a9781a4)
3 of 5 tasks
5 tasks done
5 tasks done
This was referenced Sep 25, 2026
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
Co-authored-by: Jinwoo-H <[email protected]>
This was referenced Oct 28, 2026
11 tasks done
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Consolidates the full STA-4150 stack (formerly PRs #14953 #14954 #14955 #14956 #14957 #15038 #15397 #15398 #15399 #15400 #15401, stack #14958) into a single branch, merged with latest main.
What this is: browser pages for remote workspaces render in a real Electron webview on the paired desktop (native selects, IME, local input latency), while all page egress rides a loopback SOCKS proxy tunneled to the selected execution host (native/SSH/WSL) — local rendering, remote network identity. The remote runtime stays the authority (leases, generations, authority epochs, reconciliation). Legacy screenshot streaming remains for mobile/web/old hosts and mixed versions (capability-negotiated, proven against released builds).
Includes the hardening + polish waves: stable per-host partition identity (cookies survive runtime restarts), binding-store v2 + orphan GC + removal clearing, capability-negotiated file channel (uploads mean remote workspace paths via staged transfer; downloads land in the remote workspace, fail closed otherwise), gesture-gated same-partition OAuth popups with pre-load WebRTC UDP denial, Settings toggle, Reopen-on-server escape hatch, client-side cookie import into route partitions, and 27 fixed review findings from two independent review programs.
Why one PR: GitHub's stacked-PR machinery repeatedly wedged this stack (false CONFLICTING on a fast-forward, silent CI stops — see the closed PRs for the trail), and every layer was already green simultaneously. History is preserved: the layer-by-layer progression is intact in the commit list, and each closed PR remains as a browsable per-layer diff.
Review evidence: every layer passed full CI independently before consolidation; the consolidated tree passes typecheck, 18,603 unit tests, changed-code/type-aware/React-Doctor gates (0 findings), max-lines ratchet, localization, and reliability gates. The paired-Electron e2e journeys (client-hosted hosting headed+headless, kill-switch new-page-only, stream reconnect, terminal links, mixed-version placement both directions) are green.
Related but separate: #15402 (legacy-pane atomic click latency fix, independent of this feature).
Known follow-up (ledgered, not in this PR): the terminal link popover still offers only System Browser for links printed by SSH-workspace terminals — the destination gate (
terminal-link-open-hints.ts) predates this PR's SSH browser work, so a remote-only URL (e.g. a dev server on the SSH host) never gets the tunnel-routed Orca Browser option that could actually reach it. Tracked as STA-5496.