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:
@@ -262,6 +262,14 @@ async function startDaemon() {
|
|||||||
return;
|
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
|
// Enforce MAX_ACTIVE_SESSIONS
|
||||||
if (activeBoxes.size >= config.maxActiveSessions) {
|
if (activeBoxes.size >= config.maxActiveSessions) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
|
|||||||
Reference in New Issue
Block a user