Skip to content

Bug: thinking spinner leaks past turn end on empty thinking deltas #96

Description

@shuizhongyueming

Description

When an AI provider emits an empty thinking delta (e.g. Anthropic signature_deltathink: ""), 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

  1. Start a session with an Anthropic-backed model
  2. Submit a prompt that triggers thinking
  3. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions