fix(config): accept truncateAfterCompaction (#68395)

Merged via squash.

Prepared head SHA: bf45148a75
Co-authored-by: MonkeyLeeT <6754057+MonkeyLeeT@users.noreply.github.com>
Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
Reviewed-by: @hxy91819
This commit is contained in:
Ted Li
2026-04-22 03:31:03 -07:00
committed by GitHub
parent 16f016f07e
commit 13fae1685f
5 changed files with 30 additions and 0 deletions

View File

@@ -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

View File

@@ -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: {

View File

@@ -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",

View File

@@ -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: {

View File

@@ -195,6 +195,7 @@ export const AgentDefaultsSchema = z
})
.strict()
.optional(),
truncateAfterCompaction: z.boolean().optional(),
notifyUser: z.boolean().optional(),
})
.strict()