Skip to content

feat(browser): settle host commands on lease socket - #14557

Closed
Jinwoo-H wants to merge 1 commit into
sta-4150-browser-host-command-resultsfrom
sta-4150-browser-host-command-transport
Closed

Jinwoo-H wants to merge 1 commit into
sta-4150-browser-host-command-resultsfrom
sta-4150-browser-host-command-transport

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​677 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​658
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​277 $\color{#cf222e}{\Huge{\mathbf{−}}}$​24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​253

STA-4150: https://linear.app/stably/issue/STA-4150/refactor-remote-browser-to-client-hosted-electron-webviews

Stacked on #14553. This production-inert transport stage adds bounded bidirectional JSON RPC requests to the existing authenticated browser-host attach subscription, then returns validated completed/failed page-command results over that exact connection. Result authority stays bound to the negotiated runtime/device/epoch/host/page tuple; exact duplicate acknowledgement remains idempotent, while missing send support, handler failure, timeout, server rejection, malformed acknowledgement, and transport loss fail closed so the server records an unknown outcome.

Causal evidence: the unchanged subscription oracle was red on parent 876f958 with TypeError: subscription.sendRequest is not a function. The candidate passes exact-ID routing under reverse-order replies, rejects unknown/duplicate IDs, caps 32 pending requests plus a 16 MiB/64-frame control queue, releases aggregate queue/native-socket memory exactly, and proves serialization failure consumes no capacity. Fresh review also reproduced duplicate terminal callbacks on socket-registration and queue-claim denial; an idempotent terminal transition and deterministic regressions make both paths exactly once.

Validation: 10 focused transport tests; 53 focused transport/lease/integration tests; 809 runtime/browser/shared files with 9,699 passed and 24 existing skips; full node/CLI/web typecheck; mobile-facing import scan; cross-version wire compatibility; verified CLI build; native and type-aware zero-warning audits; changed-code quality; reliability and max-lines gates; formatting and diff checks; three clean fresh reviews after the callback fix.

Compatibility: RemoteRuntimeSubscription.sendRequest is optional so structural old-client wrappers remain valid. Command results are used only after the separately echoed page-command v1 negotiation; old/non-v1 ready/revoked behavior, server/offscreen placement, SSH/WSL/folder/worktree behavior, terminal channels, and mobile data remain unchanged. No stream opcode, capability advertisement, persistence schema, dependency, production RPC registration, production caller, placement default, or Electron UI behavior changes.

Activation remains blocked on real Electron/WebContents lifecycle wiring, a production browser-host registry and execution-host resolver, aggregate result backpressure versus the 256-command ledger, reconnect inventory/persistence/replay and unknown-outcome reconciliation, dispatcher abort/destruction ownership, capability eligibility for headed/browserless clients, and real headed/headless/browserless/SSH/WSL/mixed-version/physical cross-platform proof. This PR does not enable client placement, so visual proof is not applicable yet.

@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-command-transport branch from 31f812a to 764defd Compare August 14, 2026 20:03
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-command-transport branch from 764defd to 391a97c Compare August 14, 2026 20:14
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-command-transport branch 2 times, most recently from 838b3aa to 2a92b2b Compare August 14, 2026 23:17
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-command-transport branch from 2a92b2b to ee06101 Compare August 15, 2026 00:44
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-command-transport branch from ee06101 to b4b0e97 Compare August 15, 2026 00:57
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-command-transport branch from b4b0e97 to 0ffc62c Compare August 15, 2026 02:57
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-command-transport branch 5 times, most recently from 9c31018 to dd6c43f Compare August 15, 2026 12:30
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-command-transport branch from dd6c43f to f2b4d34 Compare August 16, 2026 09:09
@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Closing because current main (a93e31a9339) already implements this same-socket request/result transport stage and preserves its regression intent.

The extracted remote-runtime-subscription-request-channel.ts supports the optional subscription sender with a 32-request bound, serialization before capacity consumption, exact-ID routing, and rejecting/clearing all waiters on timeout or close. The subscription transport keeps its idempotent terminal transition; the outbound module shares aggregate memory with the 16 MiB/64-frame control queue and retains native claims until socket close. Unknown or duplicate nested response IDs still fail the subscription through the frame router.

browser-host-command-result-submission.ts validates the completed/failed result and acknowledgement runtime/schema on the lease connection; negotiated v1 without a sender is rejected. Main retains the added subscription request cases, lease handler/ack failure cases and duplicate-ack case, plus the real paired integration oracle checking the exact attach connection/device. Main now also bounds result settlement and supports reconnect. This earlier transport stage is redundant.

@OrcaWin OrcaWin closed this Oct 26, 2026
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.

2 participants