fix(compaction): ignore compaction agent updates

Fixes #3819
This commit is contained in:
YeonGyu-Kim
2026-05-11 13:25:29 +09:00
parent 726c82e131
commit 49ff4b5f8d
4 changed files with 120 additions and 1 deletions
+3
View File
@@ -3,6 +3,7 @@ import {
resolveActualContextLimit,
type ContextLimitModelCacheState,
} from "../shared/context-limit-resolver"
import { isCompactionAgent } from "../shared/compaction-marker"
import { createSystemDirective, SystemDirectiveTypes } from "../shared/system-directive"
const CONTEXT_WARNING_THRESHOLD = 0.70
@@ -94,6 +95,7 @@ export function createContextWindowMonitorHook(
if (event.type === "message.updated") {
const info = props?.info as {
agent?: unknown
role?: string
sessionID?: string
providerID?: string
@@ -103,6 +105,7 @@ export function createContextWindowMonitorHook(
} | undefined
if (!info || info.role !== "assistant" || !info.finish) return
if (isCompactionAgent(info.agent)) return
if (!info.sessionID || !info.providerID || !info.tokens) return
tokenCache.set(info.sessionID, {