A browser call that never settles holds the step until the watchdog redoes it from scratch #329

Closed
opened 2026-10-30 03:23:38 -04:00 by cmoriarty · 1 comment
Owner

What happens
Run 156 (Breakout item 2, vLLM), openspec.apply[all], about 70 minutes in. The agent sent playwright_browser_evaluate a polling script whose stop test compares elapsed time with an absolute timestamp (performance.now() - t0 > t0 + 22000). It never ends, so the call never settles. A running tool call counts as work, so the step sits silent: production reads "degraded: openspec.apply[all] has not moved in 468s". At the watchdog's 20-minute tool ceiling (TOOL_CALL_CEILING_S) it redoes the whole step from its entry checkpoint, losing an hour of good work for one hung call. Shell calls are bounded by idle_run (#219, #311); browser (MCP) calls are not.

Fix
Bound each MCP tool call, and playwright_browser_evaluate especially, by its own limit (a few minutes, or what the call names). On the limit, fail that call with a result that says why ("the script did not settle in N s; check its loop ends"), and the session goes on. Keep the step-wide redo for a session that is itself stuck.

Done when
An evaluate whose promise never settles comes back as a failed call within its limit, and the step carries on in the same session. A test or a simulated run covers it.

**What happens** Run 156 (Breakout item 2, vLLM), `openspec.apply[all]`, about 70 minutes in. The agent sent `playwright_browser_evaluate` a polling script whose stop test compares elapsed time with an absolute timestamp (`performance.now() - t0 > t0 + 22000`). It never ends, so the call never settles. A running tool call counts as work, so the step sits silent: production reads "degraded: openspec.apply[all] has not moved in 468s". At the watchdog's 20-minute tool ceiling (`TOOL_CALL_CEILING_S`) it redoes the whole step from its entry checkpoint, losing an hour of good work for one hung call. Shell calls are bounded by `idle_run` (#219, #311); browser (MCP) calls are not. **Fix** Bound each MCP tool call, and `playwright_browser_evaluate` especially, by its own limit (a few minutes, or what the call names). On the limit, fail that call with a result that says why ("the script did not settle in N s; check its loop ends"), and the session goes on. Keep the step-wide redo for a session that is itself stuck. **Done when** An evaluate whose promise never settles comes back as a failed call within its limit, and the step carries on in the same session. A test or a simulated run covers it.
Author
Owner

Shipped in PR #356 (c00c62f1, live on production).

  • The fix: the guard wraps each browser_evaluate so its function races a 180 s limit in the page. A promise that never settles fails that one call with "the script did not settle in 180 s; check its loop ends", and the session goes on.
  • Unchanged: functions, plain expressions, and element calls return as before. Checked in Chromium the way playwright-core's evaluate tool runs them, and in tests/agent/test_path_guard.py.
  • Not covered: a synchronous infinite loop still blocks the page's timers. The watchdog remains the backstop for that.
**Shipped** in PR #356 (c00c62f1, live on production). - **The fix:** the guard wraps each `browser_evaluate` so its function races a 180 s limit in the page. A promise that never settles fails that one call with "the script did not settle in 180 s; check its loop ends", and the session goes on. - **Unchanged:** functions, plain expressions, and element calls return as before. Checked in Chromium the way playwright-core's evaluate tool runs them, and in `tests/agent/test_path_guard.py`. - **Not covered:** a *synchronous* infinite loop still blocks the page's timers. The watchdog remains the backstop for that.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/braid#329
No description provided.