hermes - 💡(How to fix) Fix QQ Bot: WebSocket reconnect causes approval deadlock (session mismatch)

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

WARNING gateway.platforms.qqbot.adapter: [QQBot:1904121396] WebSocket closed: code=4009 reason=Session timed out
...
WARNING gateway.platforms.qqbot.adapter: [QQBot:1904121396] Rejected unauthorized approval click for session agent:main:qqbot:dm:A37B46B0A04E3326D727DFD81FCFEBA9
WARNING agent.tool_executor: Tool terminal returned error (295.58s): BLOCKED: Command timed out without user response

Fix Action

Workaround

Currently using a watchdog script that SIGKILLs the gateway when the deadlock pattern is detected, relying on systemd auto-restart:

journalctl --user -u hermes-gateway.service -n 50 | grep -q "Rejected unauthorized approval click" && systemctl --user kill -s SIGKILL hermes-gateway.service

Code Example

Rejected unauthorized approval click for session agent:main:qqbot:dm:XXX (operator=XXX)

---

WARNING gateway.platforms.qqbot.adapter: [QQBot:1904121396] WebSocket closed: code=4009 reason=Session timed out
...
WARNING gateway.platforms.qqbot.adapter: [QQBot:1904121396] Rejected unauthorized approval click for session agent:main:qqbot:dm:A37B46B0A04E3326D727DFD81FCFEBA9
WARNING agent.tool_executor: Tool terminal returned error (295.58s): BLOCKED: Command timed out without user response

---

journalctl --user -u hermes-gateway.service -n 50 | grep -q "Rejected unauthorized approval click" && systemctl --user kill -s SIGKILL hermes-gateway.service
RAW_BUFFERClick to expand / collapse

Environment

  • Platform: QQ Bot
  • Hermes version: latest
  • OS: WSL2 Ubuntu 24.04

Bug Description

When QQ Bot WebSocket disconnects (code=4009 Session timed out, which QQ servers enforce ~every 30 minutes), the gateway reconnects automatically — but old session's pending approval requests are rejected in the new session due to session mismatch, creating an infinite deadlock.

Reproduction

  1. QQ Bot connects and is processing normally
  2. QQ server drops WebSocket with code=4009 (normal server-side timeout)
  3. Gateway reconnects with new WebSocket session
  4. Any pending approval request from the old session is rejected:
    Rejected unauthorized approval click for session agent:main:qqbot:dm:XXX (operator=XXX)
  5. The agent enters a loop: command waits 295s for user approval → timeout → retry → rejected again → infinite loop

Logs

WARNING gateway.platforms.qqbot.adapter: [QQBot:1904121396] WebSocket closed: code=4009 reason=Session timed out
...
WARNING gateway.platforms.qqbot.adapter: [QQBot:1904121396] Rejected unauthorized approval click for session agent:main:qqbot:dm:A37B46B0A04E3326D727DFD81FCFEBA9
WARNING agent.tool_executor: Tool terminal returned error (295.58s): BLOCKED: Command timed out without user response

Expected Behavior

On WebSocket reconnect, pending approvals from the old session should either be:

  • Auto-cleared/cancelled, OR
  • Transferred to the new session, OR
  • At minimum, not cause an infinite retry loop

Workaround

Currently using a watchdog script that SIGKILLs the gateway when the deadlock pattern is detected, relying on systemd auto-restart:

journalctl --user -u hermes-gateway.service -n 50 | grep -q "Rejected unauthorized approval click" && systemctl --user kill -s SIGKILL hermes-gateway.service

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