fix(chat): require interactive TTY for cmd_chat - #7865
Closed
madsmmfu wants to merge 1 commit into
Closed
Conversation
Without this guard, running `hermes chat` in any environment where stdin
is not a real TTY (pipe, detached parent, kqueue-unfriendly fd, etc.)
crashes inside prompt_toolkit's `Vt100Input._attached_input` with:
OSError: [Errno 22] Invalid argument
at loop.add_reader(fd, callback_wrapper)
prompt_toolkit only catches `PermissionError` there (which epoll raises
on Linux for /dev/null); the macOS kqueue selector raises `OSError`
instead, and nothing in the chat run() try/except handles it, so the
process dies after printing the welcome banner and exit summary.
This mirrors the existing `_require_tty()` guards already used by the
other interactive commands (`setup`, `model`, `whatsapp`, `uninstall`,
`tools`, `skills config`). Single-shot mode (`-q/--query` or
`-i/--image`) still works without a TTY, since those paths never enter
prompt_toolkit's interactive loop.
Collaborator
Contributor
|
Thanks for identifying the macOS stdin-registration failure. This is now covered by a lower-level fix on Automated hermes-sweeper review evidence:
This preserves usable headless paths rather than rejecting every non-TTY chat invocation. |
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.
Without this guard, running
hermes chatin any environment where stdinis not a real TTY (pipe, detached parent, kqueue-unfriendly fd, etc.)
crashes inside prompt_toolkit's
Vt100Input._attached_inputwith:prompt_toolkit only catches
PermissionErrorthere (which epoll raiseson Linux for /dev/null); the macOS kqueue selector raises
OSErrorinstead, and nothing in the chat run() try/except handles it, so the
process dies after printing the welcome banner and exit summary.
This mirrors the existing
_require_tty()guards already used by theother interactive commands (
setup,model,whatsapp,uninstall,tools,skills config). Single-shot mode (-q/--queryor-i/--image) still works without a TTY, since those paths never enterprompt_toolkit's interactive loop.