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

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
Vercel News
Vercel News
aimingoo的专栏
aimingoo的专栏
T
Tailwind CSS Blog
罗磊的独立博客
B
Blog
博客园_首页
A
About on SuperTechFans
有赞技术团队
有赞技术团队
V
V2EX
U
Unit 42
I
InfoQ
IT之家
IT之家
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
H
Help Net Security

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
fix(doctor): validate tool schemas with model context · o...
vincentkoc · 2026-05-29 · via Recent Commits to openclaw:main

@@ -6,8 +6,24 @@ const toolState = vi.hoisted(() => ({

66

tools: [] as AnyAgentTool[],

77

pluginIds: {} as Record<string, string | undefined>,

88

throwError: null as Error | null,

9+

runtimeModel: null as {

10+

id: string;

11+

name: string;

12+

provider: string;

13+

api: string;

14+

contextWindow?: number;

15+

compat?: Record<string, unknown>;

16+

} | null,

17+

resolveModelError: null as Error | null,

18+

resolveModel: vi.fn(),

919

createTools: vi.fn<typeof createOpenClawCodingTools>(),

10-

normalizeTools: vi.fn((options: { tools: AnyAgentTool[] }) => options.tools),

20+

normalizeTools: vi.fn(

21+

(options: { tools: AnyAgentTool[]; modelApi?: string; model?: unknown }) => options.tools,

22+

),

23+

}));

24+25+

vi.mock("../../../agents/embedded-agent-runner/model.js", () => ({

26+

resolveModel: (...args: unknown[]) => toolState.resolveModel(...args),

1127

}));

12281329

vi.mock("../../../agents/agent-tools.js", () => ({

@@ -50,6 +66,18 @@ describe("active tool schema doctor warnings", () => {

5066

toolState.tools = [];

5167

toolState.pluginIds = {};

5268

toolState.throwError = null;

69+

toolState.runtimeModel = null;

70+

toolState.resolveModelError = null;

71+

toolState.resolveModel.mockReset().mockImplementation(() => {

72+

if (toolState.resolveModelError) {

73+

throw toolState.resolveModelError;

74+

}

75+

return {

76+

model: toolState.runtimeModel,

77+

authStorage: {},

78+

modelRegistry: {},

79+

};

80+

});

5381

toolState.createTools.mockClear();

5482

toolState.normalizeTools.mockReset().mockImplementation((options) => options.tools);

5583

});

@@ -94,10 +122,25 @@ describe("active tool schema doctor warnings", () => {

94122

it("validates provider-normalized runtime schemas before reporting doctor health", () => {

95123

const healthyTool = tool("message", { type: "object", properties: {} });

96124

const dynamicTool = tool("dofbot_move_angles", { type: "object", properties: {} });

125+

toolState.runtimeModel = {

126+

id: "gpt-5.5",

127+

name: "GPT-5.5",

128+

provider: "openai",

129+

api: "openai-responses",

130+

contextWindow: 400_000,

131+

compat: { unsupportedToolSchemaKeywords: ["$dynamicRef"] },

132+

};

97133

toolState.tools = [healthyTool, dynamicTool];

98134

toolState.pluginIds = { dofbot_move_angles: "dofbot" };

99-

toolState.normalizeTools.mockImplementation(({ tools }) =>

100-

tools.map((entry) =>

135+

toolState.normalizeTools.mockImplementation(({ tools, modelApi, model }) => {

136+

if (

137+

modelApi !== "openai-responses" ||

138+

!model ||

139+

(model as { id?: string }).id !== "gpt-5.5"

140+

) {

141+

return tools;

142+

}

143+

return tools.map((entry) =>

101144

entry.name === "dofbot_move_angles"

102145

? tool("dofbot_move_angles", {

103146

type: "object",

@@ -106,12 +149,17 @@ describe("active tool schema doctor warnings", () => {

106149

},

107150

})

108151

: entry,

109-

),

110-

);

152+

);

153+

});

111154112155

expect(

113156

collectActiveToolSchemaProjectionWarnings({

114157

cfg: {

158+

agents: {

159+

defaults: {

160+

model: { primary: "openai/gpt-5.5" },

161+

},

162+

},

115163

plugins: {

116164

entries: {

117165

dofbot: { enabled: true },

@@ -123,6 +171,19 @@ describe("active tool schema doctor warnings", () => {

123171

).toEqual([

124172

'- agents.main: active tool "dofbot_move_angles" from plugin "dofbot" has unsupported runtime input schema (dofbot_move_angles.parameters.properties.target.$dynamicRef). OpenClaw will quarantine this tool at runtime; fix or disable the plugin, or remove the tool from active allowlists.',

125173

]);

174+

expect(toolState.createTools).toHaveBeenCalledWith(

175+

expect.objectContaining({

176+

modelApi: "openai-responses",

177+

modelCompat: { unsupportedToolSchemaKeywords: ["$dynamicRef"] },

178+

modelContextWindowTokens: 400_000,

179+

}),

180+

);

181+

expect(toolState.normalizeTools).toHaveBeenCalledWith(

182+

expect.objectContaining({

183+

modelApi: "openai-responses",

184+

model: expect.objectContaining({ id: "gpt-5.5", api: "openai-responses" }),

185+

}),

186+

);

126187

});

127188128189

it("reports runtime schema normalization failures instead of crashing doctor", () => {

@@ -141,6 +202,22 @@ describe("active tool schema doctor warnings", () => {

141202

]);

142203

});

143204205+

it("reports runtime model context failures instead of crashing doctor", () => {

206+

toolState.resolveModelError = new Error("provider model hook failed");

207+

toolState.tools = [tool("message", { type: "object", properties: {} })];

208+209+

expect(

210+

collectActiveToolSchemaProjectionWarnings({

211+

cfg: {},

212+

env: { HOME: "/tmp/openclaw-test" },

213+

}),

214+

).toEqual([

215+

"- agents.main: active tool schema validation could not resolve the runtime model context (provider model hook failed). Fix provider/model loading errors before relying on assistant tool startup.",

216+

]);

217+

expect(toolState.createTools).toHaveBeenCalled();

218+

expect(toolState.normalizeTools).toHaveBeenCalled();

219+

});

220+144221

it("reports toolset construction failures instead of crashing doctor", () => {

145222

toolState.throwError = new Error("plugin startup failed");

146223