Uh oh!
There was an error while loading. Please reload this page.
fix(core): keep signed thinking ahead of tool calls on errored replay - #44480
fix(core): keep signed thinking ahead of tool calls on errored replay#44480Enough1122 wants to merge 1 commit into
Conversation
Replaying an errored assistant message stripped its reasoning provider metadata while still replaying the message's tool_use parts. Anthropic requires every thinking block to precede its sibling tool_use, so the follow-up request failed with a 400 whenever extended thinking was enabled and a step was interrupted or failed mid-tool-call. Same-model messages now keep signed/redacted reasoning blocks (with their metadata) across errors; unsigned hosted-style reasoning keeps demoting to text, and cross-model replay is unchanged. Fixesanomalyco#38620
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
The following comment was made by an LLM, it may be inaccurate: Found several related PRs that address similar issues with thinking/reasoning metadata on errored replays: Potential Related PRs:
These PRs address overlapping concerns around preserving thinking/reasoning signatures and handling tool calls when messages have errors. PR #44054 appears most closely related as it also handles "reasoning provider metadata on errored turns for valid Anthropic replay." |
Enough1122
commented
Aug 23, 2026
Closing this in favor of the four earlier PRs covering the same ground - #44054, #42735, #40157, #38763 - which the maintainers can now pick between without a fifth candidate muddying the choice. If whichever lands ends up missing regression coverage, the test added here (errored same-model message with signed reasoning + tool call keeps its thinking block ahead of tool-use) should drop in cleanly. |
Issue for this PR
Closes#38620
Type of change
What does this PR do?
Replaying an errored assistant message stripped its reasoning provider metadata (signature / redactedData) while still replaying the same message's tool_use parts. Anthropic requires every thinking block to precede its sibling tool_use when thinking is enabled, so any interrupted-or-failed step in a thinking + tool session made the follow-up request fail with a 400.
The reuse gate now keeps signed/redacted reasoning blocks - with their metadata - when the producing model is the replay target, even if the message carries an error. Unsigned hosted-style reasoning (OpenAI itemId/encrypted content) keeps demoting to text as before, cross-model replay is unchanged, and the existing "lowers failed assistant reasoning to text" case still passes untouched since its fixture has no signature.
How did you verify your code works?
Screenshots / recordings
Not a UI change.
Checklist