Skip to content

fix(cli): gracefully handle Windows console failures in _cprint (kanban fix) - #25500

Closed
carterwayneskhizeine wants to merge 1 commit into
NousResearch:mainfrom
carterwayneskhizeine:kanban-fix-windows
Closed

fix(cli): gracefully handle Windows console failures in _cprint (kanban fix)#25500
carterwayneskhizeine wants to merge 1 commit into
NousResearch:mainfrom
carterwayneskhizeine:kanban-fix-windows

Conversation

@carterwayneskhizeine

Copy link
Copy Markdown

Summary

  • On Windows, prompt_toolkit's _pt_print can raise an exception when no console is attached (e.g. a background agent subprocess launched with TERM=xterm-256color).
  • This caused the kanban board to crash outright on Windows rather than degrading gracefully.
  • Wraps every _pt_print(_PT_ANSI(text)) call inside _cprint with a try/except that falls back to print(), keeping the process alive and output visible even when the Windows console API is unavailable.

Test plan

  • Run the kanban board on Windows in a normal terminal — output still renders correctly via prompt_toolkit.
  • Run the kanban board on Windows in a background/detached subprocess (no attached console) — no crash, plain-text output appears instead.
  • Run on Linux/macOS — no behavioural change, prompt_toolkit path still taken.

🤖 Generated with Claude Code

On Windows, prompt_toolkit's _pt_print can raise an exception when no
console is attached (e.g. background agent subprocess running with
TERM=xterm-256color). This caused the kanban board to crash instead of
degrading gracefully.

Wrap every _pt_print(_PT_ANSI(text)) call in _cprint with a try/except
that falls back to plain print(), so the process stays alive and output
is still visible even when the Windows console API is unavailable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels May 14, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #22482 (and overlaps with #25340, #22928). All address the same NoConsoleScreenBufferError / _cprint fallback for Windows console-less environments. #22482 was the first fix PR for #22445.

@carterwayneskhizeine

Copy link
Copy Markdown
Author

okay

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants