Skip to content

feat(browser): preserve client host through reconnect grace - #14691

Closed
Jinwoo-H wants to merge 1 commit into
sta-4150-browser-client-page-inventoryfrom
sta-4150-browser-client-host-reconnect-grace
Closed

Jinwoo-H wants to merge 1 commit into
sta-4150-browser-client-page-inventoryfrom
sta-4150-browser-client-host-reconnect-grace

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1301 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1292
Prod 25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1485 $\color{#cf222e}{\Huge{\mathbf{−}}}$​333 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1152

Summary

  • preserve one exact client-host authority, dispatcher, page executor, and local SOCKS listener through a negotiated 15-second same-client reconnect grace
  • fence tunnel traffic and new route admission immediately while disconnected; restore only the same paired device, client identity, protocol set, and ordered capability set
  • replay unsettled commands after ready without rerunning completed mutations or double-charging result-settlement capacity

This is the next production-inert stage for STA-4150, stacked on #14648. It does not advertise client-host capabilities, select client placement, migrate server/offscreen pages, or change normal browser creation.

Compatibility

leaseReconnectProtocolVersion is optional and valid only beside the complete page-inventory negotiation. Old peers strip/omit it and keep immediate teardown plus existing server-hosted behavior. A reconnect requires an exact echo; missing, unsolicited, malformed, foreign-device, authority, capability, explicit-revocation, and grace-expiry paths fail closed. No stream opcode, minimum version, mobile framing, persistence schema, or server/offscreen placement semantics change.

The implementation remains platform-neutral and keeps native, SSH, WSL, folder-workspace, git-worktree, headed, headless, and browserless activation proof as explicit later gates.

Evidence

  • deterministic red/green replay-capacity oracle: two active results filled the settlement budget; replay previously double-charged and closed the preserved lease, now exact command tuples reuse one active admission
  • reconnect/control: 14 files, 151 tests passed
  • reconnect plus sandboxed-preload contract: 16 files, 167 tests passed
  • cross-version terminal wire: 5/5 passed
  • full Node/CLI/web typecheck passed
  • full lint, native/type-aware audits, 87 reliability gates, max-lines, localization, changed-code quality (0 findings across 179 files), formatting, and diff checks passed
  • production Electron/CLI/paired-web builds and the paired-Electron terminal-link control passed on the latest-main rebase; E2E requires electron-vite build --mode e2e
  • two fresh read-only reviews found no P0/P1 for this inert stage

Remaining before activation

Per-stream late teardown must not collapse the full tunnel, browser-host long-poll admission must remain fair across devices, fenced leases must retire placement capacity, main must own an unbypassable webview navigation grant, reconciliation actions must execute against runtime intent, and live Electron/network plus headed/headless/browserless and physical platform/provider matrices must pass.

@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-client-host-reconnect-grace branch 3 times, most recently from 69c7f09 to 9d76da4 Compare August 15, 2026 03:24
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-client-host-reconnect-grace branch 3 times, most recently from c7fa7d6 to f341731 Compare August 15, 2026 11:34
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-client-page-inventory branch from 92d11cc to a35d50b Compare August 15, 2026 12:30
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-client-host-reconnect-grace branch from f341731 to 65a2ee2 Compare August 15, 2026 12:30
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-client-page-inventory branch from a35d50b to a4b8825 Compare August 16, 2026 09:09
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-client-host-reconnect-grace branch from 65a2ee2 to a172987 Compare August 16, 2026 09:09
@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Closing because the reconnect-grace stage is already implemented on main (1a723194c32), including its replay-capacity fix.

I read the complete production patch, body and available discussion, compared the added regression intent, and traced the extracted current modules. Main retains negotiated 15-second same-client grace, paired-device/client authority checks, ordered capability matching, immediate tunnel fencing and blocked admission while disconnected, ready-before-replay ordering, and connection-token guards against stale cleanup. Dispatcher/page executor state and the local SOCKS listener survive an exact reconnect; explicit revocation, mismatched authority/protocols and grace expiry still terminate it. File-channel support is now deliberately renegotiated independently, without fencing hosted pages.

The result settler and jitter/backoff implementation are byte-identical to this branch. Exact command tuples reuse active settlement admission, while the dispatcher caches completed mutations; replay therefore neither executes a completed mutation twice nor double-charges the result budget. Route recovery still has eight-worker admission, a shared deadline, abortable retry delays and exact listener-address checks; current code extracts the retry loop and route-set command gate, and adds independent tunnel recovery and safer route retirement.

Validation: 8 focused current suites, 127 tests passed, covering host and route reconnect, repeated loss/stale callbacks, mutation replay, full result capacity, timeout/timer cleanup, registry admission and authenticated RPC ordering. The protocol/inventory suites were also checked in the #14648 comparison. No live Electron/network/platform matrix was rerun; this closure concerns the implemented stage, not a claim that the old activation checklist was independently completed. Relevant HEAD..origin/main changes do not alter these contracts.

@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