Skip to content

fix(chatCore): retry after stripping historical thinking on signature 400 - #7929

Closed
AndrianBalanescu wants to merge 1 commit into
cheaper-inference:release/v3.8.49from
AndrianBalanescu:fix/7899-thinking-signature-recovery
Closed

AndrianBalanescu wants to merge 1 commit into
cheaper-inference:release/v3.8.49from
AndrianBalanescu:fix/7899-thinking-signature-recovery

Conversation

@AndrianBalanescu

Copy link
Copy Markdown
Contributor

Closes #7899.

When an Anthropic target returns 400 Invalid signature in thinking block (after a routing/model/account change), retry the request once after removing thinking blocks from completed historical assistant turns. The active tool_use → tool_result cycle and the latest assistant message are preserved.

Narrowly scoped: only triggers on the exact 400 validation error, never on generic 400s, 429s, or the separate "latest assistant message cannot be modified" error. If no historical thinking can be safely removed, the original error is returned without retrying.

Tests: tests/unit/thinking-signature-recovery-7899.test.ts (11 cases covering detection, stripping, tool-use preservation, edge cases).

… 400 (cheaper-inference#7899)

When an Anthropic target returns 400 'Invalid signature in thinking block'
(after a routing/model/account change), retry the request once after removing
thinking blocks from completed historical assistant turns. The active
tool_use → tool_result cycle and the latest assistant message are preserved.

The recovery is narrowly scoped: only triggers on the exact 400 validation
error, never on generic 400s, 429s, or the 'latest assistant message cannot
be modified' error. If no historical thinking can be safely removed, the
original error is returned without retrying.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@AndrianBalanescu

Copy link
Copy Markdown
Contributor Author

Superseded by #7906.

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.

fix(claude): recover rejected historical thinking signatures without eager stripping

1 participant