test(kanban): assert DM wake resumes the creator's real DM session key

Strengthen the salvaged regression test to prove the end-to-end claim in
#56580/#68874: a DM-created task's terminal wake must build the creator's
':dm:<chat_id>' session key via build_session_key(), not a group-scoped
key that forks a fresh session. Sabotage-verified: reverting the watcher
to the hardcoded chat_type='group' fails this test.
This commit is contained in:
teknium1 2026-07-26 13:13:47 -07:00 committed by Teknium
parent a766f85042
commit 2a2ae3bca1

View file

@ -330,6 +330,16 @@ def test_notifier_wakeup_uses_subscription_chat_type(tmp_path, monkeypatch):
assert len(adapter.handled) == 1
assert adapter.handled[0].source.chat_type == "dm"
# The wake must resume the creator's real DM session key — the whole bug
# was that a hardcoded chat_type="group" made build_session_key() produce
# a group-scoped key (a NEW session) instead of the ":dm:<chat_id>" shape
# the original conversation runs under (#56580 / #68874).
from gateway.session import build_session_key
wake_key = build_session_key(adapter.handled[0].source)
assert wake_key == "agent:main:telegram:dm:chat-dm"
assert ":group:" not in wake_key
def test_auto_subscribe_persists_session_chat_type(tmp_path, monkeypatch):
db_path = tmp_path / "auto-sub-chat-type.db"