fix: guard interactive startup without tty - #19092
Open
TinyTb wants to merge 1 commit into
Open
Conversation
Collaborator
1 similar comment
Collaborator
This was referenced May 9, 2026
teknium1
reviewed
Jul 12, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for addressing the no-TTY startup path. A configured classic chat still reaches cli.main() without an early TTY gate on current head (hermes_cli/main.py:2404-2430), while the legacy developer setup script still prompts unconditionally (setup-hermes.sh:455-461).
Problems
- The proposed guard checks only
args.query(hermes_cli/main.py:1270in this PR). That would reject--imagewith no TTY, although current main treats an image as a non-interactive single-query input (hermes_cli/_parser.py:272;hermes_cli/main.py:12560). - The first-run setup portion is already covered: current main exits with non-interactive guidance before prompting (
hermes_cli/main.py:2327-2331), and commit256bedb632ece7b9142a20f4e830f5a5fe48ad5fremoved post-setup chat relaunching.
Suggested changes
- Salvage the direct guard against current
cmd_chat(), exempting both query and image single-query modes, and add a no-TTY image regression test. - Keep the setup-script and README changes scoped to the legacy contributor path.
Automated hermes-sweeper review.
| # UI will crash on some platforms (notably macOS/kqueue) if stdin is not a | ||
| # selectable TTY. Fail early with actionable guidance instead of showing a | ||
| # traceback from loop.add_reader(fd=0). | ||
| if not getattr(args, "query", None) and not sys.stdin.isatty(): |
Contributor
There was a problem hiding this comment.
--image is also a single-query input: current dispatch uses not query and not image to identify an interactive prompt (hermes_cli/main.py:12560). Please exempt args.image here as well and add a no-TTY image-path regression test; otherwise this guard rejects a supported headless single-query mode.
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.
Problem
During initial setup, Hermes could offer to start the setup/chat flow even when it did not have a usable interactive TTY. In that state, the prompt_toolkit CLI could print the welcome/goodbye text and then crash with a traceback like:
This happens because the interactive CLI tries to attach an asyncio reader to stdin fd 0, but fd 0 is not a selectable terminal in non-interactive contexts. The resulting traceback is confusing for new users and makes setup look broken.
There was also a README post-install example that led with
source ~/.bashrc, even though macOS users on the default zsh shell needsource ~/.zshrc.Summary
hermes/hermes chatis launched without a TTY, while preservinghermes chat -qfor non-interactive usehermes setuplaterTest Plan
/Users/hermes/.hermes/hermes-agent/venv/bin/python -m pytest tests/hermes_cli/test_setup_noninteractive.py tests/hermes_cli/test_setup_hermes_script.py -q/Users/hermes/.hermes/hermes-agent/venv/bin/python -m py_compile hermes_cli/main.py hermes_cli/setup.pybash -n setup-hermes.sh