hermes - ✅(Solved) Fix busy_input_mode=queue still interrupts process.wait() on new messages [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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#13403Fetched 2026-04-22 08:06:44
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
0
Timeline (top)
labeled ×5commented ×2cross-referenced ×1

When display.busy_input_mode is set to queue, sending a new message during an active gateway conversation can still interrupt a running process.wait() call. This appears to violate the expected queue semantics: follow-up messages should wait until the current task completes rather than interrupting tool execution.

Root Cause

Possible root cause

busy_input_mode=queue appears to control gateway/session follow-up handling, but process.wait() still honors a generic interrupt signal raised when a new message arrives. That creates an implementation mismatch between queued follow-up behavior and tool-level interruption.

PR fix notes

PR #13894: fix(gateway): enhance message handling during agent tasks with queue …

Description (problem / solution / changelog)

What does this PR do?

This PR fixes a bug in the gateway where messages sent while an agent was busy would always interrupt the active task, even when display.busy_input_mode: queue was configured.

The problem was that GatewayRunner._handle_active_session_busy_message unconditionally called agent.interrupt(). This caused long-running tools (like process.wait()) to abort prematurely with an "interrupted" status.

This fix aligns the gateway behavior with the existing logic in cli.py (around line 9138), where interruptions are correctly gated by the busy_input_mode setting.

Related Issue

Fixes #13403

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✅ Tests (adding or improving test coverage)

Changes Made

  • gateway/run.py: Updated _handle_active_session_busy_message to respect self._busy_input_mode. It now skips running_agent.interrupt() when in queue mode.
  • gateway/run.py: Updated the user acknowledgment for queue mode to: ⏳ Queued for the next turn... I'll respond once the current task finishes.
  • tests/gateway/test_busy_session_ack.py: Added a new test case test_queue_mode_suppresses_interrupt_and_updates_ack to ensure regression testing for this mode.

How to Test

  1. Set display.busy_input_mode: queue in your config.yaml.
  2. Start the gateway (hermes gateway run).
  3. Send a long task: "Run sleep 10 and tell me when done."
  4. While it's running, send a second message: "What time is it?"
  5. Expected Result: The sleep 10 completes fully (no "interrupted" note), and the second question is answered only after the sleep finishes.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • My PR contains only changes related to this fix
  • I've added tests for my changes
  • I've tested on my platform: macOS

Screenshots / Logs

Successful queue acknowledgment: ⏳ Queued for the next turn (running: terminal). I'll respond once the current task finishes.

Changed files

  • gateway/run.py (modified, +19/-17)
  • tests/gateway/test_busy_session_ack.py (modified, +35/-4)

Code Example

display:
  busy_input_mode: queue

---

{
  "status": "interrupted",
  "note": "User sent a new message -- wait interrupted"
}

---

display:
  busy_input_mode: queue
RAW_BUFFERClick to expand / collapse

Bug report draft: busy_input_mode=queue still interrupts process.wait() on new messages

Summary

When display.busy_input_mode is set to queue, sending a new message during an active gateway conversation can still interrupt a running process.wait() call. This appears to violate the expected queue semantics: follow-up messages should wait until the current task completes rather than interrupting tool execution.

Expected behavior

With:

display:
  busy_input_mode: queue

A new user message in the same gateway session should be queued and processed after the current task finishes. In particular, long-running waits on background processes should not be interrupted by the follow-up message.

Actual behavior

A follow-up message causes process.wait() to return early with:

{
  "status": "interrupted",
  "note": "User sent a new message -- wait interrupted"
}

The assistant then receives the system notice that the previous turn was interrupted.

Evidence collected

Local config was confirmed to contain:

display:
  busy_input_mode: queue

Relevant code paths observed in v2026.4.16:

  • gateway/run.py
    • _load_busy_input_mode() returns "queue" when config/env says queue.
  • tools/process_registry.py
    • wait() explicitly checks tools.interrupt.is_interrupted().
    • On interrupt, it returns early with note:
      • User sent a new message -- wait interrupted
  • tools/interrupt.py
    • interrupt signaling is thread-scoped and triggered by new-message interrupt handling.

This suggests queue semantics at the gateway/agent level are not fully aligned with tool-level interrupt handling for process.wait().

Why this looks like a bug

From the user perspective, busy_input_mode=queue promises “new messages wait instead of interrupting the current task.” But in practice, tool waiting can still be interrupted by a new message, so the current task is not fully protected from interruption.

Possible root cause

busy_input_mode=queue appears to control gateway/session follow-up handling, but process.wait() still honors a generic interrupt signal raised when a new message arrives. That creates an implementation mismatch between queued follow-up behavior and tool-level interruption.

Suggested fix directions

One of these likely needs to happen:

  1. In queue mode, do not set the interrupt signal for the active agent/tool thread when the follow-up should be queued.
  2. Or, make process.wait() ignore new-message interrupts when the current session is in queue mode.
  3. Or, make the queue/interrupt contract explicit in docs if current behavior is intentional (though it seems surprising and inconsistent).

Repro outline

  1. Set display.busy_input_mode: queue.
  2. Start a task that uses a background process and then waits with process.wait().
  3. While process.wait() is blocking, send another message in the same Telegram/gateway session.
  4. Observe that process.wait() exits early as interrupted instead of allowing the current task to finish and queuing the new message.

Environment

  • Hermes Agent version: v2026.4.16
  • Platform: Telegram gateway
  • Config: display.busy_input_mode: queue

extent analysis

TL;DR

To fix the issue, modify the process.wait() function to ignore new-message interrupts when the current session is in queue mode or prevent the interrupt signal from being set for the active agent/tool thread.

Guidance

  • Review the tools/interrupt.py file to understand how interrupt signaling is handled and consider modifying it to exclude new-message interrupts when busy_input_mode is set to queue.
  • Investigate the gateway/run.py file to see if the _load_busy_input_mode() function can be used to influence the interrupt behavior.
  • Modify the process.wait() function in tools/process_registry.py to check the current busy_input_mode and ignore interrupts if it's set to queue.
  • Test the changes using the repro outline provided to ensure that process.wait() is no longer interrupted by new messages when busy_input_mode is set to queue.

Example

# tools/process_registry.py
def wait(self):
    # ...
    if tools.interrupt.is_interrupted() and display.busy_input_mode != 'queue':
        # return early with note
    # ...

Notes

The fix may require changes to multiple files and a thorough understanding of the interrupt handling mechanism. It's essential to test the changes thoroughly to ensure that the queue mode behaves as expected.

Recommendation

Apply a workaround by modifying the process.wait() function to ignore new-message interrupts when the current session is in queue mode, as this seems to be the most straightforward solution. This change will ensure that the current task is not interrupted by new messages, aligning with the expected queue semantics.

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…

FAQ

Expected behavior

With:

display:
  busy_input_mode: queue

A new user message in the same gateway session should be queued and processed after the current task finishes. In particular, long-running waits on background processes should not be interrupted by the follow-up message.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix busy_input_mode=queue still interrupts process.wait() on new messages [1 pull requests, 2 comments, 3 participants]