Skip to content

Commit 723c62a

Browse files
committed
fix(codex): cap compaction override warning cache via createDedupeCache
1 parent 52c9448 commit 723c62a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎extensions/codex/src/app-server/compact.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
type EmbeddedAgentCompactResult,
99
} from "openclaw/plugin-sdk/agent-harness-runtime";
1010
import { resolveAgentDir, resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime";
11+
import { createDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
1112
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
1213
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
1314
import { isIncognitoSessionKey } from "../incognito-session.js";
@@ -42,7 +43,9 @@ import {
4243
} from "./shared-client.js";
4344
import { resumeCodexAppServerThread } from "./thread-resume.js";
4445

45-
const warnedIgnoredCompactionOverrides = new Set<string>();
46+
// ttlMs: 0 retains keys until the 4,096-entry LRU cap evicts them, after which a
47+
// previously suppressed warning can intentionally emit again.
48+
const warnedIgnoredCompactionOverrides = createDedupeCache({ ttlMs: 0, maxSize: 4096 });
4649
const codexNativeCompactionQueue = new KeyedAsyncQueue();
4750
const CODEX_NATIVE_COMPACTION_INTERRUPT_GRACE_MS = 30_000;
4851
type CodexAppServerCompactOptions = {
@@ -350,10 +353,9 @@ function warnIfIgnoringOpenClawCompactionOverrides(
350353
return;
351354
}
352355
const warningKey = ignoredConfig.join("\0");
353-
if (warnedIgnoredCompactionOverrides.has(warningKey)) {
356+
if (warnedIgnoredCompactionOverrides.check(warningKey)) {
354357
return;
355358
}
356-
warnedIgnoredCompactionOverrides.add(warningKey);
357359
embeddedAgentLog.warn(
358360
"ignoring OpenClaw compaction overrides for Codex app-server compaction; Codex uses native server-side compaction",
359361
{

0 commit comments

Comments
 (0)