fix: isolate maintenance-session compaction notifications (#5874)
* fix: keep heartbeat compaction notices off user channels * refactor: centralize maintenance session identity
This commit is contained in:
1 parent
c8ed6a1209
commit
d149232621
7 files changed
+96
-17
No files matched your search
@@ -6,9 +6,20 @@ from collections.abc import Mapping, MutableMapping
|
||||
from typing import Any
|
||||
|
||||
UNIFIED_SESSION_KEY = "unified:default"
|
||||
HEARTBEAT_SESSION_KEY = "heartbeat"
|
||||
LAST_CHANNEL_METADATA_KEY = "last_channel"
|
||||
|
||||
|
||||
def is_dream_session(key: str) -> bool:
|
||||
"""Identify the per-run session namespace owned by Dream."""
|
||||
return key.startswith("dream:")
|
||||
|
||||
|
||||
def is_internal_session(key: str) -> bool:
|
||||
"""Identify maintenance sessions whose context is not a user conversation."""
|
||||
return key == HEARTBEAT_SESSION_KEY or is_dream_session(key)
|
||||
|
||||
|
||||
def session_key_for_channel(channel: str, chat_id: str, *, unified_session: bool = False) -> str:
|
||||
"""Return the session key for a channel/chat pair."""
|
||||
if unified_session:
|
||||
|
||||
Reference in new issue
Block a user