Skip to content

fix(qqbot): authorize dm approval interactions - #46154

Closed
Diyoncrz18 wants to merge 1 commit into
NousResearch:mainfrom
Diyoncrz18:fix/qqbot-dm-approval-35760
Closed

fix(qqbot): authorize dm approval interactions#46154
Diyoncrz18 wants to merge 1 commit into
NousResearch:mainfrom
Diyoncrz18:fix/qqbot-dm-approval-35760

Conversation

@Diyoncrz18

Copy link
Copy Markdown
Contributor

Fixes #35760
Refs #40655

What does this PR do?

This fixes QQBot approval interaction authorization for direct-message sessions.

Hermes creates QQBot direct-message sessions with chat_type="dm", while the QQBot approval authorization check only treated chat_type="c2c" as a direct chat. As a result, approval button clicks from QQ direct messages could be rejected even when the operator matched the chat id.

This PR treats both c2c and dm as QQBot direct chat types for approval authorization while preserving the existing operator == chat_id check.

Changes Made

  • Allow QQBot approval authorization for dm direct-message session keys.
  • Preserve existing c2c behavior.
  • Keep mismatched operators rejected.
  • Add regression coverage for dm approval clicks and c2c backward compatibility.

How to Test

  1. Simulate a QQBot approval interaction for a session key like agent:main:qqbot:dm:<chat_id>.
  2. Use the same QQ operator id as <chat_id>.
  3. Verify the interaction is authorized.
  4. Verify mismatched operators are still rejected.

Validation

Run locally:

python -m py_compile gateway/platforms/qqbot/adapter.py tests/gateway/test_qqbot.py
git diff --check

Not run locally:

pytest tests/gateway/test_qqbot.py -q
python -m pytest tests/gateway/test_qqbot.py -q

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/qqbot QQ Bot adapter duplicate This issue or pull request already exists labels Jun 14, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #31593 — this is part of the large QQBot DM-approval one-line-fix cluster (treat chat_type 'dm' the same as 'c2c' for approval authorization, fixing #35760/#32528). #31593 is the earliest still-open PR in the cluster; other open siblings include #32752, #36774, #40705, #40926, #41801. Marking duplicate for cluster consolidation.

@Diyoncrz18

Copy link
Copy Markdown
Contributor Author

Closing this as a duplicate of #31593 for the QQBot DM approval authorization cluster consolidation. Thanks for checking and consolidating the related PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/qqbot QQ Bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QQ bot: approval button clicks always rejected due to chat_type mismatch (c2c vs dm)

2 participants