hermes - 💡(How to fix) Fix Telegram /new confirm button hangs in `_handle_reset_command()` state machine deadlock

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…

Error Message

  • Clicking confirm button should start a fresh session or return an error message

Root Cause

The hang occurs in _handle_reset_command() during the Telegram callback chain:

  1. User clicks confirm button in Telegram
  2. Telegram sends callback query to Hermes
  3. Gateway processes the confirmation
  4. _handle_reset_command() is called to clean up old session
  5. Resource cleanup takes too long / rate limiting / state machine fails to properly close old session
  6. Gateway enters deadlocked state

Fix Action

Fix / Workaround

  • Telegram bot: macauhermesbot
  • Platform: Telegram
  • Trigger: Confirmation button in group chat
  • Workaround: Set approvals.destructive_slash_confirm: false in config, or use /new directly via CLI to bypass button confirmation
RAW_BUFFERClick to expand / collapse

🐛 Bug Description

When a user clicks the confirmation button in a Telegram group chat, the callback triggers a /new command, but the system hangs indefinitely in _handle_reset_command(). The user sees no response — the bot becomes unresponsive.

This is a state machine deadlock specifically triggered by Telegram confirmation button callbacks during session reset.

Expected Behavior

  • Clicking confirm button should start a fresh session or return an error message
  • Gateway should handle the callback gracefully without hanging

Actual Behavior

  • System hangs indefinitely
  • No response to user
  • Bot appears "dead" until gateway is restarted or /stop is forced

Root Cause Analysis

The hang occurs in _handle_reset_command() during the Telegram callback chain:

  1. User clicks confirm button in Telegram
  2. Telegram sends callback query to Hermes
  3. Gateway processes the confirmation
  4. _handle_reset_command() is called to clean up old session
  5. Resource cleanup takes too long / rate limiting / state machine fails to properly close old session
  6. Gateway enters deadlocked state

Environment

  • Telegram bot: macauhermesbot
  • Platform: Telegram
  • Trigger: Confirmation button in group chat
  • Workaround: Set approvals.destructive_slash_confirm: false in config, or use /new directly via CLI to bypass button confirmation

Related Issues

  • #2910: Telegram message delivery failure not surfaced (different root cause)
  • #5819: Bot silently ignores new messages (different root cause)
  • #7536: Stuck session creates unrecoverable loop on restart (related symptom)
  • #18912: Race condition in session management (related)
  • #6426: Deadlock in command processing (related)

Proposed Fix Directions

  1. Add timeout to _handle_reset_command() with graceful degradation
  2. Properly close old session state machine before starting new one
  3. Surface errors to user when reset fails
  4. Consider making session cleanup async with proper cancellation tokens

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

hermes - 💡(How to fix) Fix Telegram /new confirm button hangs in `_handle_reset_command()` state machine deadlock