Repository navigation
fix(v3): avoid forced done tool use for newer Claude models - #3132
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: fd298e2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
shubh24
marked this pull request as ready for review
October 7, 2026 19:23
Contributor
There was a problem hiding this comment.
No issues found across 5 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant V3Agent as v3 Agent (DOM/Hybrid)
participant DoneUtil as handleDoneToolCall.ts
participant Opts as anthropicOptions.ts
participant AI as AI SDK generateText
participant Model as Claude Sonnet 5.5 API
participant Tests as Unit Tests
Note over V3Agent,Model: Final Done Request Flow
V3Agent->>DoneUtil: Request final done tool call
DoneUtil->>Opts: rejectsForcedToolUse(modelId)
alt Model rejects forced tool use (Sonnet 5.5 or Fable 5)
Opts->>Opts: Check MODELS_WITHOUT_FORCED_TOOL_USE set
Opts-->>DoneUtil: True (model in set)
DoneUtil->>AI: generateText with toolChoice: "auto"
AI->>Model: Send request with automatic tool choice
else Model accepts forced tool use (e.g. Opus)
Opts-->>DoneUtil: False
DoneUtil->>AI: generateText with toolChoice: "tool" (forced)
AI->>Model: Send request with forced done tool
end
alt Model returns tool call
Model-->>AI: tool-call: "done" with reasoning
AI-->>DoneUtil: Done tool result
DoneUtil-->>V3Agent: taskComplete: true
else Model returns text reply
Model-->>AI: text response (no tool call)
AI-->>DoneUtil: Text content
DoneUtil-->>V3Agent: taskComplete: false
end
Note over Tests: Unit Coverage
Tests->>Opts: rejectsForcedToolUse("claude-sonnet-5-5")
Opts-->>Tests: True
Tests->>Opts: rejectsForcedToolUse("anthropic/claude-sonnet-5-5")
Opts-->>Tests: True (prefix stripped)
Tests->>Opts: rejectsForcedToolUse("claude-opus-4-8")
Opts-->>Tests: False
Tests->>DoneUtil: handleDoneToolCall with Sonnet mock
DoneUtil->>AI: Verify toolChoice = auto
AI-->>DoneUtil: Mock "done" tool call
DoneUtil-->>Tests: taskComplete: true
DoneUtil-->>Tests: reasoning preserved
Tests->>DoneUtil: handleDoneToolCall with text response
DoneUtil->>AI: Verify toolChoice = auto
AI-->>DoneUtil: Mock text reply
DoneUtil-->>Tests: taskComplete: false
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
miguelg719
approved these changes
Oct 14, 2026
Merged
seanmcguire12
pushed a commit
that referenced
this pull request
Nov 18, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to v3, this PR will be updated. # Releases ## @browserbasehq/[email protected] ### Patch Changes - [#3150](#3150) [`69c2440`](69c2440) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix OpenAI strict-schema rejection of the nullable `act` action while still stripping unknown keys when parsing. - [#3114](#3114) [`f6b3d85`](f6b3d85) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix CAPTCHA awareness options for local Browserbase attachments and forward them through the API. - [#3491](#3491) [`57b905e`](57b905e) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Fix clicks on partially occluded elements - [#3132](#3132) [`09063f6`](09063f6) Thanks [@shubh24](https://github.com/shubh24)! - Use automatic tool choice for the final agent `done` call with Claude Sonnet 5.5, Opus 5.5, and Fable 5.1. - [#3287](#3287) [`27ee07c`](27ee07c) Thanks [@akeimach](https://github.com/akeimach)! - Fix XPath resolution for light DOM elements when the page has a shadow root and a host element overrides `children`. ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`69c2440`](69c2440), [`f6b3d85`](f6b3d85), [`57b905e`](57b905e), [`09063f6`](09063f6), [`27ee07c`](27ee07c)]: - @browserbasehq/[email protected] ## @browserbasehq/[email protected] ### Patch Changes - [#3312](#3312) [`e11bbe5`](e11bbe5) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Rebuild the standalone server binaries with Node.js 24.22.1 and Undici 7.30.1 to include the October 2026 security fixes. Binary builds now reject outdated Node versions and rebuild instead of reusing cached executables. - Updated dependencies \[[`69c2440`](69c2440), [`f6b3d85`](f6b3d85), [`57b905e`](57b905e), [`09063f6`](09063f6), [`27ee07c`](27ee07c)]: - @browserbasehq/[email protected] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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
The v3 DOM/hybrid agent's final
donerequest can fail when Claude Sonnet 5.5, Opus 5.5, or Fable 5.1 rejects forced tool use. Use automatic tool choice for these models, preserving the existing Fable 5 behavior and conservative incomplete result for plain-text replies.anthropic/-prefixed IDs, tool-call responses, and text responses.@browserbasehq/stagehand.v3(f6b3d851d) into the PR branch.Validation
fd298e269: 242 checks passed, 8 skipped, none failed or pending. Both previously failing serveractandagentExecutechecks pass.Scope
This fixes the final
donerequest in the v3 DOM/hybrid agent path. Live model behavior and a full browser run with prior thinking blocks were not revalidated in this review. CUA support remains separate.