Skip to content

fix: add TTY guard in _offer_launch_chat to prevent crash in non-inte… - #7469

Closed
tomly wants to merge 1 commit into
NousResearch:mainfrom
tomly:fix-tty-guard-setup-chat
Closed

fix: add TTY guard in _offer_launch_chat to prevent crash in non-inte…#7469
tomly wants to merge 1 commit into
NousResearch:mainfrom
tomly:fix-tty-guard-setup-chat

Conversation

@tomly

@tomly tomly commented Apr 11, 2026

Copy link
Copy Markdown

…ractive environments

When hermes setup is run in a non-interactive environment (e.g., sandbox, pipe, or automated script), _offer_launch_chat() would call cmd_chat() without checking TTY availability, causing prompt_toolkit to crash with:

OSError: [Errno 22] Invalid argument
(kqueue selector cannot register stdin fd=0 in non-TTY)

This patch adds a guard using is_interactive_stdin() to gracefully exit with helpful guidance instead of crashing.

Fixes issue discovered in OpenClaw sandbox environment where:

  • tty returns 'not a tty'
  • Terminal type is 'openclaw-gateway' (sandbox)

What does this PR do?

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

How to Test

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform:

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

…ractive environments

When hermes setup is run in a non-interactive environment (e.g., sandbox,
pipe, or automated script), _offer_launch_chat() would call cmd_chat()
without checking TTY availability, causing prompt_toolkit to crash with:

  OSError: [Errno 22] Invalid argument
  (kqueue selector cannot register stdin fd=0 in non-TTY)

This patch adds a guard using is_interactive_stdin() to gracefully exit
with helpful guidance instead of crashing.

Fixes issue discovered in OpenClaw sandbox environment where:
- tty returns 'not a tty'
- Terminal type is 'openclaw-gateway' (sandbox)
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #8420 — same fix (TTY guard in setup chat launch). See also #8641 (tracking issue), #13454, #6415 (competing fix PRs).

@teknium1

Copy link
Copy Markdown
Contributor

Closing as stale — the code path this addresses no longer exists on main.

Triage notes (high confidence):
_offer_launch_chat() no longer exists in hermes_cli/setup.py on main; removed by merged PR #25067 'fix(setup): drop post-setup chat handoff'.

If this PR's intent is still relevant against the current code, please rebase or open a fresh PR.

(Bulk-closed during a CLI PR triage sweep.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants