fix: skip heartbeat/internal sessions (agent:main:main) from status box creation

Heartbeat sessions (key pattern agent:<agent>:main) have no real Mattermost
conversation context. The daemon was resolving them to the DM fallback channel
and creating a new status box on every heartbeat cycle (~every 30min but firing
rapidly during active work). Each one appeared as a separate live status post.

Fix: in session-added handler, skip any session key matching /^agent:[^:]+:main$/
or /^agent:[^:]+:cli$/ before creating a status box.
This commit is contained in:
Xen
2026-03-09 20:01:06 +00:00
parent 888e8af784
commit e483b0bc42

View File

@@ -262,6 +262,14 @@ async function startDaemon() {
return;
}
// Skip heartbeat/internal sessions (agent:main:main, agent:main:cli, etc.)
// These have no real Mattermost conversation context and produce spurious status boxes.
// A heartbeat session key ends with ':main' and has no channel/thread suffix.
if (/^agent:[^:]+:main$/.test(sessionKey) || /^agent:[^:]+:cli$/.test(sessionKey)) {
logger.debug({ sessionKey }, 'Heartbeat/internal session — skipping status box');
return;
}
// Enforce MAX_ACTIVE_SESSIONS
if (activeBoxes.size >= config.maxActiveSessions) {
logger.warn(