The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(qqbot): exercise the real dm session key in the existing approval-click test
kshitijk4poore5382cd8238b
diff --git a/gateway/platforms/qqbot/adapter.py b/gateway/platforms/qqbot/adapter.pyindex 2be580af113..379e6a82c01 100644--- a/gateway/platforms/qqbot/adapter.py+++ b/gateway/platforms/qqbot/adapter.py@@ -668,6 +668,7 @@ class QQAdapter(BasePlatformAdapter):chat_type = parsed.get("chat_type", "")chat_id = parsed.get("chat_id", "")+ # Approval keys come from build_source (chat_type="dm"); update-prompt keys from event.scene ("c2c").if chat_type in {"c2c", "dm"}:return bool(chat_id) and operator == chat_idif chat_type in {"group", "guild"}:diff --git a/tests/gateway/test_qqbot.py b/tests/gateway/test_qqbot.pyindex 5e7b47a59b2..da63201a3b3 100644--- a/tests/gateway/test_qqbot.py+++ b/tests/gateway/test_qqbot.py@@ -920,13 +920,13 @@ class TestDefaultInteractionDispatch:"id": "i","chat_type": 2,"user_openid": "u-42",- "data": {"resolved": {"button_data": "approve:agent:main:qqbot:c2c:u-42:allow-once"}},+ "data": {"resolved": {"button_data": "approve:agent:main:qqbot:dm:u-42:allow-once"}},})await adapter._default_interaction_dispatch(event)finally:tools.approval.resolve_gateway_approval = orig- assert resolve_calls == [("agent:main:qqbot:c2c:u-42", "once", False)]+ assert resolve_calls == [("agent:main:qqbot:dm:u-42", "once", False)]@pytest.mark.asyncio@@ -955,33 +955,6 @@ class TestDefaultInteractionDispatch:assert resolve_calls == []- @pytest.mark.asyncio- async def test_approval_click_dm_session_authorizes_owner(self):- """dm-typed session key with matching operator should be authorized."""- adapter = self._make_adapter()- resolve_calls = []-- def fake_resolve(session_key, choice, resolve_all=False):- resolve_calls.append((session_key, choice, resolve_all))- return 1-- import tools.approval- orig = tools.approval.resolve_gateway_approval- tools.approval.resolve_gateway_approval = fake_resolve- try:- from gateway.platforms.qqbot.keyboards import parse_interaction_event- event = parse_interaction_event({- "id": "i",- "chat_type": 2,- "user_openid": "u-42",- "data": {"resolved": {"button_data": "approve:agent:main:qqbot:dm:u-42:allow-once"}},- })- await adapter._default_interaction_dispatch(event)- finally:- tools.approval.resolve_gateway_approval = orig-- assert resolve_calls == [("agent:main:qqbot:dm:u-42", "once", False)]-@pytest.mark.asyncioasync def test_update_prompt_click_writes_response_file(self, tmp_path, monkeypatch):"""update_prompt:y click writes 'y' to ~/.hermes/.update_response."""