Skip to content

[Bug] busy_input_mode: queue only works during gateway drain, not normal task execution #14905

@mattei2005

Description

@mattei2005

Bug: busy_input_mode: queue only works during gateway drain, not normal task execution

Description

The busy_input_mode: queue configuration in display.busy_input_mode only takes effect during gateway drain (restart/shutdown). During normal task execution, new incoming messages always interrupt the running agent with "⚡ Interrupting current task...", regardless of the config setting.

This contradicts the expected behavior documented in the code comments and the CLI's behavior:

# cli.py line 1846 (CLI mode — works correctly)
# busy_input_mode: "interrupt" (Enter interrupts current run) or "queue" (Enter queues for next turn)

Expected Behavior

When display.busy_input_mode: queue is set, new messages received while the agent is executing a task should:

  1. Not interrupt the running agent
  2. Be queued for processing as the next turn after the current task completes
  3. User receives an acknowledgment that the message was queued

Actual Behavior

Regardless of busy_input_mode setting, new messages during normal task execution:

  1. Always interrupt the running agent
  2. Show "⚡ Interrupting current task (X min elapsed, iteration N/M)..."
  3. The agent abandons the current tool-calling loop

Root Cause

gateway/run.py lines 1249-1250:

def _queue_during_drain_enabled(self) -> bool:
    return self._restart_requested and self._busy_input_mode == "queue"

This function gates queue mode behind _restart_requested, meaning queue mode only activates during gateway shutdown drain.

The function _handle_active_session_busy_message (line ~1554, "Normal busy case" branch) does not check self._busy_input_mode at all — it unconditionally interrupts the running agent.

Reproduction Steps

  1. Set display.busy_input_mode: queue in profile config.yaml
  2. Configure gateway with Discord platform
  3. Send Zeus a long-running task: "list all files recursively in /root and analyze"
  4. While agent is processing, send a second message: "hi, are you busy?"
  5. Observe: agent shows "⚡ Interrupting..." instead of "⏳ Message queued..."

Environment

  • Hermes version: 0.10.0
  • Commit: ce08916
  • Platform: Discord (gateway mode)
  • Profile config has display.busy_input_mode: queue

Suggested Fix

Add early return in _handle_active_session_busy_message checking _busy_input_mode before the interrupt logic. The pending_messages mechanism already handles queue processing — only the ack message and skip-interrupt logic need to be added.

I have a working local patch that I can submit as a PR if helpful. The change is ~25 lines, fully backward compatible (default behavior unchanged when busy_input_mode != "queue").

Impact

  • Users configure queue mode expecting it to work, but get interrupt behavior
  • Long-running tasks lose context when users send follow-up clarifications
  • Inconsistent behavior between CLI mode (works) and gateway mode (broken)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliverysweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions