fix: re-detect sessions after idle cleanup

Added forgetSession() to SessionMonitor. When watcher marks a session
idle/done, it now clears the key from the monitor's known sessions map.
Next poll cycle re-detects the session if the transcript is still active,
creating a fresh status post.
This commit is contained in:
sol
2026-03-07 18:52:44 +00:00
parent 6d31d77567
commit 3a8532bb30
2 changed files with 11 additions and 1 deletions

View File

@@ -339,9 +339,10 @@ async function startDaemon() {
logger.warn({ sessionKey, err: unpinErr }, 'Failed to unpin status post');
}
// Clean up
// Clean up — remove from all tracking so session can be re-detected if it becomes active again
activeBoxes.delete(sessionKey);
watcher.removeSession(sessionKey);
monitor.forgetSession(sessionKey);
globalMetrics.activeSessions = activeBoxes.size;
// Persist final offsets