fix: _SafeWriter for broken stdout + doctor MiniMax + vision logging#955
Merged
fix: _SafeWriter for broken stdout + doctor MiniMax + vision logging#955
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 raiseOSError: [Errno 5]. This crashesrun_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
_SafeWriterwrapper installed once at the start ofrun_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.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)