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

推荐订阅源

Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
博客园_首页
H
Help Net Security
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
V
Visual Studio Blog
The Cloudflare Blog
腾讯CDC
Jina AI
Jina AI
Last Week in AI
Last Week in AI
月光博客
月光博客
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
Blog — PlanetScale
Blog — PlanetScale
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
爱范儿
爱范儿
N
Netflix TechBlog - Medium
F
Fortinet All Blogs

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 tool construction plan assertions · opencla...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -7,6 +7,35 @@ import {

77

shouldCreateBundleMcpRuntimeForAttempt,

88

} from "./attempt-tool-construction-plan.js";

9910+

type EmbeddedAttemptToolConstructionPlan = ReturnType<

11+

typeof resolveEmbeddedAttemptToolConstructionPlan

12+

>;

13+14+

function expectConstructionPlan(

15+

plan: EmbeddedAttemptToolConstructionPlan,

16+

expected: {

17+

constructTools?: boolean;

18+

includeCoreTools?: boolean;

19+

runtimeToolAllowlist?: string[];

20+

coding?: Partial<EmbeddedAttemptToolConstructionPlan["codingToolConstructionPlan"]>;

21+

},

22+

) {

23+

if ("constructTools" in expected) {

24+

expect(plan.constructTools).toBe(expected.constructTools);

25+

}

26+

if ("includeCoreTools" in expected) {

27+

expect(plan.includeCoreTools).toBe(expected.includeCoreTools);

28+

}

29+

if ("runtimeToolAllowlist" in expected) {

30+

expect(plan.runtimeToolAllowlist).toEqual(expected.runtimeToolAllowlist);

31+

}

32+

if (expected.coding) {

33+

for (const [key, value] of Object.entries(expected.coding)) {

34+

expect(plan.codingToolConstructionPlan[key as keyof typeof expected.coding]).toBe(value);

35+

}

36+

}

37+

}

38+1039

describe("applyEmbeddedAttemptToolsAllow", () => {

1140

it("keeps explicit toolsAllow authoritative after force-added tools are built", () => {

1241

const tools = [{ name: "exec" }, { name: "read" }, { name: "message" }];

@@ -85,10 +114,10 @@ describe("applyEmbeddedAttemptToolsAllow", () => {

8511486115

describe("resolveEmbeddedAttemptToolConstructionPlan", () => {

87116

it("builds all tool families when no runtime allowlist is present", () => {

88-

expect(resolveEmbeddedAttemptToolConstructionPlan({})).toMatchObject({

117+

expectConstructionPlan(resolveEmbeddedAttemptToolConstructionPlan({}), {

89118

constructTools: true,

90119

includeCoreTools: true,

91-

codingToolConstructionPlan: {

120+

coding: {

92121

includeBaseCodingTools: true,

93122

includeShellTools: true,

94123

includeChannelTools: true,

@@ -99,10 +128,10 @@ describe("resolveEmbeddedAttemptToolConstructionPlan", () => {

99128

});

100129101130

it("short-circuits all local tool construction for explicit no-tools runs", () => {

102-

expect(resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: [] })).toMatchObject({

131+

expectConstructionPlan(resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: [] }), {

103132

constructTools: false,

104133

includeCoreTools: false,

105-

codingToolConstructionPlan: {

134+

coding: {

106135

includeBaseCodingTools: false,

107136

includeShellTools: false,

108137

includeChannelTools: false,

@@ -113,125 +142,137 @@ describe("resolveEmbeddedAttemptToolConstructionPlan", () => {

113142

});

114143115144

it("materializes only plugin candidates for plugin-only allowlists", () => {

116-

expect(

145+

expectConstructionPlan(

117146

resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["memory_search"] }),

118-

).toMatchObject({

119-

constructTools: true,

120-

includeCoreTools: false,

121-

runtimeToolAllowlist: ["memory_search"],

122-

codingToolConstructionPlan: {

123-

includeBaseCodingTools: false,

124-

includeShellTools: false,

125-

includeChannelTools: true,

126-

includeOpenClawTools: false,

127-

includePluginTools: true,

147+

{

148+

constructTools: true,

149+

includeCoreTools: false,

150+

runtimeToolAllowlist: ["memory_search"],

151+

coding: {

152+

includeBaseCodingTools: false,

153+

includeShellTools: false,

154+

includeChannelTools: true,

155+

includeOpenClawTools: false,

156+

includePluginTools: true,

157+

},

128158

},

129-

});

159+

);

130160

});

131161132162

it("limits known core allowlists to the matching local families", () => {

133-

expect(resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["read"] })).toMatchObject({

163+

expectConstructionPlan(resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["read"] }), {

134164

constructTools: true,

135165

includeCoreTools: true,

136-

codingToolConstructionPlan: {

166+

coding: {

137167

includeBaseCodingTools: true,

138168

includeShellTools: false,

139169

includeChannelTools: false,

140170

includeOpenClawTools: false,

141171

includePluginTools: false,

142172

},

143173

});

144-

expect(resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["exec"] })).toMatchObject({

145-

codingToolConstructionPlan: {

174+

expectConstructionPlan(resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["exec"] }), {

175+

coding: {

146176

includeBaseCodingTools: false,

147177

includeShellTools: true,

148178

includeChannelTools: false,

149179

includeOpenClawTools: false,

150180

includePluginTools: false,

151181

},

152182

});

153-

expect(

183+

expectConstructionPlan(

154184

resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["session_status"] }),

155-

).toMatchObject({

156-

codingToolConstructionPlan: {

157-

includeBaseCodingTools: false,

158-

includeShellTools: false,

159-

includeChannelTools: false,

160-

includeOpenClawTools: true,

161-

includePluginTools: false,

185+

{

186+

coding: {

187+

includeBaseCodingTools: false,

188+

includeShellTools: false,

189+

includeChannelTools: false,

190+

includeOpenClawTools: true,

191+

includePluginTools: false,

192+

},

162193

},

163-

});

164-

expect(

194+

);

195+

expectConstructionPlan(

165196

resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["update_plan"] }),

166-

).toMatchObject({

167-

codingToolConstructionPlan: {

168-

includeBaseCodingTools: false,

169-

includeShellTools: false,

170-

includeChannelTools: false,

171-

includeOpenClawTools: true,

172-

includePluginTools: false,

197+

{

198+

coding: {

199+

includeBaseCodingTools: false,

200+

includeShellTools: false,

201+

includeChannelTools: false,

202+

includeOpenClawTools: true,

203+

includePluginTools: false,

204+

},

173205

},

174-

});

206+

);

175207

});

176208177209

it("keeps plugin-owned catalog tools on the plugin construction path", () => {

178-

expect(resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["browser"] })).toMatchObject({

179-

constructTools: true,

180-

includeCoreTools: false,

181-

codingToolConstructionPlan: {

182-

includeBaseCodingTools: false,

183-

includeShellTools: false,

184-

includeChannelTools: true,

185-

includeOpenClawTools: false,

186-

includePluginTools: true,

210+

expectConstructionPlan(

211+

resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["browser"] }),

212+

{

213+

constructTools: true,

214+

includeCoreTools: false,

215+

coding: {

216+

includeBaseCodingTools: false,

217+

includeShellTools: false,

218+

includeChannelTools: true,

219+

includeOpenClawTools: false,

220+

includePluginTools: true,

221+

},

187222

},

188-

});

189-

expect(

223+

);

224+

expectConstructionPlan(

190225

resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["code_execution"] }),

191-

).toMatchObject({

192-

constructTools: true,

193-

includeCoreTools: false,

194-

codingToolConstructionPlan: {

195-

includeBaseCodingTools: false,

196-

includeShellTools: false,

197-

includeChannelTools: true,

198-

includeOpenClawTools: false,

199-

includePluginTools: true,

226+

{

227+

constructTools: true,

228+

includeCoreTools: false,

229+

coding: {

230+

includeBaseCodingTools: false,

231+

includeShellTools: false,

232+

includeChannelTools: true,

233+

includeOpenClawTools: false,

234+

includePluginTools: true,

235+

},

200236

},

201-

});

202-

expect(resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["x_search"] })).toMatchObject({

203-

includeCoreTools: false,

204-

codingToolConstructionPlan: {

205-

includeChannelTools: true,

206-

includeOpenClawTools: false,

207-

includePluginTools: true,

237+

);

238+

expectConstructionPlan(

239+

resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["x_search"] }),

240+

{

241+

includeCoreTools: false,

242+

coding: {

243+

includeChannelTools: true,

244+

includeOpenClawTools: false,

245+

includePluginTools: true,

246+

},

208247

},

209-

});

248+

);

210249

});

211250212251

it("keeps channel tools available for narrow channel-owned allowlists", () => {

213-

expect(

252+

expectConstructionPlan(

214253

resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["whatsapp_login"] }),

215-

).toMatchObject({

216-

constructTools: true,

217-

includeCoreTools: false,

218-

codingToolConstructionPlan: {

219-

includeBaseCodingTools: false,

220-

includeShellTools: false,

221-

includeChannelTools: true,

222-

includeOpenClawTools: false,

223-

includePluginTools: true,

254+

{

255+

constructTools: true,

256+

includeCoreTools: false,

257+

coding: {

258+

includeBaseCodingTools: false,

259+

includeShellTools: false,

260+

includeChannelTools: true,

261+

includeOpenClawTools: false,

262+

includePluginTools: true,

263+

},

224264

},

225-

});

265+

);

226266

});

227267228268

it("skips local construction when only bundled tool runtimes can match", () => {

229-

expect(

269+

expectConstructionPlan(

230270

resolveEmbeddedAttemptToolConstructionPlan({ toolsAllow: ["strict__strict_probe"] }),

231-

).toMatchObject({

232-

constructTools: false,

233-

includeCoreTools: false,

234-

});

271+

{

272+

constructTools: false,

273+

includeCoreTools: false,

274+

},

275+

);

235276

});

236277

});

237278