fix(cli): guard interactive chat without tty - #22361
Open
yyydao wants to merge 1 commit into
Open
Conversation
Collaborator
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the focused guard and regression coverage.
Suggested changes
- Please add a no-TTY
--imageregression case next to the new-qcase. Currentcli.py:16043makes eitherqueryorimageselect the one-shot path, and the proposed guard intentionally exempts both. Covering the image branch will preserve the behavior stated in this PR.
The premise remains valid on current main: hermes_cli/main.py:2404 invokes the classic CLI after the no-provider check, and cli.py:16265 enters its interactive prompt_toolkit loop whenever neither query nor image is supplied. This is an automated hermes-sweeper review.
| assert "hermes chat" in err | ||
| assert "requires an interactive terminal" in err | ||
|
|
||
| def test_chat_headless_single_query_still_allowed(self): |
Contributor
There was a problem hiding this comment.
Please add the equivalent no-TTY image=... case here. cli.py:16043 treats an image without -q as one-shot mode too, and the production guard explicitly exempts it.
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.
Summary
- Add an early TTY guard for interactive hermes chat / bare hermes
- Avoid prompt_toolkit crashing on macOS when stdin is a pipe or regular file
- Keep hermes chat -q ... and image single-query flows usable in non-interactive environments