Skip to content

fix(browser): honor explicit snapshot timeout - #124575

Merged
steipete merged 1 commit into
openclaw:mainfrom
Leon-SK668:fix/browser-cli-snapshot-timeout
Aug 26, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
Leon-SK668:fix/browser-cli-snapshot-timeout

Conversation

@Leon-SK668

@Leon-SK668 Leon-SK668 commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Partially addresses #124521: restores the explicit CLI timeout override; the default-timeout decision and release follow-through remain out of scope.

The browser snapshot CLI always supplied its 20-second command fallback as an explicit request timeout, so the shared request helper ignored a documented explicit --timeout 60000. Slow snapshots still failed at 20 seconds even when the operator requested a longer budget.

Why This Change Was Made

Commander materializes the browser command's default 30-second Gateway timeout in parsed options, so value presence cannot identify an operator override. The snapshot command now declares the timeout at the leaf and reads Commander's option source: a CLI-supplied leaf timeout wins, otherwise a CLI-supplied parent timeout is inherited, while a defaulted parent keeps the established 20-second snapshot fallback. The same resolved budget is sent to both the Gateway request and the snapshot owner through query.timeoutMs; the shared helper retains its existing fallback-first contract.

User Impact

Both openclaw browser --timeout 60000 snapshot and openclaw browser snapshot --timeout 60000 now carry the requested 60-second budget through the Gateway and the snapshot implementation. Calls without an explicit timeout retain the 20-second snapshot behavior, including the browser command's default 30-second parent timeout.

Evidence

Validated exact head a337e5cff443e1dab1cf1d297937eb5a621e2bfc.

  • Node v24.15.0 baseline: the three new snapshot-owner timeout assertions failed on the prior exact head because query.timeoutMs was absent; the other 16 tests passed.
  • Node v24.15.0 after the repair: node scripts/run-vitest.mjs extensions/browser/src/cli/browser-cli-inspect.test.ts extensions/browser/src/cli/browser-cli-shared.test.ts passed 2 files / 27 tests.
  • Snapshot owner/client siblings: node scripts/run-vitest.mjs extensions/browser/src/browser/routes/agent.snapshot.plan.test.ts extensions/browser/src/browser/client.test.ts passed 2 files / 23 tests.
  • Both supported option orders assert the 60-second Gateway and snapshot-owner budget; the no-option case asserts the parent default plus the 20-second snapshot fallback at both boundaries.
  • node_modules/.bin/oxfmt --check, focused node scripts/run-oxlint.mjs --openclaw-focused-config, and git diff --check passed for the changed files.
  • .agents/skills/autoreview/scripts/autoreview --mode local completed clean with patch is correct (0.99) and no accepted/actionable findings for the final patch.
  • Surface: 3 files, +91/-4.
  • No live browser/Gateway run has completed yet; the current proof covers the real Commander command path, request construction, snapshot-owner parsing contract, types, and static checks.

AI-assisted: developed with Codex; the author reviewed the complete change and validation results.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 26, 2026, 2:52 AM ET / 06:52 UTC.

ClawSweeper review

What this changes

This PR adds leaf-level timeout handling for browser screenshot and snapshot commands, forwarding an explicitly supplied budget to both Gateway transport and the browser endpoint.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 4 items remain

The patch is a focused, correct repair for the ignored explicit timeout, but it still needs an after-fix Browser/Gateway trace before merge because current evidence is mock-based.

Priority: P1
Reviewed head: d4a0194da3c04459773d1249d8107c04fbbcf6a5

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation and focused regression coverage are solid, but mock-only evidence leaves the user-visible timeout path unproven.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR has focused mocked command-path tests and static checks, but no redacted after-fix Browser/Gateway run proving the explicit timeout reaches the live owner; add that proof before merge and redact private endpoints or credentials. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR has focused mocked command-path tests and static checks, but no redacted after-fix Browser/Gateway run proving the explicit timeout reaches the live owner; add that proof before merge and redact private endpoints or credentials. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current-main defect: Current main constructs the snapshot query without a timeout field, although the downstream snapshot plan accepts and propagates one; an explicit CLI Gateway timeout therefore does not replace the snapshot owner's 20-second fallback.
Owner-boundary contract: The snapshot route parses query.timeoutMs and carries it through tab lookup and both Chrome-MCP and Playwright/CDP snapshot paths.
Patch behavior: The new local resolver distinguishes a leaf or parent CLI value from the parent's default, normalizes it, and sends it to the request transport and endpoint payload.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw browser snapshot --timeout 60000 --help

Result: PASS (completed)

$ node scripts/run-node.mjs browser snapshot --timeout 60000 --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 98.73 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 13.4s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4265ms (slowest: built plugin control-plane loads 3489ms)
│
◇

OpenClaw 2026.8.1 (d4a0194) — All your chats, one OpenClaw.

Usage: openclaw browser snapshot [options]

Capture a snapshot (default: ai; aria is the accessibility tree)

Options:
  -h, --help  Display help for command
$ node scripts/run-node.mjs browser snapshot --timeout 60000 --help
│
◇

OpenClaw 2026.8.1 (d4a0194) — All your chats, one OpenClaw.

Usage: openclaw browser snapshot [options]

Capture a snapshot (default: ai; aria is the accessibility tree)

Options:
  -h, --help  Display help for command
$ node scripts/run-node.mjs browser --timeout 60000 snapshot --help
│
◇

O
… output truncated …

Assertions:

  • NOT OBSERVED expect_output: --timeout ‹ms› — command exited successfully; expected output was not observed in the captured pane
  • PASS expect_output: Capture a snapshot

How this fits together

The browser CLI turns operator flags into Gateway browser requests. The Gateway forwards the request to the browser plugin, whose snapshot route applies the requested timeout to tab discovery and browser-driver work.

flowchart LR
  A[Browser CLI command] --> B[Timeout source selection]
  B --> C[Gateway browser request]
  C --> D[Snapshot route plan]
  D --> E[Browser driver operation]
  E --> F[Snapshot or screenshot result]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR has focused mocked command-path tests and static checks, but no redacted after-fix Browser/Gateway run proving the explicit timeout reaches the live owner; add that proof before merge and redact private endpoints or credentials. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P2) - Nested timeout parsing changes a public CLI behavior; mocked parser coverage is strong, but no real Browser/Gateway trace yet proves that a 60-second budget survives the full transport path.
  • Resolve merge risk (P1) - The bug fix adds production code (+26/-2) rather than remaining net-neutral, although the two-call-site resolver is the smallest shared location that preserves default and explicit-source semantics.
  • Complete next step (P2) - The remaining blocker is contributor-supplied real behavior proof, not a concrete repair for an automated work lane.
Agent review details

Security

None.

PR surface

Source +24, Tests +65. Total +89 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 26 2 +24
Tests 1 73 8 +65
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 99 10 +89

Review metrics

Metric Value Why it matters
Production versus test delta production +26/-2; tests +73/-8 The production growth is confined to a two-call-site timeout resolver and leaf option declarations; tests cover both accepted option orders and the retained default.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #124521
Summary: This PR is a narrow candidate fix for the explicit-timeout portion of the open browser snapshot issue; that issue separately tracks default-timeout and release follow-through.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Add transport-boundary proof (recommended)
    Attach a redacted after-fix Browser/Gateway terminal trace showing an explicit 60-second snapshot timeout reaches the browser request and completes beyond the former 20-second boundary.

Technical review

Best possible solution:

Keep the shared inspect-level resolver, preserve the 20-second unspecified fallback, and attach a redacted live trace showing an explicit timeout reaches the browser owner before merge.

Do we have a high-confidence way to reproduce the issue?

Yes—source inspection gives a high-confidence reproduction path: on current main, an explicit browser timeout reaches Gateway but is absent from the snapshot query, leaving the snapshot owner at its 20-second fallback. A real Gateway run has not been supplied.

Is this the best way to solve the issue?

Yes—the inspect-level resolver is the narrowest maintainable fix because it preserves Commander option-source semantics and passes one normalized explicit value to both Gateway and the endpoint owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against fc64c5704a77.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The PR changes nested public CLI timeout parsing and default inheritance for existing browser inspection commands.

Label justifications:

  • P1: An explicit operator timeout is currently ignored for browser snapshots, causing a user-requested longer operation budget to fail at the owner fallback.
  • merge-risk: 🚨 compatibility: The PR changes nested public CLI timeout parsing and default inheritance for existing browser inspection commands.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR has focused mocked command-path tests and static checks, but no redacted after-fix Browser/Gateway run proving the explicit timeout reaches the live owner; add that proof before merge and redact private endpoints or credentials. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current main attributes the inspected CLI and snapshot-planning lines to the recent browser-area refactor commit. (role: recent current-main browser CLI and snapshot-path contributor; confidence: high; commits: 0285926bf90a; files: extensions/browser/src/cli/browser-cli-inspect.ts, extensions/browser/src/browser/routes/agent.snapshot.plan.ts, extensions/browser/src/browser/client.ts)
  • Masato Hoshino: History identifies this contributor's merged timeout-threading change as the prior owner of the browser snapshot timeout contract. (role: original snapshot-timeout contributor; confidence: high; commits: 069c7b87eb67; files: extensions/browser/src/browser/client.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted terminal trace from a real Browser/Gateway run where an explicit timeout crosses the former 20-second boundary.
  • Update the PR body with that trace; if review does not refresh automatically, ask a maintainer to comment @clawsweeper re-review.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-24T15:04:13.249Z sha 267a52a917eaf9077061d4f04957a86a37f19456 :: needs real behavior proof before merge. :: [P1] Do not close the broader timeout issue with this partial fix
  • reviewed 2026-08-24T15:52:02.999Z sha a337e5cff443e1dab1cf1d297937eb5a621e2bfc :: needs real behavior proof before merge. :: none

@Leon-SK668
Leon-SK668 force-pushed the fix/browser-cli-snapshot-timeout branch from 6fbba25 to 1ee95e2 Compare August 16, 2026 13:27
@Leon-SK668

Copy link
Copy Markdown
Contributor Author

Addressed the P1 timeout-default regression on exact head 1ee95e2003ca2d25355e3e618584c754e6c15b18.

  • Restored the shared helper's fallback-first contract.
  • Snapshot now omits its 20-second fallback only when Commander reports the parent timeout source as cli.
  • Added command-path coverage for both the default parent timeout (snapshot remains 20 seconds) and explicit --timeout 60000 (parent owns the budget).
  • Rebased onto current upstream/main; 2 files / 26 tests, the extensions-test tsgo lane, focused format/lint, diff check, and fresh autoreview all pass.

The PR body records the remaining live browser/Gateway proof gap.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 16, 2026
@Leon-SK668
Leon-SK668 force-pushed the fix/browser-cli-snapshot-timeout branch from 1ee95e2 to 267a52a Compare August 16, 2026 14:11
@Leon-SK668

Leon-SK668 commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed the second P1 finding on exact head 267a52a917eaf9077061d4f04957a86a37f19456.

  • The snapshot leaf now accepts --timeout, so both browser --timeout 60000 snapshot and browser snapshot --timeout 60000 are supported.
  • A leaf CLI value wins; otherwise the command inherits a CLI-supplied parent value. The parent's default 30 seconds is not mistaken for an explicit override, so the existing 20-second snapshot fallback remains intact.
  • Focused Node 24 proof passes 2 files / 27 tests, including both option orders and the default case.
  • extensions test tsgo, oxfmt, oxlint, git diff --check, and fresh autoreview are clean; final surface is 3 files, +81/-4.

The PR body now records the exact commands and the remaining live Gateway proof gap.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper recorded closeout evidence for this proposed close.

  • Action: close remains subject to final live verification.
  • Close reason: lowest-signal PR over the author's open-PR budget.
    Review evidence: durable ClawSweeper review.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 24, 2026
@steipete
steipete force-pushed the fix/browser-cli-snapshot-timeout branch from a337e5c to d4a0194 Compare August 26, 2026 06:46
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Aug 26, 2026
@steipete
steipete merged commit a6a3fd9 into openclaw:main Aug 26, 2026
103 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: browser merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants