hermes - ✅(Solved) Fix CLI hangs indefinitely when agent thread blocks — interrupt_queue drain removed in v0.12.0 [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#20271Fetched 2026-05-06 06:37:39
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×4cross-referenced ×1

The Hermes Agent CLI (non-TUI mode) randomly hangs: pressing Enter on a prompt does nothing, Ctrl-C is ignored, and the only way to exit is Ctrl-Z to background the process then kill it. This started after updating to v0.12.0.

Root Cause

Commit 7696ddc59 (May 2, 2026) removed the interrupt_queuepending_input drain with a comment that it was "worth its own review." That review never happened. Without the drain, pending interrupts never flush into _pending_input when the agent thread blocks, causing the CLI to hang indefinitely.

Fix Action

Fix

Restore the interrupt_queuepending_input drain that was removed in commit 7696ddc59. This is a one-line regression fix.

PR fix notes

PR #20437: fix(cli): re-land interrupt_queue drain so finished turns flush stray input

Description (problem / solution / changelog)

What does this PR do?

The CLI routes user input typed while _agent_running is True into _interrupt_queue (separate from _pending_input) so the explicit interrupt path can opt to deliver them as a single combined message. That path only drains the queue when busy_input_mode == "interrupt" AND a pending_message was acknowledged.

If the agent's turn finishes naturally (no interrupt fires), any messages typed during the turn stay stuck in _interrupt_queue forever. Subsequent user input can be swallowed behind that stale queue state, making the CLI appear to hang. lunarnexus reports in #20271 that only Ctrl+Z + kill recovers.

The fix restores the post-turn drain that was originally part of #17939. #17666 / #18760 (commit 7696ddc59) explicitly split the drain off as "worth its own review" and never re-landed it; the user-visible regression is that any non-interrupt-mode user typing during a turn is silently dropped.

Implementation extracts the drain to _drain_interrupt_queue_to_pending_input, matching the existing _maybe_continue_goal_after_turn style. process_loop's finally block calls it once per turn after the status-line refresh and before goal continuation (so re-queued user input preempts an auto-continuation prompt). The helper swallows Exception so it can never break the main loop.

Related Issue

Closes #20271

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • cli.py: new _drain_interrupt_queue_to_pending_input helper on HermesCLI; one call from process_loop's finally block.
  • tests/cli/test_cli_interrupt_drain_regression.py: 5 cases covering single message, multi-message order preservation, empty-queue noop, falsy-message skip, and exception swallowing.

How to Test

  1. pytest tests/cli/test_cli_interrupt_drain_regression.py -v — 5/5 pass.
  2. Verify regression: stash the cli.py change and rerun — all 5 fail (helper doesn't exist on main).
  3. Wider sweep: pytest tests/cli/ -q — 610/610 pass.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs (none — issue-# search and "interrupt_queue" / "pending_input drain" symptom searches return only the parent #17666 / #18760 work)
  • My PR contains only changes related to this fix
  • I've run pytest tests/cli/ -q and all tests pass
  • I've added tests for my changes
  • I've tested on my platform: macOS 15 (Darwin 24.6.0), Python 3.14

Documentation & Housekeeping

  • I've updated relevant documentation — N/A (internal helper, no public surface)
  • I've updated cli-config.yaml.example — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — N/A
  • I've considered cross-platform impact — yes, drain is pure-Python queue logic
  • I've updated tool descriptions/schemas — N/A

Changed files

  • cli.py (modified, +34/-0)
  • tests/cli/test_cli_interrupt_drain_regression.py (added, +138/-0)
RAW_BUFFERClick to expand / collapse

Description

The Hermes Agent CLI (non-TUI mode) randomly hangs: pressing Enter on a prompt does nothing, Ctrl-C is ignored, and the only way to exit is Ctrl-Z to background the process then kill it. This started after updating to v0.12.0.

Root Cause

Commit 7696ddc59 (May 2, 2026) removed the interrupt_queuepending_input drain with a comment that it was "worth its own review." That review never happened. Without the drain, pending interrupts never flush into _pending_input when the agent thread blocks, causing the CLI to hang indefinitely.

Expected Behavior

Pending interrupts should be flushed into _pending_input so the CLI can process them even when the agent thread is blocked. Ctrl-C should interrupt the hang.

Actual Behavior

The CLI hangs. Enter and Ctrl-C do nothing. Only Ctrl-Z + kill works.

Fix

Restore the interrupt_queuepending_input drain that was removed in commit 7696ddc59. This is a one-line regression fix.

Environment

  • Hermes Agent version: v0.12.0+ (post-May 2, 2026)
  • Mode: CLI (non-TUI)
  • OS: Ubuntu 24.x

Reproduction

  1. Run hermes agent in CLI mode
  2. Trigger a condition where the agent thread blocks (e.g., approval prompt scenario)
  3. Press Enter or Ctrl-C — the CLI hangs

extent analysis

TL;DR

Restoring the interrupt_queuepending_input drain is likely to fix the Hermes Agent CLI hang issue.

Guidance

  • Review commit 7696ddc59 to understand the removed code and its intended functionality.
  • Verify that the agent thread blocking is the root cause of the hang by reproducing the issue with the approval prompt scenario.
  • Consider downgrading to a version prior to v0.12.0 as a temporary workaround until the fix is officially released.
  • Test the fix by running hermes agent in CLI mode and triggering the agent thread block, then pressing Enter or Ctrl-C to ensure the CLI no longer hangs.

Example

No code snippet is provided as the fix is described as a one-line regression fix, but it involves restoring the removed interrupt_queuepending_input drain.

Notes

The fix is specific to versions v0.12.0 and later, and only affects the CLI mode of the Hermes Agent. The issue does not occur in TUI mode.

Recommendation

Apply the workaround by downgrading to a version prior to v0.12.0, as the official fix is not yet available. This will prevent the CLI from hanging when the agent thread blocks.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING