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 <cursoragent@cursor.com>
This commit is contained in:
2026-06-18 22:57:09 +07:00
parent a07ddefb23
commit 20429a02ab
+7 -2
View File
@@ -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,