Repository navigation
Report a browser tool failure with an empty message as a failure - #334311
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit intoSep 3, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
Conversation
`errorResult('')` left `toolResultError` falsy, so `toolResultToProtocol`
serialized the call as `success: true` while the completed row still read
"Browser action failed". Both `new Error()` and `throw ''` reach it as an
empty string, from `playwrightInvoke` and two other call sites.
Fall back to the failure label for the error and the content part, as the
conversion above already does for `result.error`.
Also corrects the comment on `failedMessage`. These tools do not all declare
only an `invocationMessage`; the screenshot tool prepares a past-tense one,
and that prepared label is what survives when a result carries no
`toolResultMessage`.
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Kyle Cutler (@kycutler)Matched files:
Joaquín Ruales (@jruales)Matched files:
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix correctly preserves failure signaling and includes appropriate regression coverage.
Pull request overview
Ensures empty browser-tool errors are reported as failures to both the model and UI.
Changes:
- Falls back to “Browser action failed” for empty errors.
- Adds regression coverage and corrects the failure-label comment.
File summaries
| File | Description |
|---|---|
browserToolHelpers.ts |
Adds non-empty error fallback and updates documentation. |
browserToolHelpers.test.ts |
Tests empty-message failure handling. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 3, 2026
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 3, 2026 16:59
Giuseppe Cianci (Giuspepe)
approved these changes
Sep 3, 2026
Anthony Kim (anthonykim1)
approved these changes
Sep 3, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Follow-up to #330707. That PR merged with two review points from Dmitriy Vasyura (@dmitrivMS) unaddressed. I replied at the time saying both were fixed in it, on the mistaken belief that it had not merged yet. It had, and neither change landed. Nothing has touched
errorResultsince.An empty error message reports success to the model
errorResultsettoolResultErrorto the raw message, unlike the conversion sixteen lines above it, which already falls back:So
errorResult('')lefttoolResultErrorfalsy, and that is the sole error signal downstream:The call was serialized as a success with
error: undefined, whiletoolResultMessagestill set the completed row to "Browser action failed". The user saw a failure, the model was told it succeeded.Three call sites can produce an empty message, all of the form
e instanceof Error ? e.message : String(e), which is''for bothnew Error()andthrow '':playwrightInvokeinbrowserToolHelpers.ts(used by the click, type, hover, drag, navigate and screenshot tools), the deferred-result wait inrunPlaywrightCodeTool.ts, andhandleDialogBrowserTool.ts. The fourth site prefixes its message and was never affected.The fix falls back to the same label the conversion uses, for the content part as well as the error, so the model is given a reason rather than an empty string.
The comment on
failedMessagewas wrongIt asserted these tools "declare only an
invocationMessage". They do not: the screenshot tool prepares "Captured browser screenshot", anddidExecuteToolkeeps a prepared past-tense label unless the result carries atoolResultMessage. That is the mechanism Dmitriy Vasyura (@dmitrivMS) described, and the comment still stated the version I had wrong. Rewritten to say what the constant is actually for.Tests
errorResult with an empty message still reports a failurecovers both the error signal and the content part. It mirrors the existing empty-message test forinvokeFunctionResultToToolResult, which had noerrorResultcounterpart. Without the source change it fails on the first assertion; with it the file is 6 passing. No new type errors, 349 before and after.AI disclosure: this comment and the related code were written with the assistance of AI.
Public patches and patcher scripts
Source patch and installed-bundle workaround mapping. The public collection includes the maintained patchers, rollback instructions, regression scripts, and historical snapshots. Build restrictions and exact installer coverage are documented there.