Merge pull request #1686 from ousamabenyounes/fix/issue-1633

fix: expose summaryStored in session status to detect silent summary loss (#1633)
This commit is contained in:
Alex Newman
2026-04-14 18:41:58 -07:00
committed by GitHub
5 changed files with 70 additions and 5 deletions
+3
View File
@@ -43,6 +43,9 @@ export interface ActiveSession {
processingMessageIds: number[];
// Tier routing: model override per session based on queue complexity
modelOverride?: string;
// Track whether the most recent storage operation persisted a summary record.
// Used by the status endpoint so the Stop hook can detect silent summary loss (#1633).
lastSummaryStored?: boolean;
}
export interface PendingMessage {
@@ -147,6 +147,10 @@ export async function processAgentResponse(
memorySessionId: session.memorySessionId
});
// Track whether a summary record was stored so the status endpoint can expose this
// to the Stop hook for silent-summary-loss detection (#1633)
session.lastSummaryStored = result.summaryId !== null;
// CLAIM-CONFIRM: Now that storage succeeded, confirm all processing messages (delete from queue)
// This is the critical step that prevents message loss on generator crash
const pendingStore = sessionManager.getPendingMessageStore();
@@ -672,6 +672,9 @@ export class SessionRoutes extends BaseRouteHandler {
status: 'active',
sessionDbId,
queueLength,
// Expose whether the last storage operation included a summary record.
// The Stop hook uses this to detect silent summary loss when the queue empties (#1633).
summaryStored: session.lastSummaryStored ?? null,
uptime: Date.now() - session.startTime
});
});