Skip to content

Own browser service M2: dialogs, downloads, file chooser, clipboard, logs, viewport, raw CDP (#113) - #126

Merged
SSFSKIM merged 21 commits into
mainfrom
feat/own-browser-service-m2
Oct 14, 2026
Merged

SSFSKIM merged 21 commits into
mainfrom
feat/own-browser-service-m2

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 14, 2026

Copy link
Copy Markdown
Owner

M2 of the own browser service (#113, child 1 of #114): JS dialog answering, downloads, the file chooser, the clipboard page bridge, console logs, viewport/visibility/management, raw CDP and cua_move. Spec: docs/doperpowers/specs/2026-10-13-own-browser-service-design.md (Plan of Work M2; execution rulings in its Decision Log and Surprises dated 2026-10-14). The default stays vendor.

What changed

  • dialogs.mjs: tab_get_js_dialog, tab_handle_js_dialog over M1a's tracking (the vendor's refusals and sentences; the answer goes to the dialog's own frame; 60 s close wait). M1a's dialog_open expected difference is now exercised end to end.
  • downloads.mjs: Fetch interception of document responses on every attached tab (vendor parity) with bounded release recovery (retry, then Fetch.disable + re-arm, detach as fallback); playwright_wait_for_download (120 s), playwright_download_path, download_media's result; each download-started notification owned by one wait (fixes the vendor's same-URL defect); request-stage pauses released only when the service's own; nothing logs file contents, full URLs, paths or bookmarks.
  • chooser.mjs: interception armed per wait (3 s default, 120 s max), disarmed even when a dialog blocks the cleanup (deferred until it closes), DOM.setFileInputFiles; OOPIF choosers unsupported with the vendor's sentence.
  • clipboard-bridge.mjs and tab_clipboard_* over the virtual clipboard; devlogs.mjs (tab_dev_logs); viewport.mjs (viewport, visibility, management through the host's executeUnhandledCommand); rawcdp.mjs (tab_cdp_* only when the backend announces cdp, a supplied target validated as the vendor's); cua_move.
  • Parity corpus: a case for every M2 row through the real client; pins for both consequences of the document-response pause (a bare goto to a downloadable type fails with BlockedByClient; a response paused while a dialog is open stays paused until detach — a vendor gap); downloads/two-tabs as a departure in cua's favour; a host-trace test proving each Fetch.requestPaused and release is recorded for M5's attribution.

Validation Evidence

  • At a0e50be (re-run by the executor session): HOME=/tmp/cua-scratch-home npm test → # pass 1581, # fail 0, # skipped 8; npm run test:mods → 32 pass; claude plugin validate . → ✔ Validation passed with warnings (the known warning).
  • Live on the mini (profile ssfs), docs/evidence/2026-10-13-own-browser-service-parity/m2-diff.txt:
    • fresh whole-corpus vendor-m2-1 (56/56 cases ok) vs cua-m2-2 over every landed milestone's cases → 0 unexpected differences (51 cases, 139 cells, 12 expected)
    • the full 56 cases → 5 unexpected differences (56 cases, 144 cells, 12 expected): exactly the M3 cases cua does not serve yet (export rejections, history)
    • downloads/two-tabs → 0 unexpected differences (1 cases, 2 cells, 1 expected) (vendor: one download reaches both waits; cua: two)
    • acceptance 4 at client level: getJsDialog reports the alert, a locator action fails with dialog_open, handleJsDialog clears it; a download resolves to a file under Chrome's download directory; a file input accepts setFiles.
  • Reviews: two task reviews (sol) clean after fix waves; whole-branch doperpowers:reviewer-high: two P2 (raw callers' request-stage pauses consumed by the service; a failed media-interceptor removal not recovered), fixed in a0e50be; final verdict "correct", no material findings.

Residue

  • none

dialogs.mjs answers the controller's tracked dialog (tab_get_js_dialog, tab_handle_js_dialog: Page.handleJavaScriptDialog
in the dialog's frame, settled on javascriptDialogClosed within 60 s). downloads.mjs ports yf and Mf: every attached
tab's document responses are paused and released, an unawaited download is failed, playwright_wait_for_download lets
the next one through and answers on the host's onDownloadChange (120 s), playwright_download_path answers Chrome's
filename, and playwright_locator_download_media's locator half now runs over it. chooser.mjs ports ZO and FO
(interception armed within 3 s by default / 120 s max, DOM.setFileInputFiles, OOPIF choosers refused, the file-access
sentence naming the cua extension). The inventory's M2 gate turns on with task 2's devlogs.mjs.
…se, document-response interception as the vendor's)
…-proof chooser disarm, media setup on the command's deadline, one download per wait

A document-response release the service makes on its own is sent again when Chrome refuses it, and when it cannot land
the tab's Fetch domain is disabled (Chrome lets paused requests go, probed on headless Chromium) and set up again, or
the tab detached; a caller's release (the download wait's) leaves the response to the caller's cleanup. The chooser's
disarm, refused while a dialog is open (Chrome answers it only after the dialog closes, probed), goes out when the
dialog closes, never while another wait in the tab is armed, and a refused disarm detaches the tab. The media
download's interceptor setup carries the command's deadline. Each download-started notification is owned by the
earliest waiting match, so two tabs downloading one URL get their own downloads.
…m interception detaches the tab

After a successful Fetch.disable, a failure to set document interception up again or to restore the media download's
request stage is a failed recovery: the tab is detached, so its next attachment installs interception afresh rather
than staying attached with Fetch off.
…nsole logs, backend capability commands, raw CDP gate, cua_move; corpus cases for the document-response pause and the page clipboard
…the host; the blocked navigation's sentence masks its tab id
…he REPL client delivers it (Error: prefix, waiting-on line); the whole-corpus vendor-m2-1 and first cua-m2-1 runs
…ead, 0 unexpected differences across every landed milestone's cases (m2-diff.txt)
…cted difference (download ownership, a departure in cua's favour), m2-diff.txt
…one non-empty session_id or target_id, refused before the call's policy is chosen
…n the service's own, a failed interceptor removal recovered

A request-stage pause is the service's while its request stage is wanted, configured, or of unknown state (a Fetch.enable
changing it sent without an answer); any other is a raw CDP caller's and is left to it. Removing a media download's
interceptor is sent again on failure within its cleanup budget, then recovered as a release is (Fetch.disable and
re-arm, the tab detached as the fallback); a reconfiguration of unknown outcome is always sent again. A failed setup
undoes itself on its own budget without holding the caller past its deadline.
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