315 unmodified lines
Expand all
if (!block.thinking || block.thinking.trim() === "") continue;
const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.thinkingSignature);
// Claude on Antigravity Cloud Code Assist rejects unsigned thinking parts; drop them.
if (isClaudeModel(model.id) && !thoughtSignature) continue;
if (thoughtSignature) {
// Same provider+model: always mark replayed thoughts, even unsigned ones.
// Gemini thoughts carry signatures only on functionCalls, so replaying
// unsigned thoughts as plain text makes the model emit its own thought
// summaries as visible text (thinking leak) on later turns.
if (isSameProviderAndModel) {
parts.push({
thought: true,
text: sanitizeSurrogates(block.thinking),
thoughtSignature,
...(thoughtSignature && { thoughtSignature }),
});
} else {
parts.push({ text: sanitizeSurrogates(block.thinking) });
}