Preserve valid thinking blocks during recovery

Instead of stripping all thinking blocks during thinking recovery,
now only strips invalid or incompatible blocks. Uses signature cache
to validate family compatibility for cross-model fallback scenarios.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Badri Narayanan S
2026-01-03 23:17:38 +05:30
parent 668c7aef26
commit dc65499c49
2 changed files with 32 additions and 8 deletions

View File

@@ -85,7 +85,7 @@ export function convertAnthropicToGoogle(anthropicRequest) {
if (isThinking && targetFamily && needsThinkingRecovery(messages, targetFamily)) {
logger.debug(`[RequestConverter] Applying thinking recovery for ${targetFamily}`);
processedMessages = closeToolLoopForThinking(messages);
processedMessages = closeToolLoopForThinking(messages, targetFamily);
}
// Convert messages to contents, then filter unsigned thinking blocks