Bug Description
On Windows 11, kanban workers crash immediately at startup when stdout is redirected to a log file. The crash occurs in _cprint() -> _pt_print() -> prompt_toolkit's create_output(), which raises NoConsoleScreenBufferError because there is no Win32 console buffer attached.
Environment
- OS: Windows 11
- Hermes Agent: v0.13.0 (2026.5.7)
- Shell: git-bash (MSYS) — dispatcher runs here
- Python: 3.12
- prompt_toolkit: bundled venv
Reproduction Steps
- Create a kanban task:
hermes kanban add "test task"
- Dispatch it:
hermes kanban dispatch
- The spawned worker process (
hermes chat -q "work kanban task ...") crashes immediately.
Stack Trace
File "cli.py", line 9602, in chat
_cprint(f"{_DIM}Initializing agent...{_RST}")
File "cli.py", line 1480, in _cprint
_pt_print(_PT_ANSI(text))
File "prompt_toolkit/shortcuts/utils.py", line 111, in print_formatted_text
output = get_app_session().output
File "prompt_toolkit/application/current.py", line 67, in output
self._output = create_output()
File "prompt_toolkit/output/defaults.py", line 91, in create_output
return Win32Output(stdout, default_color_depth=color_depth_from_env)
File "prompt_toolkit/output/win32.py", line 115, in __init__
info = self.get_win32_screen_buffer_info()
File "prompt_toolkit/output/win32.py", line 219, in get_win32_screen_buffer_info
raise NoConsoleScreenBufferError
prompt_toolkit.output.win32.NoConsoleScreenBufferError: Found xterm-256color,
while expecting a Windows console.
Root Cause
The kanban dispatcher spawns workers via subprocess.Popen in _default_spawn() (hermes_cli/kanban_db.py, line 3760):
proc = subprocess.Popen(
cmd,
stdin=subprocess.DEVNULL,
stdout=log_f, # <-- redirected to file
stderr=subprocess.STDOUT,
env=env,
start_new_session=True,
)
The child process has no Win32 console. When cli.py's chat() method calls _cprint("Initializing agent...") at line 9602, it invokes _pt_print(_PT_ANSI(text)). On Windows, prompt_toolkit's create_output() detects a non-console stdout and raises NoConsoleScreenBufferError.
_cprint() has no fallback for this exception — it propagates up and kills the worker before it can do any work.
Suggested Fix
Add a try/except around _pt_print calls in _cprint() (cli.py) to fall back to a plain print() when prompt_toolkit cannot create a Win32 console output:
def _cprint(text: str):
_record_output_history(text)
# ... existing imports ...
try:
_pt_print(_PT_ANSI(text))
except Exception:
# Windows: NoConsoleScreenBufferError when stdout is redirected
# (kanban workers, piped output). Fall back to plain print.
print(text)
This should wrap every _pt_print(_PT_ANSI(text)) call in _cprint() (lines 1480, 1504, 1516, 1524).
Impact
- Severity: High — kanban is completely broken on Windows.
- Scope: Only affects Windows when stdout is not a real console (kanban workers, redirected/piped output).
- Normal interactive CLI: Not affected (has a real console).
Workaround
None currently. The worker crashes on every dispatch attempt, making kanban unusable on Windows.
Bug Description
On Windows 11, kanban workers crash immediately at startup when
stdoutis redirected to a log file. The crash occurs in_cprint()->_pt_print()->prompt_toolkit'screate_output(), which raisesNoConsoleScreenBufferErrorbecause there is no Win32 console buffer attached.Environment
Reproduction Steps
hermes kanban add "test task"hermes kanban dispatchhermes chat -q "work kanban task ...") crashes immediately.Stack Trace
Root Cause
The kanban dispatcher spawns workers via
subprocess.Popenin_default_spawn()(hermes_cli/kanban_db.py, line 3760):The child process has no Win32 console. When
cli.py'schat()method calls_cprint("Initializing agent...")at line 9602, it invokes_pt_print(_PT_ANSI(text)). On Windows,prompt_toolkit'screate_output()detects a non-console stdout and raisesNoConsoleScreenBufferError._cprint()has no fallback for this exception — it propagates up and kills the worker before it can do any work.Suggested Fix
Add a
try/exceptaround_pt_printcalls in_cprint()(cli.py) to fall back to a plainprint()whenprompt_toolkitcannot create a Win32 console output:This should wrap every
_pt_print(_PT_ANSI(text))call in_cprint()(lines 1480, 1504, 1516, 1524).Impact
Workaround
None currently. The worker crashes on every dispatch attempt, making kanban unusable on Windows.