Skip to content

feat(browser): support evaluate timeouts for existing sessions#103181

Merged
steipete merged 2 commits into
openclaw:mainfrom
HOYALIM:codex/issue-103137-browser-evaluate-timeout
Jul 11, 2026
Merged

feat(browser): support evaluate timeouts for existing sessions#103181
steipete merged 2 commits into
openclaw:mainfrom
HOYALIM:codex/issue-103137-browser-evaluate-timeout

Conversation

@HOYALIM

@HOYALIM HOYALIM commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Chrome MCP existing-session profiles rejected timeoutMs on act:evaluate before the request reached the adapter, even though the adapter and MCP SDK support a per-request timeout.

This is an independent existing-session capability correction. It does not fix or close #103137, whose report uses the managed openclaw Playwright/CDP driver rather than Chrome MCP.

Why This Change Was Made

  • allow existing-session act:evaluate requests to carry timeoutMs through the Browser tool and /act route
  • preserve the existing timeout rejection for type, hover, scrollIntoView, drag, select, and fill
  • inject configured browser.actionTimeoutMs when an agent omits the evaluate timeout, keeping host and node-proxy transport budgets aligned
  • align the Browser tool description, CLI guide, Browser guide, troubleshooting guide, bundled automation skill, and changelog

The implementation uses the existing operation-budget path: evaluateChromeMcpScript forwards the resolved timeout to client.callTool(..., { timeout }). The official MCP TypeScript SDK client documentation defines this per-request override, and Chrome DevTools MCP's evaluate implementation awaits asynchronous evaluate functions.

User Impact

Users and agents can set a longer or shorter evaluate budget on user and custom existing-session profiles. Other unsupported per-action timeout overrides remain rejected, so this does not broaden unrelated Chrome MCP behavior.

Evidence

Sanitized AWS Crabbox, immutable contributor head bf8b7c09127849da6309d9696c110631a9817eb7, public networking, no Tailscale or hydrated credentials:

run_f4f1829bd4f9
extensions/browser/src/browser-tool.test.ts
extensions/browser/src/browser/routes/agent.act.existing-session-navigation-guard.test.ts
extensions/browser/src/browser/chrome-mcp.test.ts
extensions/browser/src/browser/client.test.ts
4 files, 165 tests passed

The focused route regression proves an explicit 60000ms budget reaches evaluateChromeMcpScript; the Browser tool regression proves configured actionTimeoutMs is injected for existing-session evaluate calls. Exact final-head tests, changed gates, live Gateway/OpenAI agent proof against a real Chrome MCP session, and CI evidence will be posted before merge.

AI-assisted

AI assistance was used to trace the full Browser tool, Gateway route, Chrome MCP adapter, MCP SDK contract, tests, documentation, and live validation path. Maintainer review corrected the original issue-closing relationship and expanded the public documentation before landing.

Signed-off-by: Ho Lim [email protected]

Copilot AI review requested due to automatic review settings July 10, 2026 00:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@harjothkhara

Copy link
Copy Markdown
Contributor

Source review note for #103137:

Best-fix verdict: this looks like the tightest fix for the reported browser evaluate --timeout-ms ... failure, not just a workaround. The CLI evaluate command already sends --timeout-ms into both the /act body and the outer gateway request budget (extensions/browser/src/cli/browser-cli-actions-input/register.form-wait-eval.ts, extensions/browser/src/cli/browser-cli-shared.ts). The existing-session /act route then normalizes that request timeout into existingSessionCallOptions and spreads it into Chrome MCP calls (extensions/browser/src/browser/routes/agent.act.ts), and Chrome MCP passes the timeout through the MCP client call options (extensions/browser/src/browser/chrome-mcp.ts). This PR removes the stale existing-session evaluate timeout rejection from the route/tool guidance path while keeping timeout rejection in place for actions that still do not support per-call timeout overrides.

The regression coverage is pointed at the right seam: explicit timeoutMs: 60000 now reaches evaluateChromeMcpScript, and default browser action timeouts get injected for existing-session act:evaluate so node/proxy routing does not fall back to the shorter outer request default. Latest PR checks are green, including Real behavior proof, check-lint, check-prod-types, check-test-types, and the compact Node shards.

Remaining gap: I did not run a Windows/Edge live repro here, so maintainer confidence still rests on the reporter repro plus the checked-in focused tests/CI. I did not find a source-level blocker.

@HOYALIM
HOYALIM force-pushed the codex/issue-103137-browser-evaluate-timeout branch 2 times, most recently from b9903e9 to bf8b7c0 Compare July 10, 2026 04:23
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jul 10, 2026
@clawsweeper

clawsweeper Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 53c67abb7ffccf1db0ed6f64d5007f580dad09e3, but the PR head is now 59ba6a717717ddbb1d1088cd92327a099a38c510. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (1 earlier review cycle)
  • reviewed 2026-07-10T08:12:46.048Z sha bf8b7c0 :: needs real behavior proof before merge. :: [P1] Do not close the managed-profile issue with this driver-only fix

@steipete steipete self-assigned this Jul 11, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime labels Jul 11, 2026
@steipete steipete changed the title fix(browser): honor evaluate timeout for existing sessions feat(browser): support evaluate timeouts for existing sessions Jul 11, 2026
@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jul 11, 2026
@steipete
steipete force-pushed the codex/issue-103137-browser-evaluate-timeout branch from 53c67ab to 59ba6a7 Compare July 11, 2026 22:12
@steipete

Copy link
Copy Markdown
Contributor

Land-ready verification on exact head 59ba6a717717ddbb1d1088cd92327a099a38c510:

  • Dependency contract: the MCP TypeScript SDK supports a per-request timeout, and Chrome DevTools MCP awaits async evaluate functions. I checked the official SDK client documentation and Chrome DevTools MCP evaluate source, plus the pinned SDK 1.29.0 types/runtime in this checkout.
  • Sanitized direct AWS Crabbox cbx_914c31a9d9f1 (crimson-shrimp-3843), public networking, no Tailscale, no instance role, no hydrated credentials:
    • run_a0cead680b75: Browser tool, existing-session route, Chrome MCP, client, and CLI evaluate suites; 5 files, 208 tests passed.
    • run_5d2368143e87: exact-head changed gate passed conflict-marker, attribution, dependency, format, extension prod/test typecheck, lint, database-first, sidecar-loader, and import-cycle checks.
  • Exact-head macOS build: pnpm build passed in 113.0 seconds.
  • Real user-path proof: started exact-head OpenClaw 2026.7.2 (59ba6a7) as a loopback Gateway, injected the OpenClaw service key without printing it, used OpenAI gpt-5.4, an isolated real Chrome CDP endpoint, and chrome-devtools-mcp@latest through the chrome-live existing-session profile. Private-network access was enabled only for that isolated loopback CDP endpoint; the Gateway logged the expected dangerous-config warning.
    • Agent call with a 1200 ms async evaluate and timeoutMs: 3000 returned SUCCESS_RESULT=PR103181_SUCCESS_7K9; four tool calls, zero failures.
    • The same 1200 ms evaluate with timeoutMs: 500 failed as timed out; one Browser call, one failure, no retry, and the impossible success nonce was not returned.
    • Timeout recovery correctly reset the Chrome MCP session. The old target handle became stale; after the agent refreshed action=tabs, the next 3000 ms evaluate returned RECOVERY_RESULT=PR103181_RECOVERED_Q4M; two Browser calls, zero failures.
  • Fresh whole-branch autoreview: clean, no accepted/actionable findings, correctness confidence 0.94.
  • Exact-head GitHub CI run 29170105297: relevant compact suites, prod/test types, lint, dependencies, docs, guards, SQLite boundaries, and Opengrep passed. Native scripts/pr prepare-run accepted the hosted exact-head evidence.

Security/functionality check: this does not enable evaluate, change profile authorization, weaken current-tab/navigation policy, or alter unrelated existing-session actions. It only removes the stale timeout rejection for evaluate and uses the adapter's existing SDK cancellation path. No mocks, managed-browser substitution, or test hooks were used in live proof.

Scope correction: this PR is independently proven for Chrome MCP existing-session profiles and no longer claims to close #103137, which reports the distinct managed openclaw Playwright/CDP path.

@steipete
steipete merged commit 8a4463e into openclaw:main Jul 11, 2026
93 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 12, 2026
…law#103181)

* fix(browser): honor evaluate timeout for existing sessions

Signed-off-by: Ho Lim <[email protected]>

* docs(browser): align existing-session evaluate timeouts

---------

Signed-off-by: Ho Lim <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: browser evaluate aborts at hardcoded ~15s on Windows/2026.6.11; --timeout-ms ignored

4 participants