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

推荐订阅源

Jina AI
Jina AI
S
SegmentFault 最新的问题
D
DataBreaches.Net
H
Help Net Security
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
Martin Fowler
Martin Fowler
IT之家
IT之家
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
罗磊的独立博客
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
云风的 BLOG
云风的 BLOG
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
Vercel News
Vercel News
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
博客园 - 三生石上(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: guard cron message tool calls · openclaw/openclaw@f...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -147,6 +147,14 @@ function expectEmbeddedRunFields(expected: Record<string, unknown>): Record<stri

147147

);

148148

}

149149150+

function expectEmbeddedRunPrompt(): string {

151+

const prompt = expectEmbeddedRunFields({}).prompt;

152+

if (typeof prompt !== "string") {

153+

throw new Error("expected embedded run prompt to be a string");

154+

}

155+

return prompt;

156+

}

157+150158

function expectDispatchFields(expected: Record<string, unknown>): Record<string, unknown> {

151159

return expectRecordFields(

152160

getMockCallArg(dispatchCronDeliveryMock, 0, 0, "cron delivery dispatch"),

@@ -175,8 +183,10 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {

175183

resolveCronDeliveryPlanMock.mockReturnValue(plan);

176184

await runCronIsolatedAgentTurn(makeParams());

177185

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

178-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.disableMessageTool).toBe(true);

179-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.forceMessageTool).toBe(false);

186+

expectEmbeddedRunFields({

187+

disableMessageTool: true,

188+

forceMessageTool: false,

189+

});

180190

}

181191182192

async function expectMessageToolEnabledForPlan(plan: {

@@ -189,8 +199,10 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {

189199

resolveCronDeliveryPlanMock.mockReturnValue(plan);

190200

await runCronIsolatedAgentTurn(makeParams());

191201

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

192-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.disableMessageTool).toBe(false);

193-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.forceMessageTool).toBe(true);

202+

expectEmbeddedRunFields({

203+

disableMessageTool: false,

204+

forceMessageTool: true,

205+

});

194206

}

195207196208

async function runModeNoneDeliveryCase(params: {

@@ -352,12 +364,12 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {

352364353365

expect(resolveDeliveryTargetMock).not.toHaveBeenCalled();

354366

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

355-

expectEmbeddedRunFields({

367+

const embeddedRun = expectEmbeddedRunFields({

356368

disableMessageTool: false,

357369

forceMessageTool: true,

358370

});

359-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.messageChannel).toBeUndefined();

360-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.messageTo).toBeUndefined();

371+

expect(embeddedRun.messageChannel).toBeUndefined();

372+

expect(embeddedRun.messageTo).toBeUndefined();

361373

});

362374363375

it('suppresses automatic exec completion notifications when delivery.mode is "none"', async () => {

@@ -474,12 +486,12 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {

474486475487

expect(resolveDeliveryTargetMock).not.toHaveBeenCalled();

476488

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

477-

expectEmbeddedRunFields({

489+

const embeddedRun = expectEmbeddedRunFields({

478490

disableMessageTool: false,

479491

forceMessageTool: true,

480492

});

481-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.messageChannel).toBeUndefined();

482-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.messageTo).toBeUndefined();

493+

expect(embeddedRun.messageChannel).toBeUndefined();

494+

expect(embeddedRun.messageTo).toBeUndefined();

483495

});

484496485497

it("resolves implicit last-target context for delivery.mode none with only accountId", async () => {

@@ -561,7 +573,7 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {

561573

});

562574563575

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

564-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.execOverrides).toBeUndefined();

576+

expect(expectEmbeddedRunFields({}).execOverrides).toBeUndefined();

565577

});

566578567579

it("keeps automatic exec completion notifications when webhook delivery is active", async () => {

@@ -581,7 +593,7 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {

581593

});

582594583595

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

584-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.execOverrides).toBeUndefined();

596+

expect(expectEmbeddedRunFields({}).execOverrides).toBeUndefined();

585597

});

586598587599

it("disables the message tool when webhook delivery is active", async () => {

@@ -602,7 +614,7 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {

602614

await runCronIsolatedAgentTurn(makeParams());

603615604616

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

605-

expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.disableMessageTool).toBe(false);

617+

expectEmbeddedRunFields({ disableMessageTool: false });

606618

});

607619608620

it("skips cron delivery when output is heartbeat-only", async () => {

@@ -883,7 +895,7 @@ describe("runCronIsolatedAgentTurn delivery instruction", () => {

883895

await runCronIsolatedAgentTurn(makeParams());

884896885897

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

886-

const prompt: string = runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.prompt ?? "";

898+

const prompt = expectEmbeddedRunPrompt();

887899

expect(prompt).toContain("Use the message tool");

888900

expect(prompt).toContain("will be delivered automatically");

889901

expect(prompt).not.toContain("note who/where");

@@ -907,7 +919,7 @@ describe("runCronIsolatedAgentTurn delivery instruction", () => {

907919

});

908920909921

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

910-

const prompt: string = runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.prompt ?? "";

922+

const prompt = expectEmbeddedRunPrompt();

911923

expect(prompt).not.toContain("Use the message tool");

912924

expect(prompt).toContain("Return your response as plain text");

913925

});

@@ -919,7 +931,7 @@ describe("runCronIsolatedAgentTurn delivery instruction", () => {

919931

await runCronIsolatedAgentTurn(makeParams());

920932921933

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

922-

const prompt: string = runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.prompt ?? "";

934+

const prompt = expectEmbeddedRunPrompt();

923935

expect(prompt).not.toContain("Return your response as plain text");

924936

expect(prompt).not.toContain("it will be delivered automatically");

925937

});

@@ -939,7 +951,7 @@ describe("runCronIsolatedAgentTurn delivery instruction", () => {

939951

await runCronIsolatedAgentTurn(makeParams());

940952941953

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

942-

const prompt: string = runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.prompt ?? "";

954+

const prompt = expectEmbeddedRunPrompt();

943955

expect(prompt).not.toMatch(/\bsummary\b/i);

944956

});

945957

});