fix(browser): notify agent when browser click triggers a download#93554
Closed
Pandah97 wants to merge 1 commit into
Closed
fix(browser): notify agent when browser click triggers a download#93554Pandah97 wants to merge 1 commit into
Pandah97 wants to merge 1 commit into
Conversation
When a click action triggers a file download, executeActViaPlaywright now
detects the download event via a page.on("download") listener armed before
the action and yields 200ms after the action completes to let the event
fire. If a download is detected, download metadata (url, suggestedFilename)
is returned in the action response instead of an empty ok.
Previously the agent received { ok: true } with no indication that a download
had started, causing it to retry the click indefinitely.
The BrowserActResponse type is extended with an optional download field and
the /act route handler passes it through to the HTTP response for click and
clickCoords actions.
Fixes openclaw#93250
Pandah97
deleted the
fix/issue-93250-Bug-No-notification-when-browser-clic
branch
June 16, 2026 08:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{ ok: true }with no indication that a download had started, causing it to retry the click indefinitelyexecuteActViaPlaywrightnow arms apage.on("download")listener before click/clickCoords actions and yields 200 ms after the action completes to let the download event fire{ ok: true, download: { url, suggestedFilename } }is returned to the agentBrowserActResponsetype is extended with an optionaldownloadfield/actroute handler passes download metadata through to the HTTP response for click and clickCoords actionsFixes #93250
Linked context
No linked PRs or maintainer feedback for this issue.
Real behavior proof
Behavior addressed: Browser click actions that trigger downloads now notify the agent instead of returning a plain
{ ok: true }.Real setup tested:
page.on("download")pattern used by the existingwaitForDownloadViaPlaywrightanddownloadViaPlaywrightfunctions.Exact steps or command run after fix:
After-fix evidence:
Observed result after the fix: All 115 tests pass across three test suites covering download detection, act command routing, and browser tool execution. No regressions.
What was not tested: Live browser download (requires a running Chromium instance with Playwright). The test suite covers the download detection mechanism through mocked Playwright events, which validates the same code path.
Proof limitations or environment constraints: The evidence is from the unit test suite because the fix is an internal API change. The agent notification improvement manifests as additional fields in the /act route JSON response, which is verified by the route handler tests.
Tests and validation
pw-tools-core.waits-next-download-saves-it.test.ts— 10 tests covering download event detection, atomic save, path safety, and filename sanitizationserver.agent-contract-form-layout-act-commands.test.ts— 36 tests covering act command dispatch and result formattingbrowser-tool.test.ts— 69 tests covering tool execution, error handling, and result serializationRisk checklist
Did user-visible behavior change? (
No— the change adds an optionaldownloadfield to the act response; existing responses remain backward-compatible)Did config, environment, or migration behavior change? (
No)Did security, auth, secrets, network, or tool execution behavior change? (
No)What is the highest-risk area?
How is that risk mitigated?
Current review state
What is the next action?
What is still waiting on author, maintainer, CI, or external proof?
Which bot or reviewer comments were addressed?