Repository navigation
fix(promptfoo): replace retired Claude Sonnet 4 default with Claude Sonnet 5.5 - #181
pcbeingused33 wants to merge 2 commits into
Conversation
…onnet 5.5 claude-sonnet-4-20250514 was retired on 2026-06-15. The replacement rejects sampling parameters, so only send temperature when a caller sets it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e61f29f5cf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| constructor(options: { apiKey?: string; model?: string; baseUrl?: string }) { | ||
| this.apiKey = options.apiKey || process.env.ANTHROPIC_API_KEY || ''; | ||
| this.model = options.model || 'claude-sonnet-4-20250514'; | ||
| this.model = options.model || 'claude-sonnet-5-5'; |
There was a problem hiding this comment.
Preserve thinking blocks before adopting the thinking-enabled default
When Sonnet 5.5 uses its default adaptive thinking before a tool call, the existing response parser discards its thinking/redacted_thinking blocks, and runDiscoveryAgent reconstructs an assistant message containing only the tool calls. toAnthropicMessage() consequently sends only tool_use blocks on the next request. Anthropic requires the original signed thinking blocks when continuing with the corresponding tool results, so this causes the next /messages request to be rejected and aborts multi-turn discovery. Either explicitly disable thinking for this provider or preserve the untouched thinking blocks through ChatResponse, Message, and assistant-message serialization before making this the default.
Useful? React with 👍 / 👎.
|
The follow-up preserves the original Anthropic assistant blocks, including empty signed thinking, when sending tool results. It also omits explicit temperature for Sonnet 5.5 and keeps the existing output limit configurable. The two-turn mocked regression and the full plugin suite pass. This comment was drafted with Claude Code. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df2306bd7b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| role: 'assistant', | ||
| content: response.content || '', | ||
| toolCalls: response.toolCalls, | ||
| anthropicContent: response.anthropicContent, |
There was a problem hiding this comment.
Retry truncated thinking instead of replaying it as a prefill
If adaptive thinking exhausts the provider's 4096-token default before producing text or tool calls, Anthropic returns max_tokens, response.content is null, and toolCalls is empty. This branch then stores the thinking-only assistant message without adding a subsequent user or tool-result turn. The next request consequently ends with that assistant message, which Anthropic rejects because assistant prefilling is unsupported with thinking enabled, aborting discovery. Handle finishReason === 'length' by retrying with a larger token budget, or explicitly disable thinking, rather than replaying the truncated thinking-only response.
Useful? React with 👍 / 👎.
The discovery agent flattened Anthropic responses into text and tool calls. On the next request it reconstructed the assistant message from the tool calls, dropping the signed thinking blocks that Anthropic expects alongside the tool results.
Carry the original content blocks through the discovery history and replay them in their original order, including empty thinking blocks with a signature. Omit temperature on Claude Sonnet 5.5 even when supplied explicitly, and continue forwarding it for older models such as Sonnet 4.6.
The 4096-token output default is unchanged and an explicit
maxTokensis still passed through. Adaptive thinking draws from that budget; the mocked tests check the request fields and the two-turn protocol, not how much budget a live discovery run needs.From
plugins/promptfoo,npm test -- test/providers.test.tspassed all 5 tests after reproducing both failures.npm testpassed all 8 tests, andnpm run buildpassed.This change was prepared with AI assistance.