Skip to content

[Feature] Give agents control over JS dialogs (confirm/prompt/beforeunload): dismiss/text/status instead of forced auto-accept #359

Description

@Wraient

What I found

bsk 0.3.1 (daemon protocol 1.3, extension 0.3.1, Chrome 153, Linux) silently
auto-accepts every JavaScript dialog and gives the agent no way to do
anything else. There is no dialog command, no accept/dismiss/status
subcommand, and the words dialog/alert/beforeunload appear zero times in
SKILL.md, so agents can't even discover the behavior.

Repro (all on https://example.com, fresh Agent Window session):

bsk evaluate --session <id> "alert('x')"
# null
# dialog: type=alert handled=accepted message=x        <- auto-OK, reported. Fine.

bsk evaluate --session <id> "confirm('proceed with delete?')"
# true
# dialog: type=confirm handled=accepted ...            <- agent CANNOT cancel.

bsk evaluate --session <id> "prompt('your name?','anonymous')"
# anonymous
# dialog: type=prompt handled=accepted ...             <- agent CANNOT type or cancel.

bsk evaluate --session <id> "window.onbeforeunload = () => true; 1"
bsk navigate --session <id> "https://www.iana.org/"    # needs prior user gesture or Chrome suppresses it
# dialog: type=beforeunload handled=accepted ...       <- "Leave" forced, "Stay" impossible.

Credit where due: the dialog: type=… handled=… message=… report lines are
good — the agent at least learns what happened after the fact.

Why this matters

One confirm("Delete all 200 rows?") on a hostile or sloppy page auto-returns
true and the agent marches on believing the user said yes. Any flow that
needs typed prompt() input or a beforeunload "Stay" is simply unusable —
there is no control surface at all, only the post-hoc report. Forced accept is
safer than a hang, but for confirm/prompt it trades a stall for a wrong
answer, which is worse for destructive actions.

What good looks like elsewhere

  • vercel-labs/agent-browser: dialog accept/dismiss [text],
    dialog status, and auto-dismiss limited to alert+beforeunload
    (the two types with no real decision); confirm/prompt stay pending for
    an explicit agent decision, every response carries the pending dialog as a
    warning, --no-auto-dialog opts out (PR #1075 there).
  • browser-use harness: exposes CDP Page.handleJavaScriptDialog
    (accept + promptText) and documents reactive (CDP) vs proactive (JS
    stub) handling, including the beforeunload navigate-then-dismiss recipe.

Proposal

  1. bsk dialog accept [text] | bsk dialog dismiss [--session …] and
    bsk dialog status (pending type/message/url), wired to the same
    interception that already produces the dialog: lines.
  2. Limit auto-accept to alert (+beforeunload with an opt-out flag);
    leave confirm/prompt pending for an explicit decision instead of
    answering for the agent.
  3. Document the dialog: report lines and the new commands in SKILL.md
    (currently zero mentions of dialog/alert/beforeunload).

Happy to re-test any build that adds this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions