Skip to content

feat(browser): bound host tunnel memory - #14504

Closed
Jinwoo-H wants to merge 1 commit into
sta-4150-browser-tunnel-budgetsfrom
sta-4150-browser-host-memory-ledger
Closed

Jinwoo-H wants to merge 1 commit into
sta-4150-browser-tunnel-budgetsfrom
sta-4150-browser-host-memory-ledger

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​571 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​564
Prod 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​705 $\color{#cf222e}{\Huge{\mathbf{−}}}$​152 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​553

Summary

  • share a 32 MiB browser-host and 128 MiB desktop/runtime process memory ledger across application copies, encrypted WebSocket queues, and native buffered bytes
  • bound retained claims, socket sources, host records, and leases independently of byte size
  • keep native socket bytes charged through exact close and drain queued frames with an immediate four-frame cooperative quantum

Causal evidence

With aggregate enforcement replaced by a no-op scaffold on parent b32610e, the unchanged oracle failed all three initial assertions: browser-host totals, process totals, and claim/socket-source counts were independently unbounded. The candidate makes those assertions green and covers exact transfer/release across browser-facing writes, execution-host writes, encrypted queue settlement, native socket close, cleanup failure, stale callbacks, and repeated close.

Fresh review caught and the candidate fixes two additional causal failures before publication: a four-frame quantum incorrectly inherited the 25 ms backpressure poll, and WebSocket ownership was released while native buffered bytes could remain in CLOSING for up to the transport timeout.

Compatibility and activation

This is an inert STA-4150 layer stacked on #14495. It does not advertise a capability, register a production RPC method, add a shipped stream opcode, change existing server/offscreen placement, or depend on the merged #14402 implementation. Old clients and current server-hosted browsing remain unchanged.

Still blocked before activation: Node stream-internal high-water accounting; strict cross-route fairness and slow-link soak proof; reconnect/generation replacement and stream-ID recycling; relay E2EE negotiation; SSH/WSL adapters; browserless/headless behavior; SOCKS process isolation; mixed-version journeys; Electron proxy/no-fallback proof; Linux and physical Windows evidence.

Validation

  • 16 focused files / 123 tests
  • full runtime RPC suite / 1,349 passed, 1 skipped
  • full typecheck
  • native and type-aware code-quality audits
  • reliability manifest and max-lines ratchet
  • git diff check
  • two fresh read-only correctness/security/performance reviews

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

@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch from a089829 to 49ff738 Compare August 14, 2026 09:14
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch from 49ff738 to e06ddfd Compare August 14, 2026 10:18
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch from e06ddfd to cbac92a Compare August 14, 2026 20:02
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch from cbac92a to 81bc6ba Compare August 14, 2026 20:14
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch 2 times, most recently from 2c469b6 to 2eab4ec Compare August 14, 2026 23:17
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch from 2eab4ec to a9ad2ea Compare August 15, 2026 00:44
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch 2 times, most recently from 72e98e4 to 7a025d8 Compare August 15, 2026 02:57
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch from 7a025d8 to 6bf06c1 Compare August 15, 2026 03:24
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch from 6bf06c1 to 7d991f3 Compare August 15, 2026 08:53
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch 2 times, most recently from 48d035f to a7c9cc0 Compare August 15, 2026 11:34
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-memory-ledger branch from a7c9cc0 to 0282e29 Compare August 15, 2026 12:30
@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Closing because the aggregate-memory stage is already implemented on main (a93e31a9339). I compared the complete 22-file scope, including the transport/RPC cleanup and regression intent.

browser-network-tunnel-outbound-memory-budget.ts is byte-for-byte identical, as are the new registry, client-memory and session-aggregate-memory test files. The 32 MiB host / 128 MiB process ledger and independent claim/socket/host/lease bounds therefore already exist. Client source/receive/retirement code and the session resource budget carry the application claims through exact settlement and release. The current route/transport and runtime tunnel RPC acquire and release the matching lease and inject it into those paths.

The extracted remote-runtime-subscription-outbound.ts retains native-buffer charges until the exact socket closes, separately releases JavaScript queues, and applies the same aggregate admission. The outbound queue retains prospective versus already-retained checks and zero-delay continuation after its configured quantum; browser transport still selects four frames. The introduced RPC failure-cleanup, route admission, encrypted/native-buffer, and FIFO/quantum regression cases are retained. This draft’s boundedness work is redundant; this is not a claim that the later live-topology acceptance gaps are all resolved.

@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