From 20429a02ab44c710213f43da1aa98c3791f69065 Mon Sep 17 00:00:00 2001 From: GRayHook Date: Thu, 18 Jun 2026 22:57:09 +0700 Subject: [PATCH] Phase 15: add ensureCompactionSourceMarked for compaction source fallback Extract shared helper so session_before_compact and session_compact can both infer auto when compaction was not explicitly manual. Co-authored-by: Cursor --- src/compaction.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compaction.ts b/src/compaction.ts index 4645ced..84a2223 100644 --- a/src/compaction.ts +++ b/src/compaction.ts @@ -25,13 +25,18 @@ export function markManualCompactionFromInput(text: string, runtime: CompactionR } } -/** session_before_compact: default to auto unless input already marked manual (SPEC §8). */ -export function markAutoCompactionBeforeCompact(runtime: CompactionRuntime): void { +/** If not explicitly manual, mark compaction source as auto (SPEC §8). */ +export function ensureCompactionSourceMarked(runtime: CompactionRuntime): void { if (runtime.pendingCompactionSource !== "manual") { runtime.pendingCompactionSource = "auto"; } } +/** session_before_compact: default to auto unless input already marked manual (SPEC §8). */ +export function markAutoCompactionBeforeCompact(runtime: CompactionRuntime): void { + ensureCompactionSourceMarked(runtime); +} + /** Gate re-inject on session_compact from enabled layer and compaction source (SPEC §8). */ export function shouldReinjectAfterCompaction( sessionOverride: boolean | null,