The summarizeSessions method in ai/mcp/server/memory-core/services/SessionService.mjs can inadvertently summarize the currently active session.
This can happen in two scenarios:
- Drift Detection: The
findSessionsToSummarize method detects the current session as having a mismatch between DB memories and the summary (since the summary doesn't exist or is outdated), flagging it for summarization.
- Manual Trigger: An agent manually calls the
summarize_sessions tool with the current session ID or without arguments (triggering case 1).
Summarizing the active session is premature as the session is still ongoing. This leads to incomplete summaries and potentially multiple summary entries for the same session.
Goal:
Add a guard clause in SessionService to explicitly exclude this.currentSessionId from being summarized, both when finding sessions automatically and when a specific sessionId is requested.
Task:
- Modify
SessionService.mjs (around line 291 in summarizeSessions) to filter out this.currentSessionId.
The
summarizeSessionsmethod inai/mcp/server/memory-core/services/SessionService.mjscan inadvertently summarize the currently active session. This can happen in two scenarios:findSessionsToSummarizemethod detects the current session as having a mismatch between DB memories and the summary (since the summary doesn't exist or is outdated), flagging it for summarization.summarize_sessionstool with the current session ID or without arguments (triggering case 1).Summarizing the active session is premature as the session is still ongoing. This leads to incomplete summaries and potentially multiple summary entries for the same session.
Goal: Add a guard clause in
SessionServiceto explicitly excludethis.currentSessionIdfrom being summarized, both when finding sessions automatically and when a specificsessionIdis requested.Task:
SessionService.mjs(around line 291 insummarizeSessions) to filter outthis.currentSessionId.