Skip to content

[Bug]: browser_resume hangs indefinitely when no subsequent breakpoint exists #41304

Description

@SebTardif

System info

Source code

  • I provided exact source code that allows reproducing the issue locally.

Steps

  1. Start Playwright with --debug=cli and connect an MCP client
  2. A script pauses via page.pause() or requestPause()
  3. Call browser_resume (no step or location params)
  4. The script completes without hitting another page.pause()

Expected behavior

browser_resume should return once the debugger resumes execution.

Actual behavior

browser_resume hangs indefinitely. The handler unconditionally creates a promise waiting for the next pausedstatechanged event, but if execution completes without another breakpoint, pausedstatechanged never fires and the promise never resolves.

The hang is specific to a plain resume (no step or location). When step is set, it makes sense to wait for the next pause. When location is set, the handler sets a breakpoint, so a pause event is expected. A plain resume has no such expectation.

Use case

An MCP agent inspects the paused state (variables, DOM), then calls browser_resume to let the script finish. The agent does not know whether another page.pause() exists downstream. If the script completes normally, the agent is stuck.

This is the natural MCP workflow: pause, inspect, resume. The resume tool should not require the caller to predict whether the script will pause again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions