You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: browser_resume hangs indefinitely when no subsequent breakpoint exists #41304
I provided exact source code that allows reproducing the issue locally.
Steps
Start Playwright with --debug=cli and connect an MCP client
A script pauses via page.pause() or requestPause()
Call browser_resume (no step or location params)
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.
Sebastien Tardif (@SebTardif) Unfortunately, this does not really explain the usecase. Why is MCP agent pausing the script? Where did the first page.pause() come from? Why does the agent need to let the script finish? If this is a debugging session, it's often better to stop the script rather than let it finish. Please be more specific.
Why is MCP agent pausing the script? Where did the first page.pause() come from?
From the developer's test code. The developer adds await page.pause() at a point they want to inspect, then runs with --debug=cli so an MCP client can examine the paused state.
Why does the agent need to let the script finish? If this is a debugging session, it's often better to stop the script rather than let it finish.
The test typically has assertions after the pause point. For example:
test('checkout flow',async({ page })=>{awaitpage.goto('/cart');awaitpage.pause();// inspect cart state hereawaitpage.click('#checkout');awaitexpect(page.locator('.confirmation')).toBeVisible();});
After inspecting the cart at the breakpoint, the agent calls browser_resume so the test can finish and report pass/fail. Stopping the script means the test runner never reports a result for the assertions that follow.
Stopping works when you only care about inspection. But when the developer wants to verify the rest of the test passes after a known state, resume-to-completion is the natural flow. The current browser_resume (plain, no step/location) assumes another breakpoint will always follow. When one doesn't, it hangs instead of returning.
Sebastien Tardif (@SebTardif) Thank you for the explanation. It seems like we can make browser_resume return when context closes, and it will fix your usecase. WDYT?
Dmitry Gozman (@dgozman) Agreed, that is cleaner. I updated the PR to always wait for either the next pause or context close, instead of conditionally skipping the wait. This also handles unexpected context teardown.
Activity
dgozman commentedon Jun 15, 2026
Sebastien Tardif (@SebTardif) Unfortunately, this does not really explain the usecase. Why is MCP agent pausing the script? Where did the first
page.pause()come from? Why does the agent need to let the script finish? If this is a debugging session, it's often better to stop the script rather than let it finish. Please be more specific.SebTardif commentedon Jun 15, 2026
Dmitry Gozman (@dgozman)
From the developer's test code. The developer adds
await page.pause()at a point they want to inspect, then runs with--debug=cliso an MCP client can examine the paused state.The test typically has assertions after the pause point. For example:
After inspecting the cart at the breakpoint, the agent calls
browser_resumeso the test can finish and report pass/fail. Stopping the script means the test runner never reports a result for the assertions that follow.Stopping works when you only care about inspection. But when the developer wants to verify the rest of the test passes after a known state, resume-to-completion is the natural flow. The current
browser_resume(plain, nostep/location) assumes another breakpoint will always follow. When one doesn't, it hangs instead of returning.dgozman commentedon Jun 16, 2026
Sebastien Tardif (@SebTardif) Thank you for the explanation. It seems like we can make
browser_resumereturn when context closes, and it will fix your usecase. WDYT?SebTardif commentedon Jun 16, 2026
Dmitry Gozman (@dgozman) Agreed, that is cleaner. I updated the PR to always wait for either the next pause or context close, instead of conditionally skipping the wait. This also handles unexpected context teardown.
#41293