hermes - 💡(How to fix) Fix QQ bot: approval button clicks always rejected due to chat_type mismatch (c2c vs dm)

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…

Root Cause

In gateway/platforms/qqbot/adapter.py, the _is_authorized_interaction_for_session method (line 1089) only matches chat_type == "c2c":

if chat_type == "c2c":
    return bool(chat_id) and operator == chat_id

However, Hermes' session model (gateway/session.py line 83) uses chat_type = "dm" as the default for all direct message sessions. The session key format is agent:main:qqbot:dm:<chat_id>, which parses to chat_type = "dm", never matching "c2c".

Fix Action

Fix

Change line 1089 from:

if chat_type == "c2c":

to:

if chat_type in ("c2c", "dm"):

Code Example

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

---

if chat_type == "c2c":
    return bool(chat_id) and operator == chat_id

---

if chat_type == "c2c":

---

if chat_type in ("c2c", "dm"):
RAW_BUFFERClick to expand / collapse

Bug description

When using QQ bot (QQBot adapter), approval button clicks (e.g., "allow-once", "allow-always") for dangerous command execution are always rejected. Users click the approve button on QQ, but the gateway returns:

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

This blocks all tool approvals (terminal, execute_code, etc.), causing commands to time out after ~280s without user response.

Root cause

In gateway/platforms/qqbot/adapter.py, the _is_authorized_interaction_for_session method (line 1089) only matches chat_type == "c2c":

if chat_type == "c2c":
    return bool(chat_id) and operator == chat_id

However, Hermes' session model (gateway/session.py line 83) uses chat_type = "dm" as the default for all direct message sessions. The session key format is agent:main:qqbot:dm:<chat_id>, which parses to chat_type = "dm", never matching "c2c".

Fix

Change line 1089 from:

if chat_type == "c2c":

to:

if chat_type in ("c2c", "dm"):

Steps to reproduce

  1. Connect QQ bot to Hermes gateway
  2. Send a message that triggers a tool requiring approval (e.g., "run a terminal command")
  3. Click the approve button on QQ
  4. Observe "Rejected unauthorized approval click" in gateway logs

Environment

  • Hermes Agent installed via pip
  • Platform: QQBot (C2C/direct message)
  • Session key format: agent:main:qqbot:dm:<chat_id>

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 QQ bot: approval button clicks always rejected due to chat_type mismatch (c2c vs dm)