From cda2025c49d77ff07eb96b931cd4ae95f1dc8ef5 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 8 Jan 2026 22:40:47 +0100 Subject: [PATCH] fix: align env config schema --- src/config/config.test.ts | 19 +++++++++---------- src/config/io.ts | 7 ++----- src/config/zod-schema.ts | 3 ++- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/config/config.test.ts b/src/config/config.test.ts index 8582b750c..6c05c889b 100644 --- a/src/config/config.test.ts +++ b/src/config/config.test.ts @@ -368,11 +368,14 @@ describe("config env vars", () => { "utf-8", ); - await withEnvOverride({ OPENROUTER_API_KEY: "existing-key" }, async () => { - const { loadConfig } = await import("./config.js"); - loadConfig(); - expect(process.env.OPENROUTER_API_KEY).toBe("existing-key"); - }); + await withEnvOverride( + { OPENROUTER_API_KEY: "existing-key" }, + async () => { + const { loadConfig } = await import("./config.js"); + loadConfig(); + expect(process.env.OPENROUTER_API_KEY).toBe("existing-key"); + }, + ); }); }); @@ -426,11 +429,7 @@ describe("config pruning defaults", () => { await fs.mkdir(configDir, { recursive: true }); await fs.writeFile( path.join(configDir, "clawdbot.json"), - JSON.stringify( - { agent: { contextPruning: { mode: "off" } } }, - null, - 2, - ), + JSON.stringify({ agent: { contextPruning: { mode: "off" } } }, null, 2), "utf-8", ); diff --git a/src/config/io.ts b/src/config/io.ts index 13cf63ef5..c2de03d66 100644 --- a/src/config/io.ts +++ b/src/config/io.ts @@ -13,11 +13,11 @@ import { findDuplicateAgentDirs, } from "./agent-dirs.js"; import { + applyContextPruningDefaults, applyIdentityDefaults, applyLoggingDefaults, applyMessageDefaults, applyModelDefaults, - applyContextPruningDefaults, applySessionDefaults, applyTalkApiKey, } from "./defaults.js"; @@ -79,10 +79,7 @@ function warnOnConfigMiskeys( } } -function applyConfigEnv( - cfg: ClawdbotConfig, - env: NodeJS.ProcessEnv, -): void { +function applyConfigEnv(cfg: ClawdbotConfig, env: NodeJS.ProcessEnv): void { const envConfig = cfg.env; if (!envConfig) return; diff --git a/src/config/zod-schema.ts b/src/config/zod-schema.ts index 554c9d390..cd1899548 100644 --- a/src/config/zod-schema.ts +++ b/src/config/zod-schema.ts @@ -641,6 +641,7 @@ const RoutingSchema = z workspace: z.string().optional(), agentDir: z.string().optional(), model: z.string().optional(), + mentionPatterns: z.array(z.string()).optional(), subagents: z .object({ allowAgents: z.array(z.string()).optional(), @@ -793,7 +794,7 @@ export const ClawdbotSchema = z.object({ timeoutMs: z.number().int().nonnegative().optional(), }) .optional(), - vars: z.record(z.string()).optional(), + vars: z.record(z.string(), z.string()).optional(), }) .catchall(z.string()) .optional(),