Skip to content

fix(mcp): only wait for next pause in browser_resume when step or location is set#41293

Open
SebTardif wants to merge 1 commit into
microsoft:mainfrom
SebTardif:fix-browser-resume-hang
Open

fix(mcp): only wait for next pause in browser_resume when step or location is set#41293
SebTardif wants to merge 1 commit into
microsoft:mainfrom
SebTardif:fix-browser-resume-hang

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

Summary

  • browser_resume unconditionally awaited a promise that only resolved when the debugger paused again. For a plain resume (no step or location), if execution completed without another breakpoint, the tool hung indefinitely.
  • Only create and await the pause promise when step or location is set.

Introduced in #39717

…ation is set

browser_resume unconditionally awaited a pausedPromise that only
resolved when the debugger paused again. For a plain resume (no step
or location), if execution completed without hitting another breakpoint,
the promise never resolved and the tool hung indefinitely.

Only create and await the pausedPromise when params.step or
params.location is set, since those are the only cases where
waiting for re-pause is expected.

Introduced in microsoft#39717 (2026-03-17).
@dgozman

dgozman commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

@SebTardif Could you please file an issue first? I wonder what's the usecase for this? Currently, calling browser_resume will wait for the next await page.pause() call in the script, and your PR is changing that.

@SebTardif

Copy link
Copy Markdown
Contributor Author

Filed #41304.

The use case is an MCP agent that pauses a script (via page.pause() or requestPause()), inspects the paused state, then calls browser_resume to let the script finish. The agent does not know whether another page.pause() exists downstream. If execution completes without one, browser_resume hangs indefinitely because the pausedstatechanged promise never resolves.

The fix makes the wait conditional: when step or location is set, we expect a subsequent pause (stepping or a set breakpoint), so waiting is correct. A plain resume has no such expectation, so it should return once the debugger resumes.

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.

2 participants