Skip to content

fix(promptfoo): replace retired Claude Sonnet 4 default with Claude Sonnet 5.5 - #181

Open
pcbeingused33 wants to merge 2 commits into
promptfoo:mainfrom
pcbeingused33:fix/anthropic-default-retired
Open

pcbeingused33 wants to merge 2 commits into
promptfoo:mainfrom
pcbeingused33:fix/anthropic-default-retired

Conversation

@pcbeingused33

@pcbeingused33 pcbeingused33 commented Nov 27, 2026 •

Copy link
Copy Markdown

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 maxTokens is 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.ts passed all 5 tests after reproducing both failures. npm test passed all 8 tests, and npm run build passed.

This change was prepared with AI assistance.

…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>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T13:46:38.915223Z df2306b New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@pcbeingused33

Copy link
Copy Markdown
Author

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

This branch has not been deployed

No deployments
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.

1 participant