Files
yetone 44b762d505 browser: Cancel on Chrome's bar stops typing that outlived its call
3379ebc42 lets browser_type answer while a long text is still being typed,
and kept the tab attached by calling attach() every 10s. A user who pressed
Cancel on Chrome's "is debugging this browser" bar to stop the agent could
have it put back: when the 10s tick landed in a pause between keys, attach()
re-attached the debugger, cleared stoppedByUser, and the typing went on
into the page against the user's stop.

- cdp.js hold() keeps an attachment on (puts off the let-go) and never
  attaches again; a tab let go or stopped by the user stays so. The typing
  job's timer calls it instead of attach().
- human.type stops before the next key once the user stopped the tab.
- ready() reports USER_STOPPED before a typing failure the stop caused,
  and browser_dialog, which attached without ready(), says it too instead
  of attaching again.
- Extension 0.1.9.

Run (mote, at this tree on 3379ebc42):
- go test ./internal/browserext/: ok. TestCancelStopsTypingThatOutlivedItsCall
  drives cdp.js and human.js in node with a stub chrome.debugger.
- Broken by hand: hold() calling attach() again → red "hold went on after
  the user's Cancel"; without human.type's check → red "the typing went on
  with the stop set: finished".
- MAGPIE_BROWSER_CHROME=Chromium 1248, go test -run TestBrowser
  ./internal/gateway/: ok (202s).
- gofmt -l, go vet ./internal/browserext/: clean.

Not tried: pressing Cancel on the real bar in a headful Chrome (the bar
can't be clicked from a test).
2026-11-08 06:10:40 +08:00
..