fix: prevent duplicate compaction race and log preemptive failures

This commit is contained in:
YeonGyu-Kim
2026-02-16 14:58:59 +09:00
parent 0a0b09e641
commit f734e9e600
4 changed files with 176 additions and 4 deletions
+4 -2
View File
@@ -1,3 +1,5 @@
import { log } from "../shared/logger"
const DEFAULT_ACTUAL_LIMIT = 200_000
const ANTHROPIC_ACTUAL_LIMIT =
@@ -76,8 +78,8 @@ export function createPreemptiveCompactionHook(ctx: PluginInput) {
})
compactedSessions.add(sessionID)
} catch {
// best-effort; do not disrupt tool execution
} catch (error) {
log("[preemptive-compaction] Compaction failed", { sessionID, error: String(error) })
} finally {
compactionInProgress.delete(sessionID)
}