Skip to content

fix(run): prevent output truncation during phase streaming - #290

Merged
admarble merged 1 commit into
mainfrom
feature/283-claude-output-truncation-during-phase-streaming
Feb 18, 2026
Merged

admarble merged 1 commit into
mainfrom
feature/283-claude-output-truncation-during-phase-streaming

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Fixed Claude output truncation during verbose phase streaming
  • Root cause: ora's stop() method clears the current terminal line, causing text loss when pause/resume is called for every chunk in rapid succession
  • Solution: Pause spinner once at start of streaming, resume after all chunks processed

Root Cause Analysis

When running sequant run --verbose, each streaming chunk triggered:

  1. spinner.pause() → calls ora.stop() → clears current line
  2. process.stdout.write(textContent) → writes new content
  3. spinner.resume() → restarts spinner

When chunks arrived rapidly, the previous chunk's text was cleared before rendering completed.

Changes

  • Added verboseStreamingActive flag to track streaming state
  • Pause spinner once on first output, resume after all messages processed
  • Applied same fix to both stdout and stderr handlers

Test Plan

  • npm run build passes
  • npm run lint passes
  • npm test passes (1218 tests)
  • Manual test: npx sequant run <issue> --verbose shows complete output

Closes #283

🤖 Generated with Claude Code

The verbose mode was pausing and resuming the spinner for every streaming
chunk, which caused ora's stop() method to clear the terminal line. When
chunks arrived in rapid succession, the previous chunk's output would be
erased before it was fully rendered.

Root cause: ora's stop() calls clear(), which uses cursorTo(0) and
clearLine(1) to erase the current line. In a tight pause/write/resume
loop, this caused text to be truncated.

Fix: Pause the spinner once at the start of streaming and resume it
only after all chunks have been processed. This eliminates the repeated
line-clearing that caused truncation.

Closes #283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude output truncation during phase streaming

1 participant