惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
The Cloudflare Blog
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
Jina AI
Jina AI
V
V2EX
罗磊的独立博客
V
Visual Studio Blog
A
About on SuperTechFans
IT之家
IT之家
P
Proofpoint News Feed
B
Blog
博客园 - Franky
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: tighten agent defaults schema rejections · openclaw...
steipete · 2026-05-09 · via Recent Commits to openclaw:main

@@ -3,6 +3,24 @@ import { validateConfigObject } from "./validation.js";

33

import { AgentDefaultsSchema } from "./zod-schema.agent-defaults.js";

44

import { AgentEntrySchema } from "./zod-schema.agent-runtime.js";

556+

type SchemaParseResult = {

7+

success: boolean;

8+

error?: { issues: Array<{ path: Array<string | number | symbol> }> };

9+

};

10+11+

function expectSchemaFailurePath(result: SchemaParseResult, expectedPathPrefix: string): void {

12+

expect(result.success).toBe(false);

13+

if (result.success || !result.error) {

14+

throw new Error(`Expected schema validation to fail at ${expectedPathPrefix}.`);

15+

}

16+

const issuePaths = result.error.issues.map((issue) => issue.path.join("."));

17+

expect(

18+

issuePaths.some(

19+

(path) => path === expectedPathPrefix || path.startsWith(`${expectedPathPrefix}.`),

20+

),

21+

).toBe(true);

22+

}

23+624

describe("agent defaults schema", () => {

725

it("accepts subagent archiveAfterMinutes=0 to disable archiving", () => {

826

expect(

@@ -37,14 +55,15 @@ describe("agent defaults schema", () => {

3755

primary: "openrouter/openai/gpt-5.4-image-2",

3856

timeoutMs: 180_000,

3957

});

40-

expect(() =>

41-

AgentDefaultsSchema.parse({

58+

expectSchemaFailurePath(

59+

AgentDefaultsSchema.safeParse({

4260

imageGenerationModel: {

4361

primary: "openrouter/openai/gpt-5.4-image-2",

4462

timeoutMs: 0,

4563

},

4664

}),

47-

).toThrow();

65+

"imageGenerationModel.timeoutMs",

66+

);

4867

});

49685069

it("accepts mediaGenerationAutoProviderFallback", () => {

@@ -80,7 +99,10 @@ describe("agent defaults schema", () => {

8099

});

8110082101

it("rejects invalid contextInjection values", () => {

83-

expect(() => AgentDefaultsSchema.parse({ contextInjection: "unknown" })).toThrow();

102+

expectSchemaFailurePath(

103+

AgentDefaultsSchema.safeParse({ contextInjection: "unknown" }),

104+

"contextInjection",

105+

);

84106

});

8510786108

it("accepts supported optional bootstrap filenames", () => {

@@ -96,10 +118,14 @@ describe("agent defaults schema", () => {

96118

});

9711998120

it("rejects unsupported optional bootstrap filenames", () => {

99-

expect(() =>

100-

AgentDefaultsSchema.parse({ skipOptionalBootstrapFiles: ["AGENTS.md"] }),

101-

).toThrow();

102-

expect(() => AgentDefaultsSchema.parse({ skipOptionalBootstrapFiles: ["SOUL.MD"] })).toThrow();

121+

expectSchemaFailurePath(

122+

AgentDefaultsSchema.safeParse({ skipOptionalBootstrapFiles: ["AGENTS.md"] }),

123+

"skipOptionalBootstrapFiles",

124+

);

125+

expectSchemaFailurePath(

126+

AgentDefaultsSchema.safeParse({ skipOptionalBootstrapFiles: ["SOUL.MD"] }),

127+

"skipOptionalBootstrapFiles",

128+

);

103129

});

104130105131

it("accepts embeddedPi.executionContract", () => {

@@ -196,8 +222,14 @@ describe("agent defaults schema", () => {

196222

});

197223198224

it("rejects zero heartbeat timeoutSeconds", () => {

199-

expect(() => AgentDefaultsSchema.parse({ heartbeat: { timeoutSeconds: 0 } })).toThrow();

200-

expect(() => AgentEntrySchema.parse({ id: "ops", heartbeat: { timeoutSeconds: 0 } })).toThrow();

225+

expectSchemaFailurePath(

226+

AgentDefaultsSchema.safeParse({ heartbeat: { timeoutSeconds: 0 } }),

227+

"heartbeat.timeoutSeconds",

228+

);

229+

expectSchemaFailurePath(

230+

AgentEntrySchema.safeParse({ id: "ops", heartbeat: { timeoutSeconds: 0 } }),

231+

"heartbeat.timeoutSeconds",

232+

);

201233

});

202234203235

it("preserves per-agent contextTokens through config validation", () => {

@@ -223,9 +255,18 @@ describe("agent defaults schema", () => {

223255

});

224256225257

it("rejects non-positive contextTokens on agent entries and defaults", () => {

226-

expect(() => AgentEntrySchema.parse({ id: "ops", contextTokens: 0 })).toThrow();

227-

expect(() => AgentEntrySchema.parse({ id: "ops", contextTokens: -1 })).toThrow();

228-

expect(() => AgentEntrySchema.parse({ id: "ops", contextTokens: 1.5 })).toThrow();

229-

expect(() => AgentDefaultsSchema.parse({ contextTokens: 0 })).toThrow();

258+

expectSchemaFailurePath(

259+

AgentEntrySchema.safeParse({ id: "ops", contextTokens: 0 }),

260+

"contextTokens",

261+

);

262+

expectSchemaFailurePath(

263+

AgentEntrySchema.safeParse({ id: "ops", contextTokens: -1 }),

264+

"contextTokens",

265+

);

266+

expectSchemaFailurePath(

267+

AgentEntrySchema.safeParse({ id: "ops", contextTokens: 1.5 }),

268+

"contextTokens",

269+

);

270+

expectSchemaFailurePath(AgentDefaultsSchema.safeParse({ contextTokens: 0 }), "contextTokens");

230271

});

231272

});