Skip to content

feat(browser): bound host admission - #14493

Closed
Jinwoo-H wants to merge 1 commit into
sta-4150-browser-host-leasesfrom
sta-4150-browser-host-admission
Closed

Jinwoo-H wants to merge 1 commit into
sta-4150-browser-host-leasesfrom
sta-4150-browser-host-admission

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​243 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​243
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​89 $\color{#cf222e}{\Huge{\mathbf{−}}}$​18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71

Summary

  • cap one browser-host identity per authenticated connection and four per paired device, with exact release restoring capacity
  • meter permanent browser-host subscriptions under a dedicated 25% long-poll sub-cap so terminal/orchestration waits retain capacity
  • replace per-page generation tombstones with one global monotonic generation
  • make placement retirement token-safe so delayed cleanup cannot delete a newer client generation or server placement

This is the fourth inert layer for STA-4150, stacked on #14484. Production RPC registration and capability advertisement remain disabled.

Causal evidence

On the parent branch, one unchanged oracle failed three ways: a second identity on one connection was admitted, a fifth identity for one paired device was admitted, and closed page placement had no retirement API. Those cases are now bounded and exact.

Fresh review then found two additional lifecycle failures before publication: delayed cleanup could erase a replacement placement, and four devices could occupy all 16 shared long-poll slots. Retirement now requires the exact placement object, and a real injected WebSocket test proves host saturation still admits an ordinary wait and socket close aborts/releases both classes.

Validation

  • 11 focused files / 67 tests
  • 15 unique tunnel/lease/runtime files / 92 tests
  • full runtime RPC suite / 90 tests
  • cross-version terminal wire / 5 tests
  • pnpm typecheck
  • native and type-aware code-quality audits
  • reliability-gate manifest and max-lines ratchet
  • fresh correctness rereview: no remaining findings

Deliberately deferred before activation

  • pending tunnel-open/rate admission and aggregate route/host/process byte ledgers
  • wiring token-safe placement retirement into the future production page lifecycle
  • drain-aware stream fairness and SOCKS local-process trust decision
  • SSH/WSL/Linux/physical-Windows and old/new-peer journeys
  • Electron partition proxy/no-fallback proof and UI activation

@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch from 392d13b to 0ee9f17 Compare August 14, 2026 08:48
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch 2 times, most recently from 663c5b2 to 3e6d13b Compare August 14, 2026 10:18
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch from 3e6d13b to 7c6461b Compare August 14, 2026 20:02
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch from 7c6461b to 71fbd53 Compare August 14, 2026 20:14
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch from 71fbd53 to 0f85ac8 Compare August 14, 2026 21:00
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch from 0f85ac8 to 2a4d17a Compare August 14, 2026 23:17
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch from 2a4d17a to db76b08 Compare August 15, 2026 00:44
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch from db76b08 to 93ef582 Compare August 15, 2026 00:57
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch 2 times, most recently from c62b8ab to 6c2d4d0 Compare August 15, 2026 03:24
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch from 6c2d4d0 to 4acfe57 Compare August 15, 2026 08:53
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch from 4acfe57 to eea72e1 Compare August 15, 2026 10:24
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-host-admission branch 2 times, most recently from 46f19d3 to e8da24a Compare August 15, 2026 12:30
@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Closing because the admission and retirement safeguards in this complete six-file patch are already implemented, with newer ownership refinements, on main (a93e31a9339).

browser-host/browser-host-lease-records.ts enforces one host per connection and four per paired device, excluding the exact replacement from counting. The current lease/RPC tests retain the introduced limits, release-restores-capacity, other-device fairness, generation-reuse, and stale-cleanup cases. Page placement uses a global monotonic counter without per-page tombstones; exact two-phase retirement has superseded the single-step delete here.

Runtime long-poll admission still classifies browser-host attaches separately, aborts/releases on disconnect, and reserves capacity for ordinary waits. Main has intentionally advanced from this draft’s single 25% host budget to a 50% global host budget with a per-device half-share and a combined 75% ask+host ceiling, preserving the wait reservation while allowing two devices. runtime-rpc-browser-host-admission.test.ts retains the original disconnect/reservation oracle and adds the two-device case. Reapplying the earlier metering stage would regress that newer fairness policy.

@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