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

推荐订阅源

F
Fortinet All Blogs
Recent Announcements
Recent Announcements
H
Help Net Security
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
小众软件
小众软件
Last Week in AI
Last Week in AI
U
Unit 42
Google DeepMind News
Google DeepMind News
博客园 - 司徒正美
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
N
Netflix TechBlog - Medium
Blog — PlanetScale
Blog — PlanetScale
云风的 BLOG
云风的 BLOG
V
V2EX
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
博客园 - 三生石上(FineUI控件)
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿

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 message command assertions · openclaw/openc...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -7,8 +7,23 @@ type RunMessageActionParams = {

77

cfg?: unknown;

88

action: string;

99

params: Record<string, unknown>;

10+

agentId?: string;

11+

senderIsOwner?: boolean;

12+

gateway?: {

13+

clientName?: string;

14+

mode?: string;

15+

};

1016

};

111718+

function readOnlyMessageActionCall(): RunMessageActionParams {

19+

expect(runMessageActionMock).toHaveBeenCalledOnce();

20+

const call = runMessageActionMock.mock.calls[0]?.[0];

21+

if (!call) {

22+

throw new Error("Expected message action call");

23+

}

24+

return call;

25+

}

26+1227

let testConfig: Record<string, unknown> = {};

1328

const applyPluginAutoEnable = vi.hoisted(() => vi.fn(({ config }) => ({ config, changes: [] })));

1429

vi.mock("../config/config.js", () => ({

@@ -182,41 +197,34 @@ describe("messageCommand", () => {

182197183198

await runMessageCommand();

184199185-

expect(runMessageActionMock).toHaveBeenCalledWith(

186-

expect.objectContaining({

187-

cfg: resolvedConfig,

188-

action: "send",

189-

params: expect.objectContaining({

190-

channel: "telegram",

191-

target: "123456",

192-

message: "hi",

193-

}),

194-

agentId: "main",

195-

senderIsOwner: true,

196-

gateway: expect.objectContaining({

197-

clientName: "cli",

198-

mode: "cli",

199-

}),

200-

}),

201-

);

202-

expect(runMessageActionMock.mock.calls[0]?.[0]?.cfg).not.toBe(rawConfig);

203-

expect(resolveCommandConfigWithSecrets).toHaveBeenCalledWith(

204-

expect.objectContaining({

205-

config: rawConfig,

206-

commandName: "message",

207-

}),

208-

);

200+

const actionCall = readOnlyMessageActionCall();

201+

expect(actionCall.cfg).toBe(resolvedConfig);

202+

expect(actionCall.action).toBe("send");

203+

expect(actionCall.params.channel).toBe("telegram");

204+

expect(actionCall.params.target).toBe("123456");

205+

expect(actionCall.params.message).toBe("hi");

206+

expect(actionCall.agentId).toBe("main");

207+

expect(actionCall.senderIsOwner).toBe(true);

208+

expect(actionCall.gateway?.clientName).toBe("cli");

209+

expect(actionCall.gateway?.mode).toBe("cli");

210+

expect(actionCall.cfg).not.toBe(rawConfig);

211+

const configResolutionCall = resolveCommandConfigWithSecrets.mock.calls[0]?.[0] as {

212+

commandName?: string;

213+

config?: unknown;

214+

targetIds?: Set<string>;

215+

};

216+

expect(configResolutionCall.config).toBe(rawConfig);

217+

expect(configResolutionCall.commandName).toBe("message");

209218

expect(getScopedChannelsCommandSecretTargets).toHaveBeenCalledWith({

210219

config: rawConfig,

211220

channel: "telegram",

212221

accountId: undefined,

213222

});

214-

const call = resolveCommandConfigWithSecrets.mock.calls[0]?.[0] as {

215-

targetIds?: Set<string>;

216-

};

217-

expect(call.targetIds).toBeInstanceOf(Set);

223+

expect(configResolutionCall.targetIds).toBeInstanceOf(Set);

218224

expect(

219-

[...(call.targetIds ?? [])].filter((id) => !id.startsWith("channels.telegram.")),

225+

[...(configResolutionCall.targetIds ?? [])].filter(

226+

(id) => !id.startsWith("channels.telegram."),

227+

),

220228

).toStrictEqual([]);

221229

});

222230

@@ -237,15 +245,16 @@ describe("messageCommand", () => {

237245238246

await runMessageCommand();

239247240-

expect(runMessageActionMock).toHaveBeenCalledWith(

241-

expect.objectContaining({

242-

cfg: locallyResolvedConfig,

243-

}),

244-

);

245-

expect(runMessageActionMock.mock.calls[0]?.[0]?.cfg).not.toBe(rawConfig);

246-

expect(runtime.log).toHaveBeenCalledWith(

247-

expect.stringContaining("[secrets] gateway secrets.resolve unavailable"),

248-

);

248+

const actionCall = readOnlyMessageActionCall();

249+

expect(actionCall.cfg).toBe(locallyResolvedConfig);

250+

expect(actionCall.cfg).not.toBe(rawConfig);

251+

expect(

252+

vi

253+

.mocked(runtime.log)

254+

.mock.calls.some(([message]) =>

255+

String(message).includes("[secrets] gateway secrets.resolve unavailable"),

256+

),

257+

).toBe(true);

249258

});

250259251260

it("uses auto-enabled effective config for message actions", async () => {

@@ -268,12 +277,9 @@ describe("messageCommand", () => {

268277

config: resolvedConfig,

269278

env: process.env,

270279

});

271-

expect(runMessageActionMock).toHaveBeenCalledWith(

272-

expect.objectContaining({

273-

cfg: autoEnabledConfig,

274-

params: expect.objectContaining({ target: "123456" }),

275-

}),

276-

);

280+

const actionCall = readOnlyMessageActionCall();

281+

expect(actionCall.cfg).toBe(autoEnabledConfig);

282+

expect(actionCall.params.target).toBe("123456");

277283

});

278284279285

it("normalizes poll actions and sender ownership before dispatch", async () => {

@@ -286,17 +292,12 @@ describe("messageCommand", () => {

286292

senderIsOwner: false,

287293

});

288294289-

expect(runMessageActionMock).toHaveBeenCalledWith(

290-

expect.objectContaining({

291-

action: "poll",

292-

senderIsOwner: false,

293-

params: expect.objectContaining({

294-

channel: "telegram",

295-

target: "123456789",

296-

pollQuestion: "Ship it?",

297-

}),

298-

}),

299-

);

295+

const actionCall = readOnlyMessageActionCall();

296+

expect(actionCall.action).toBe("poll");

297+

expect(actionCall.senderIsOwner).toBe(false);

298+

expect(actionCall.params.channel).toBe("telegram");

299+

expect(actionCall.params.target).toBe("123456789");

300+

expect(actionCall.params.pollQuestion).toBe("Ship it?");

300301

});

301302302303

it("rejects unknown message actions before dispatch", async () => {