Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 2c8a209 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 |
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
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Confidence score: 5/5
agent-done-tool-choice.test.tsdoes not cover the auto-tool-choice path forclaude-fable-5, despite that model being listed inMODELS_WITHOUT_FORCED_TOOL_USE. Add it toautomaticToolChoiceModels.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/core/tests/unit/agent-done-tool-choice.test.ts">
<violation number="1" location="packages/core/tests/unit/agent-done-tool-choice.test.ts:6">
P3: `automaticToolChoiceModels` omits `claude-fable-5`, one of the four entries in `MODELS_WITHOUT_FORCED_TOOL_USE` (anthropicOptions.ts), so the `handleDoneToolCall` auto-tool-choice path for the base Fable model is never exercised here. Add it (or export the implementation set) so the test and source lists cannot drift.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| const automaticToolChoiceModels = [ | ||
| "claude-sonnet-5-5", | ||
| "claude-opus-5-5", | ||
| "claude-fable-5-1", | ||
| ].flatMap((modelId) => [modelId, `anthropic/${modelId}`]); |
There was a problem hiding this comment.
P3: automaticToolChoiceModels omits claude-fable-5, one of the four entries in MODELS_WITHOUT_FORCED_TOOL_USE (anthropicOptions.ts), so the handleDoneToolCall auto-tool-choice path for the base Fable model is never exercised here. Add it (or export the implementation set) so the test and source lists cannot drift.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/core/tests/unit/agent-done-tool-choice.test.ts, line 6:
<comment>`automaticToolChoiceModels` omits `claude-fable-5`, one of the four entries in `MODELS_WITHOUT_FORCED_TOOL_USE` (anthropicOptions.ts), so the `handleDoneToolCall` auto-tool-choice path for the base Fable model is never exercised here. Add it (or export the implementation set) so the test and source lists cannot drift.</comment>
<file context>
@@ -3,7 +3,13 @@ import type { LanguageModelV2 } from "@ai-sdk/provider";
import { handleDoneToolCall } from "../../lib/v3/agent/utils/handleDoneToolCall.js";
-function sonnetMock(modelId: string, response: "done" | "text") {
+const automaticToolChoiceModels = [
+ "claude-sonnet-5-5",
+ "claude-opus-5-5",
</file context>
| const automaticToolChoiceModels = [ | |
| "claude-sonnet-5-5", | |
| "claude-opus-5-5", | |
| "claude-fable-5-1", | |
| ].flatMap((modelId) => [modelId, `anthropic/${modelId}`]); | |
| const automaticToolChoiceModels = [ | |
| "claude-fable-5", | |
| "claude-fable-5-1", | |
| "claude-opus-5-5", | |
| "claude-sonnet-5-5", | |
| ].flatMap((modelId) => [modelId, `anthropic/${modelId}`]); |
Summary
donerequest use the existingautotool choice for this model.anthropic/prefix, adonecall, and a text reply.@browserbasehq/stagehand.Checks
doneand returned a valid result.Scope
This fixes the final
donerequest in the v3 DOM/hybrid agent path. A full browser run with prior thinking blocks has not been tested. Claude Sonnet 5.5 CUA support needs separate work.Summary by cubic
Fixes the v3 agent's final
donecall returning a 400 error for Claude Sonnet 5.5 by using automatic tool choice for that model, and extends the same handling to Opus 5.5 and Fable 5.1.anthropic/prefix.donecall, and a plain-text reply.@browserbasehq/stagehand.Written for commit 2c8a209. Summary will update on new commits.