Skip to content

Own browser service M1a: service skeleton, CDP controller, the switch and trust root (#113) - #122

Merged
SSFSKIM merged 25 commits into
mainfrom
feat/own-browser-service-m1a
Oct 13, 2026
Merged

SSFSKIM merged 25 commits into
mainfrom
feat/own-browser-service-m1a

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

M1a of the own browser service (#113, child 1 of #114): the service skeleton behind the switch. Spec: docs/doperpowers/specs/2026-10-13-own-browser-service-design.md (Plan of Work M1a; execution rulings in its Decision Log and Surprises dated 2026-10-13). The default stays vendor; nothing changes for users who do not set CUA_BROWSER_SERVICE=cua.

What changed

  • src/browser-service/ (ported from the readable vendor tree, provenance headers on every ported file): errors.mjs (BrowserServiceError, KEPT_REASONS, the vendor's sentences), budgets.mjs (clamp to 120 s, Deadline), backend.mjs (framed JSON-RPC over nativePipe, the session API, turn-ended tracker, discovery; refuses a backend announcing agentRequestHeaderEnabled), cdp.mjs (port of the vendor's CDP controller: attach, one-retry reattach, OOPIF routing, event queue, dialog tracking and blocking; the command's deadline enforced on every dispatch and after it), index.mjs (handleRpc with setup/execute/executeWithRecovery per the spec's REPL contract, COMMAND_HANDLERS), manifest, tabs, browsers, session, navigation, documentation with the cua browser service 0.1.0 marker, VERSION.
  • The switch: CUA_BROWSER_SERVICE=cua|vendor (default vendor; invalid values fail invalid_browser_service); src/runtime/launch.mjs adds exactly the real path of src/browser-service to the trusted code paths when cua is selected; src/services/browser.mjs loads the selected module, pins both versions (vendor 0.1.1, cua 0.1.0) and fails closed before any secret is read; rejectionKind classifies BrowserServiceError by kept code.
  • Parity: inventory M1a rows pass with the handler gate; diff --scenarios; expected-differences.json with its first entry (dialog_open); the corpus's cua-side oracles assert the plain Error and the sentence, because only error.message crosses node_repl's RPC boundary; parity cases open tabs with tabs.new + goto until M1b serves createBrowserTab's snapshot.
  • README: the CUA_BROWSER_SERVICE configuration row.

Validation Evidence

  • HOME=/tmp/cua-scratch-home npm test at aad5235: # pass 1303, # fail 0, # skipped 37 (one of three runs; see Unresolved Review Findings for the two pre-existing flakes in the other two).
  • npm run test:mods → 32 pass, 0 fail; claude plugin validate . → ✔ Validation passed with warnings (the known CLAUDE.md warning).
  • Real-client error proof (test/browser-service/real-client.test.mjs, the installed bundled client through the wrapper and node_repl's RPC boundary: dialog_open, unsupported_command, tab_not_found, the locator timeout and strict-mode sentence paths): 4/4, three runs in a row (skips visibly under a scratch HOME without the installed runtime).
  • Live M1a parity on the mini (profile ssfs, parity clone): node scripts/browser-parity.mjs diff docs/evidence/2026-10-13-own-browser-service-parity/vendor-1 <cua run> --scenarios <M1a> → 0 unexpected differences (6 cases, 30 cells); a vendor control run diffs to 0 for the tab-setup change. Evidence docs/evidence/2026-10-13-own-browser-service-parity/m1a-diff.txt. The live run was taken at 4b88013; the later commits change only non-M1a oracles (679a251), the documentation-gate order (3f93fbd) and the post-dispatch deadline (aad5235, timeout paths only), so it was not re-run.
  • Reviews: two task reviews (sol) clean after fix waves; whole-branch doperpowers:reviewer-high: one P2 (the deadline was not enforced after dispatch because the host awaits debugger.detach), fixed in aad5235; re-review "correct", no material findings.

Unresolved Review Findings

  • Pre-existing full-suite flakes, not in M1a's files: across three full runs at aad5235, test/extension-host.test.mjs "commands in flight when the user cancels debugging or closes the tab fail with Chrome's 'Detached while handling command.'" failed once (ECONNREFUSED on the fake socket) and test/mcp-upstream.test.mjs "owned descendants left in the process group after the runtime exits are reaped" failed once; both files pass 5/5 in isolation. Left because they predate this branch and look load-timing related; listed under Residue.

Residue

  • Two load-sensitive tests in the full suite (test/extension-host.test.mjs "commands in flight when the user cancels debugging…", test/mcp-upstream.test.mjs "owned descendants … are reaped") each failed once in three full runs and pass in isolation; worth a ticket to harden their timing so every milestone's gate is deterministic.

… vendor's sentences, the lifted clamp, Deadline)
…nativePipe, the session API, the turn-ended tracker, discovery)
…retry reattach, frame routing, events and the raw queue, dialog tracking and blocking)
…dline through the tab's attachment and document reads, and rechecks an open dialog just before dispatch
… timed out a setup command its starter's deadline bounded
…cuteWithRecovery over COMMAND_HANDLERS; manifest, documentation, browser selection, tabs, navigation, the per-backend session)
…root for src/browser-service, the two-pin version guard and the service's rejection classification
…EPL client through the wrapper and node_repl's RPC boundary: dialog_open, unsupported_command, tab_not_found, and the locator timeout and strict-mode sentences' path)
… a milestone's subset; the first expected difference (dialog_open)
…owserTab's snapshot read is served only from M1b; reads/snapshot covers it)
…a against vendor-1: 0 unexpected differences; the vendor control run for the new case setup)
…nce (a service error's code never reaches the kernel); README says so
…ported_command before the required-documentation check
…il its deadline (or its timeoutMs and a grace); an abandoned request is dropped, never re-sent
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.

1 participant