Skip to content

fix(cli): suppress progress bars when not TTY#230

Open
dgilperez wants to merge 1 commit intotobi:mainfrom
Balneario-de-Cofrentes:fix/tty-progress-guard
Open

fix(cli): suppress progress bars when not TTY#230
dgilperez wants to merge 1 commit intotobi:mainfrom
Balneario-de-Cofrentes:fix/tty-progress-guard

Conversation

@dgilperez
Copy link
Contributor

Problem

When qmd update or qmd embed runs inside a parent process (CI, cron, daemon, MCP server, editor plugin), the captured output is ~247K chars for a typical index with ~1600 documents. This is because:

  1. OSC 9;4 progress sequences (\x1b]9;4;1;N\x07) are written unconditionally to stderr
  2. Carriage-return status lines (\rIndexing: X/Y ETA: Zs) accumulate instead of overwriting (no terminal to interpret \r)
  3. Embed progress bars with ANSI color codes similarly accumulate

This causes issues for any integration that captures output — in our case, OpenClaw's qmd update was failing with "too much output" errors, retrying ~24 times per 10 minutes.

Fix

Gate all progress/status output on process.stderr.isTTY. Summary lines (Indexed: N new, M updated...) still print normally — only the ephemeral progress indicators are suppressed.

Before (non-TTY): 247,296 chars
After (non-TTY): 6,639 chars

Changes

  • Add const isTTY = process.stderr.isTTY
  • Wrap OSC 9;4 progress calls in if (isTTY)
  • Wrap \rIndexing: X/Y line in if (isTTY)
  • Wrap embed progress bar in if (isTTY)

Minimal, no behavior change when running interactively.

When stdout/stderr is not a terminal (e.g., captured by a parent process),
OSC 9;4 progress sequences and carriage-return-based status lines produce
massive output (247K chars for a typical update). This caused OpenClaw's
qmd update to fail with 'too much output' errors, retrying ~24 times
per 10 minutes.

Gate all progress output on process.stderr.isTTY. Summary lines still
print normally.
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.

1 participant

Comments