fix(claude-code): prevent reasoning text duplication

The thinking_complete handler was re-emitting the full reasoning text
after it had already been streamed via reasoning chunks. This caused
the reasoning content to appear twice in the UI.

Now the thinking_complete case only captures the signature for
tool use continuations without re-emitting the text.
This commit is contained in:
fernando234234 2026-01-09 18:33:56 +01:00 • committed by Roo Code
parent 4bb2d98d0b
commit a2ea1acd3e

View file

@ -219,17 +219,12 @@ export class ClaudeCodeHandler implements ApiHandler, SingleCompletionHandler {
case "thinking_complete":
// Capture the signature for persistence in api_conversation_history
// This enables tool use continuations where thinking blocks must be passed back
// NOTE: We do NOT emit the text here because it was already streamed via
// "reasoning" chunks. Re-emitting would duplicate the reasoning in the UI.
// The signature is retrieved via getThoughtSignature() after streaming completes.
if (chunk.signature) {
this.lastThinkingSignature = chunk.signature
}
// Emit a complete thinking block with signature
// This is critical for interleaved thinking with tool use
// The signature must be included when passing thinking blocks back to the API
yield {
type: "reasoning",
text: chunk.thinking,
signature: chunk.signature,
}
break
case "tool_call_partial":