Skip to content

feat(browser): negotiate page reconciliation commands - #14759

Closed
Jinwoo-H wants to merge 1 commit into
sta-4150-browser-page-reconciliation-executionfrom
sta-4150-browser-reconciliation-command-contracts
Closed

Jinwoo-H wants to merge 1 commit into
sta-4150-browser-page-reconciliation-executionfrom
sta-4150-browser-reconciliation-command-contracts

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​663 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​663
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​247 $\color{#cf222e}{\Huge{\mathbf{−}}}$​15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​232

ELI5

After a client or runtime restart, Orca needs to tell the Electron desktop to keep, close, or rebuild exact browser pages. This PR adds a separate handshake key for those recovery instructions: unless both sides explicitly agree to the key, the server is unable to send them.

What Changed

  • Add optional page-reconciliation v1 negotiation to browser-host attach, ready, lease, reconnect, and command-result authority.
  • Add bounded reclaimPage, closePage, and restorePage command contracts with exact prior page authority.
  • Reject unsolicited/inconsistent echoes, reconnect negotiation changes, stale result authority, and reconciliation commands on legacy page-command leases.
  • Keep the production PairedRuntimeBrowserClientHost composition from advertising the new subprotocol; this stage activates no page mutation or placement behavior.
  • Register the mixed-version and fail-closed contracts in the existing browser-network reliability gate.

Why

The current page-command v1 stream knows only createPage and navigate. Sending new recovery variants through that unnegotiated stream would break old decoders. A separate exact attach/ready echo lets old servers strip the optional field, lets new clients safely fall back when the echo is absent, and prevents new servers from publishing new command content to old clients.

Linked Issue

STA-4150

Visual Proof

N/A — this is a production-inert shared/main-process protocol contract with no UI or activated browser behavior.

Testing

  • 6 focused files / 58 tests
  • 21 affected host lease, reconnect, command, reconciliation, and RPC files / 219 tests
  • mixed-version terminal wire: 5/5
  • pnpm typecheck
  • pnpm lint
  • pnpm check:code-quality:changed
  • reliability manifest (87 gates), max-lines, formatting, localization, and skill manifests
  • all 36 stack patches rebased onto origin/main@931cb037c5 and byte-equivalent by git range-diff before the ledger-only rebase record

Platforms reviewed: macOS local test host; pure TypeScript contracts have no path, shell, native-module, UI, or platform branch. Windows/Linux packaging and SSH/WSL live topology remain later activation gates.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

No actionable security, cross-platform, SSH/remote, mobile, backwards-compatibility, performance, or resource issue found. Old peers strip or omit the optional field; new command variants require exact negotiation; current production composition does not advertise them. No dependency, persisted state, network sink, retry loop, timer, cache, server/offscreen placement, or mobile-facing contract changed.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, affected tests, and local gates pass; CI covers full test/build

Author

  • X / Twitter: @your_handle

@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-reconciliation-command-contracts branch from 8db8f11 to 08eaae6 Compare August 15, 2026 10:26
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-reconciliation-execution branch from bfe20d5 to 8acc22a Compare August 15, 2026 11:34
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-reconciliation-command-contracts branch from 08eaae6 to 3f9faf6 Compare August 15, 2026 11:34
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-reconciliation-execution branch from 8acc22a to 450e56e Compare August 15, 2026 12:30
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-reconciliation-command-contracts branch from 3f9faf6 to 284f563 Compare August 15, 2026 12:30
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-reconciliation-command-contracts branch from 284f563 to 854ac8a Compare August 16, 2026 09:09
@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Closing this inert protocol stage because its complete negotiation/admission contract is already on current origin/main (1a723194c32).

The attach builder and runtime attachment require command plus complete inventory before reconciliation; the ready receiver checks exact optional echoes and reconnect preserves the protocol set. Shared browser-client-host-protocol.ts retains the bounded reclaim/close/restore variants, prior authority, older-epoch reclaim check and legacy create/navigate behavior. Command/result authority checks still include the reconciliation version, and runtime/browser-host/browser-host-page-command-admission.ts rejects reconciliation on legacy leases while requiring execution-host grants for create/reclaim/restore. These were compared with all production changes here, including the extracted ledger authority check.

The current negotiation, shared-protocol, registry and authenticated RPC suites passed 34 tests across four files. Current tests retain the fail-closed negotiation and result-authority oracles; the legacy create/navigate test is now parameterized. Optional schema fields still preserve the older decoder behavior.

This closes the already-retained protocol stage; it does not claim the wider browser placement/platform activation matrix is 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