Skip to content

fix: _SafeWriter for broken stdout + doctor MiniMax + vision logging#955

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-cf9f7d54
Mar 11, 2026
Merged

fix: _SafeWriter for broken stdout + doctor MiniMax + vision logging#955
teknium1 merged 1 commit intomainfrom
hermes/hermes-cf9f7d54

Conversation

@teknium1
Copy link
Contributor

@teknium1 teknium1 commented Mar 11, 2026

Three fixes:

1. _SafeWriter — guard all print() against OSError (Fixes #845)

When hermes-agent runs as a systemd service or headless daemon, stdout can become unavailable, causing print() to raise OSError: [Errno 5]. This crashes run_conversation() — especially via double-fault when the except handler also tries to print.

PR #858 attempted to fix this by wrapping 7 individual print() calls, but run_conversation() has 68 print() calls, and the PR left adjacent prints in the same blocks unguarded.

Our fix: A transparent _SafeWriter wrapper installed once at the start of run_conversation(). It delegates all writes to the real stdout and silently catches OSError. Zero overhead when stdout is healthy, comprehensive coverage of all print calls including future ones.

  • 6 tests covering: normal delegation, OSError catch on write/flush, print survival, installation in run_conversation, double-wrap prevention

2. Doctor MiniMax fix (Fixes #811)

Cherry-picked from PR #822 by @Bartok9. MiniMax providers now show ✓ (key configured) instead of false HTTP 404.

3. Vision logging

Log an error when vision client is unavailable (previously silent). Inspired by PR #839 by @aydnOktay.


Tests: 3252 passed (2 pre-existing unrelated failures)

Previously the early return for unconfigured vision model was silent.
Now logs an error so the failure is visible in logs for debugging.

Inspired by PR #839 by aydnOktay.

Co-authored-by: aydnOktay <aydnOktay@users.noreply.github.com>
@teknium1 teknium1 merged commit 9b58b9b into main Mar 11, 2026
@teknium1 teknium1 changed the title fix(vision): log error when vision client is unavailable + doctor MiniMax fix fix: _SafeWriter for broken stdout + doctor MiniMax + vision logging Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant