Skip to content

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

Merged
tobi merged 1 commit intotobi:mainfrom
Balneario-de-Cofrentes:fix/tty-progress-guard
Mar 7, 2026
Merged

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

Conversation

@dgilperez
Copy link
Copy Markdown
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.
@tobi tobi merged commit 0b3fb07 into tobi:main Mar 7, 2026
1 of 6 checks passed
@dgilperez dgilperez deleted the fix/tty-progress-guard branch March 7, 2026 18:39
@dgilperez
Copy link
Copy Markdown
Contributor Author

jaylfc added a commit to jaylfc/qmd that referenced this pull request Apr 5, 2026
…ess-guard

fix(cli): suppress progress bars when not TTY
jaylfc added a commit to jaylfc/qmd that referenced this pull request Apr 5, 2026
…ess-guard

fix(cli): suppress progress bars when not TTY
tanarchytan referenced this pull request in tanarchytan/lotl Apr 8, 2026
…guard

fix(cli): suppress progress bars when not TTY
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.

2 participants