Description
When an AI provider emits an empty thinking delta (e.g. Anthropic signature_delta → think: ""), the TUI creates a ThinkingComponent with a running spinner but no text content. When the thinking phase ends, flushThinkingToTranscript sees an empty thinkingDraft and returns early without stopping the spinner, causing it to animate indefinitely past the turn end.
Steps to reproduce
- Start a session with an Anthropic-backed model
- Submit a prompt that triggers thinking
- When the model emits an empty thinking delta during signature verification, observe the spinner continues animating after the turn completes
Root cause
Two gaps in kimi-tui.ts:
onThinkingUpdate: no guard against empty text — creates a ThinkingComponent even when fullText is empty and no existing component needs updating
flushThinkingToTranscript: when thinkingDraft is empty, returns immediately without cleaning up an orphaned activeThinkingComponent
Proposed fix
onThinkingUpdate: skip component creation when text is empty and no existing component exists (source prevention)
flushThinkingToTranscript: finalize any orphaned component even when thinkingDraft is empty (defensive cleanup)
Description
When an AI provider emits an empty thinking delta (e.g. Anthropic
signature_delta→think: ""), the TUI creates aThinkingComponentwith a running spinner but no text content. When the thinking phase ends,flushThinkingToTranscriptsees an emptythinkingDraftand returns early without stopping the spinner, causing it to animate indefinitely past the turn end.Steps to reproduce
Root cause
Two gaps in
kimi-tui.ts:onThinkingUpdate: no guard against empty text — creates aThinkingComponenteven whenfullTextis empty and no existing component needs updatingflushThinkingToTranscript: whenthinkingDraftis empty, returns immediately without cleaning up an orphanedactiveThinkingComponentProposed fix
onThinkingUpdate: skip component creation when text is empty and no existing component exists (source prevention)flushThinkingToTranscript: finalize any orphaned component even whenthinkingDraftis empty (defensive cleanup)