coach: keep cancelled-turn markers out of summary and fact folds

The rolling-summary and fact-extraction workers read message bodies
directly, so an empty cancelled marker would ride their prompts as a
blank assistant line. Skip empty bodies in both folds. Refs #781
This commit is contained in:
Marc-André Bombeck committed 2026-08-13 06:16:45 +02:00
1 parent a1b1617d0f
commit ce6364f265
2 files changed
+6

No files matched your search

+3
View File
@@ -182,6 +182,9 @@ export async function refreshConversationSummary(
// fail-closed like every other decrypt in the Coach stack.
return [];
}
// #781 — skip empty bodies: a cancelled-turn marker (an empty
// assistant row closing an aborted turn) carries no content to fold.
if (!content.trim()) return [];
return [{ role: m.role === "assistant" ? "assistant" : "user", content }];
});
+3
View File
@@ -255,6 +255,9 @@ async function loadRecentTurns(
for (const m of [...row.messages].reverse()) {
const content = decryptOrNull(m.encryptedContent);
if (content === null) continue;
// #781 — skip empty bodies: a cancelled-turn marker (an empty assistant
// row closing an aborted turn) carries nothing to extract from.
if (!content.trim()) continue;
turns.push({ role: m.role, content });
}
return turns;