diff --git a/src/config/config.test.ts b/src/config/config.test.ts index 5f697a64c..28a7c4f71 100644 --- a/src/config/config.test.ts +++ b/src/config/config.test.ts @@ -269,7 +269,7 @@ describe("config identity defaults", () => { }); }); - it("does not synthesize session when absent", async () => { + it("does not synthesize agent/session when absent", async () => { await withTempHome(async (home) => { const configDir = path.join(home, ".clawdbot"); await fs.mkdir(configDir, { recursive: true }); @@ -295,7 +295,7 @@ describe("config identity defaults", () => { expect(cfg.routing?.groupChat?.mentionPatterns).toEqual([ "\\b@?Samantha\\b", ]); - expect(cfg.agent?.contextPruning?.mode).toBe("adaptive"); + expect(cfg.agent).toBeUndefined(); expect(cfg.session).toBeUndefined(); }); }); diff --git a/src/config/defaults.ts b/src/config/defaults.ts index 5aa5fa106..b88c7751a 100644 --- a/src/config/defaults.ts +++ b/src/config/defaults.ts @@ -165,6 +165,7 @@ export function applyContextPruningDefaults( cfg: ClawdbotConfig, ): ClawdbotConfig { const agent = cfg.agent; + if (!agent) return cfg; const contextPruning = agent?.contextPruning; if (contextPruning?.mode) return cfg;