fix: exclude archived keys in heartbeat & fallback missing session timestamps

This commit is contained in:
Heng Wei Bin authored and Xubin Ren committed 2026-06-24 15:45:49 +08:00
1 parent 9c6eaf0bed
commit de4009efbd
4 files changed
+57 -4

No files matched your search

+7
View File
@@ -1065,8 +1065,15 @@ def _run_gateway(
def _pick_heartbeat_target() -> tuple[str, str]:
"""Pick a routable channel/chat target for heartbeat-triggered messages."""
enabled = set(channels.enabled_channels)
from nanobot.webui.sidebar_state import read_webui_sidebar_state
sidebar_state = read_webui_sidebar_state()
archived_keys = set(sidebar_state.get("archived_keys", []))
for item in session_manager.list_sessions():
key = item.get("key") or ""
if key in archived_keys:
continue
if ":" not in key:
continue
channel, chat_id = key.split(":", 1)