Skip to content

Commit d4c9511

Browse files
committed
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.
1 parent 84b54f7 commit d4c9511

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ const make = Effect.fn("make")(function* () {
11471147
}
11481148
}
11491149

1150-
if (event.type === "session.exited") {
1150+
if (event.type === "session.exited" && shouldApplyThreadLifecycle) {
11511151
yield* clearTurnStateForSession(thread.id);
11521152
}
11531153

apps/server/src/provider/handoffSummary.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,7 @@ function looksLikeCompactionItem(value: unknown): boolean {
7272
if (COMPACTION_TYPE_SNIPPETS.some((snippet) => type.includes(snippet))) {
7373
return true;
7474
}
75-
return (
76-
typeof record.compact_summary === "string" ||
77-
typeof record.compactSummary === "string" ||
78-
typeof record.summary === "string"
79-
);
75+
return typeof record.compact_summary === "string" || typeof record.compactSummary === "string";
8076
}
8177

8278
export function extractCompactionSummaryFromSnapshot(snapshot: {

0 commit comments

Comments
 (0)