Skip to content

fix: let cancelled tool calls reject instead of reporting an error - #17

Merged
beaufortfrancois merged 1 commit into
GoogleChromeLabs:mainfrom
kesku:fix/rethrow-cancelled-execute
Nov 3, 2026
Merged

beaufortfrancois merged 1 commit into
GoogleChromeLabs:mainfrom
kesku:fix/rethrow-cancelled-execute

Conversation

@kesku

@kesku kesku commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Cancelled tool calls currently invoke onError and return an isError result. Rethrow when the execution signal has aborted, leaving live-error handling unchanged. This follows the cancellation behavior in the spec.

Updated the tests and documentation. npm test: 31 passing, no unhandled errors or rejections.

@beaufortfrancois beaufortfrancois left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Comment thread useWebMCP.mdx Resolved
@kesku
kesku force-pushed the fix/rethrow-cancelled-execute branch 2 times, most recently from 7b5bc42 to 01553fb Compare October 30, 2026 19:23
@beaufortfrancois

Copy link
Copy Markdown
Collaborator

@kesku Please resolve conflicts and I'll merge this PR

@kesku
kesku force-pushed the fix/rethrow-cancelled-execute branch from 00e2d7e to 2ee70b8 Compare November 2, 2026 17:16
@beaufortfrancois
beaufortfrancois merged commit 972a5f3 into GoogleChromeLabs:main Nov 3, 2026
7 checks passed
MrSunshyne added a commit to MrSunshyne/vue-webmcp that referenced this pull request Nov 7, 2026
use-webmcp-tool now rethrows a throw or rejection that comes after the
execution signal aborts, without calling onError
(GoogleChromeLabs/use-webmcp-tool#17, 2026-11-03): a cancelled call is
not a tool failure. We still ran onError and resolved to an isError
result, so a page that shows tool errors would report a cancellation as
one.

The browser has already settled a cancelled call with the abort reason
and drops whatever comes back, so the agent sees no difference; the
visible change is that onError no longer runs. A failure before the
abort is reported as before, including an AbortError the tool raises
itself.

Hooks still see the call, flagged cancelled: true, so analytics can
count cancellations apart from failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants