Skip to content

feat(browser): fence route pages to renderer owners - #14520

Closed
Jinwoo-H wants to merge 1 commit into
sta-4150-browser-webcontents-crash-fencingfrom
sta-4150-browser-page-owner-fencing
Closed

Jinwoo-H wants to merge 1 commit into
sta-4150-browser-webcontents-crash-fencingfrom
sta-4150-browser-page-owner-fencing

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​233 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​220
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​533 $\color{#cf222e}{\Huge{\mathbf{−}}}$​212 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​321

Summary

Adds the next inert STA-4150 authority layer on top of #14519:

  • binds every prepared logical page token to one exact main-observed renderer WebContents
  • rejects sibling-renderer claims and owner transfer while the page generation is active or retiring
  • retires prepared pages when their owning renderer exits, including before guest registration
  • epoch-fences pending and already-live prepare completions so owner loss cannot return a stale-success handle
  • allows an unrelated live waiter to admit one shared verified partition while rejecting stale waiters
  • bounds pending setup waiters to the existing 64-page partition budget
  • continues exact cross-partition retirement when policy cleanup throws

Causal evidence

The parent keyed prepared authority only by partition, page ID, and page-host generation. Deterministic tests were red because a sibling renderer received the same authority and renderer loss had no way to retire a prepared-but-unregistered page. Fresh review then reproduced three further failures: policy-cleanup exceptions aborted later partition retirement, an owner could die while proxy setup was pending and still receive authority afterward, and an already-live prepare could resolve successfully after its authority had been retired. The candidate makes the same oracles green through exact owner records, snapshot-first retirement, bounded pending admission, renderer epochs, and a final async-boundary liveness check.

Validation

  • 3 focused files / 132 tests
  • 56 main-browser files / 773 tests
  • full typecheck plus post-format node typecheck
  • native and type-aware code-quality audits
  • changed-code, reliability-manifest, max-lines, formatting, and diff checks
  • two fresh correctness and security/performance rereviews: no publication blockers
  • parent feat(browser): retire route pages on process loss #14519 CI fully green

Compatibility and rollout

No exchanged field, RPC, capability advertisement, persisted schema, renderer IPC, or production page-preparation/registration/grant caller changes in this PR. Existing local/server/offscreen browsers, old clients, SSH/WSL routes, folder workspaces, git worktrees, and headed/headless/browserless placement retain current behavior.

This remains deliberately inert and is not activation-ready. The future caller must derive renderer ownership and lifetime page generation from trusted main/runtime state; real Electron crash/reload and attach ordering remain unproven; worker, request, download, connection, storage, and network-service settlement remain outside this barrier; and never-settling setup or guest destruction can retain bounded capacity.

ELI5

The future local browser tab now gets a wristband tied to the exact Orca window that owns it. If that window dies while the tab is being prepared, the preparation cannot later wake up and claim success; tabs belonging to other live windows are left alone.

Visual Proof

N/A — this is an inert main-process authority contract with no rendered UI or production caller.

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

Stack: #14471
Parent: #14519

@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-owner-fencing branch from 5683c49 to abce9ee Compare August 14, 2026 20:02
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-owner-fencing branch from abce9ee to 0b4ec10 Compare August 14, 2026 20:14
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-owner-fencing branch 2 times, most recently from 6becc5c to 4178cc8 Compare August 14, 2026 23:17
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-owner-fencing branch from 4178cc8 to c10e1b9 Compare August 15, 2026 00:44
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-owner-fencing branch from c10e1b9 to a8308e7 Compare August 15, 2026 00:57
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-owner-fencing branch 2 times, most recently from 18fc471 to de8e63e Compare August 15, 2026 03:24
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-owner-fencing branch from de8e63e to 8922360 Compare August 15, 2026 08:53
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-owner-fencing branch from 8922360 to 03d798b Compare August 15, 2026 10:24
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-owner-fencing branch from 03d798b to 855fe94 Compare August 15, 2026 11:34
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-owner-fencing branch from 855fe94 to 064458c Compare August 15, 2026 12:30
@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Closing because this renderer-owned prepared-page authority stage is already implemented on main (a93e31a9339). I reviewed the proposed production patch, body, discussion, and added regression intent against the current modules.

Main retains the exact renderer owner in the prepared-page ledger, rejects sibling claims/owner transfer, retires prepared-but-unregistered pages, and fences asynchronous preparation by renderer epoch with a final liveness assertion. The renderer prepare-fence module is byte-identical to this proposal.

Pending setup remains bounded to the page budget; live sibling waiters can finish after stale owners are fenced; snapshot-first retirement continues across partitions even if policy cleanup fails. All 11 introduced test cases remain in the current suites.

Validation: the six current partition/session/WebContents/main-window suites passed 106 tests with ORCA_BACKGROUND_LAUNCH=1 and two workers. This establishes supersession of this stage; it does not assert all of STA-4150’s original cross-platform activation criteria are complete.

@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