fix: avoid synthesizing agent defaults

This commit is contained in:
Peter Steinberger
2026-01-08 22:26:29 +01:00
parent 2c7d64232e
commit 5939dff092
2 changed files with 3 additions and 2 deletions

View File

@@ -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();
});
});

View File

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