From 13fae1685f865b757d28af7b183c900dc412d712 Mon Sep 17 00:00:00 2001 From: Ted Li Date: Wed, 22 Apr 2026 03:31:03 -0700 Subject: [PATCH] fix(config): accept truncateAfterCompaction (#68395) Merged via squash. Prepared head SHA: bf45148a752cfcb7da654571170c407684b446a6 Co-authored-by: MonkeyLeeT <6754057+MonkeyLeeT@users.noreply.github.com> Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com> Reviewed-by: @hxy91819 --- CHANGELOG.md | 1 + src/config/config.schema-regressions.test.ts | 13 +++++++++++++ src/config/schema.base.generated.ts | 6 ++++++ src/config/zod-schema.agent-defaults.test.ts | 9 +++++++++ src/config/zod-schema.agent-defaults.ts | 1 + 5 files changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23e5dc2f8f3..178cd262955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Docs: https://docs.openclaw.ai - Agents/harness: surface selected plugin harness failures directly instead of replaying the same turn through embedded PI, preventing misleading secondary PI auth errors and avoiding duplicate side effects. - OpenAI Codex: add a ChatGPT device-code auth option beside browser OAuth, so headless or callback-hostile setups can sign in without relying on the localhost browser callback. (#69557) Thanks @vincentkoc. - CLI sessions: keep provider-owned CLI sessions through implicit daily expiry while preserving explicit reset behavior, and retain Claude CLI binding metadata across gateway agent requests. (#70106) Thanks @obviyus. +- fix(config): accept truncateAfterCompaction (#68395). Thanks @MonkeyLeeT ## 2026.4.21 diff --git a/src/config/config.schema-regressions.test.ts b/src/config/config.schema-regressions.test.ts index c7738ba6e35..653cf04c538 100644 --- a/src/config/config.schema-regressions.test.ts +++ b/src/config/config.schema-regressions.test.ts @@ -145,6 +145,19 @@ describe("config schema regressions", () => { expect(res.ok).toBe(true); }); + it("accepts agents.defaults.compaction.truncateAfterCompaction", () => { + const res = validateConfigObject({ + agents: { + defaults: { + compaction: { + truncateAfterCompaction: true, + }, + }, + }, + }); + + expect(res.ok).toBe(true); + }); it("accepts string values for agents defaults model inputs", () => { const res = validateConfigObject({ agents: { diff --git a/src/config/schema.base.generated.ts b/src/config/schema.base.generated.ts index 244783aafa9..6a92ef8c8a4 100644 --- a/src/config/schema.base.generated.ts +++ b/src/config/schema.base.generated.ts @@ -4692,6 +4692,12 @@ export const GENERATED_BASE_CONFIG_SCHEMA: BaseConfigSchemaResponse = { description: "Pre-compaction memory flush settings that run an agentic memory write before heavy compaction. Keep enabled for long sessions so salient context is persisted before aggressive trimming.", }, + truncateAfterCompaction: { + type: "boolean", + title: "Truncate After Compaction", + description: + "When enabled, rewrites the session JSONL file after compaction to remove entries that were summarized. Prevents unbounded file growth in long-running sessions with many compaction cycles. Default: false.", + }, notifyUser: { type: "boolean", title: "Compaction Notify User", diff --git a/src/config/zod-schema.agent-defaults.test.ts b/src/config/zod-schema.agent-defaults.test.ts index 7f0779decd9..120b3a82594 100644 --- a/src/config/zod-schema.agent-defaults.test.ts +++ b/src/config/zod-schema.agent-defaults.test.ts @@ -64,6 +64,15 @@ describe("agent defaults schema", () => { expect(result.embeddedPi?.executionContract).toBe("strict-agentic"); }); + it("accepts compaction.truncateAfterCompaction", () => { + const result = AgentDefaultsSchema.parse({ + compaction: { + truncateAfterCompaction: true, + }, + })!; + expect(result.compaction?.truncateAfterCompaction).toBe(true); + }); + it("accepts focused contextLimits on defaults and agent entries", () => { const defaults = AgentDefaultsSchema.parse({ contextLimits: { diff --git a/src/config/zod-schema.agent-defaults.ts b/src/config/zod-schema.agent-defaults.ts index 165ae53427d..fc6983c8925 100644 --- a/src/config/zod-schema.agent-defaults.ts +++ b/src/config/zod-schema.agent-defaults.ts @@ -195,6 +195,7 @@ export const AgentDefaultsSchema = z }) .strict() .optional(), + truncateAfterCompaction: z.boolean().optional(), notifyUser: z.boolean().optional(), }) .strict()