Fix unguarded cache clear on provider exit and overly broad compaction item heuristic
- Guard clearTurnStateForSession with shouldApplyThreadLifecycle so a replaced provider's session.exited event does not wipe turn caches belonging to the new provider's in-progress turn. - Remove the overly broad 'summary' fallback from looksLikeCompactionItem; only compact_summary and compactSummary are specific enough to identify compaction items without false positives.
This commit is contained in:
2 files changed
+2
-6
No files matched your search
@@ -1147,7 +1147,7 @@ const make = Effect.fn("make")(function* () {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.type === "session.exited") {
|
||||
if (event.type === "session.exited" && shouldApplyThreadLifecycle) {
|
||||
yield* clearTurnStateForSession(thread.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,11 +72,7 @@ function looksLikeCompactionItem(value: unknown): boolean {
|
||||
if (COMPACTION_TYPE_SNIPPETS.some((snippet) => type.includes(snippet))) {
|
||||
return true;
|
||||
}
|
||||
return (
|
||||
typeof record.compact_summary === "string" ||
|
||||
typeof record.compactSummary === "string" ||
|
||||
typeof record.summary === "string"
|
||||
);
|
||||
return typeof record.compact_summary === "string" || typeof record.compactSummary === "string";
|
||||
}
|
||||
|
||||
export function extractCompactionSummaryFromSnapshot(snapshot: {
|
||||
|
||||
Reference in new issue
Block a user