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

推荐订阅源

M
MIT News - Artificial intelligence
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
博客园 - Franky
腾讯CDC
T
Tailwind CSS Blog
Recent Announcements
Recent Announcements
V
V2EX
N
Netflix TechBlog - Medium
量子位
Jina AI
Jina AI
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
G
Google Developers Blog
爱范儿
爱范儿
博客园 - 叶小钗
D
Docker
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss

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 exec approval id assertions · openclaw/open...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -360,6 +360,29 @@ function mockNoApprovalRouteRegistration() {

360360

});

361361

}

362362363+

function requireRecord(value: unknown, label: string): Record<string, unknown> {

364+

if (!value || typeof value !== "object" || Array.isArray(value)) {

365+

throw new Error(`expected ${label}`);

366+

}

367+

return value as Record<string, unknown>;

368+

}

369+370+

function expectRecordFields(

371+

record: Record<string, unknown> | undefined,

372+

expected: Record<string, unknown>,

373+

) {

374+

if (!record) {

375+

throw new Error("expected record");

376+

}

377+

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

378+

if (Array.isArray(value)) {

379+

expect(record[key]).toEqual(value);

380+

} else {

381+

expect(record[key]).toBe(value);

382+

}

383+

}

384+

}

385+363386

describe("exec approvals", () => {

364387

let previousHome: string | undefined;

365388

let previousUserProfile: string | undefined;

@@ -463,17 +486,15 @@ describe("exec approvals", () => {

463486

interval: 1,

464487

})

465488

.toBe(approvalId);

466-

expect(

467-

(invokeParams as { params?: { suppressNotifyOnExit?: boolean } } | undefined)?.params,

468-

).toMatchObject({

469-

suppressNotifyOnExit: true,

470-

});

471-

await expect

472-

.poll(() => agentParams, { timeout: 2000, interval: 1 })

473-

.toMatchObject({

474-

message: expect.stringContaining(`id=${approvalId}`),

475-

sessionKey: "agent:main:main",

476-

});

489+

const nodeInvokeParams = requireRecord(

490+

requireRecord(invokeParams, "node invoke").params,

491+

"node invoke params",

492+

);

493+

expect(nodeInvokeParams.suppressNotifyOnExit).toBe(true);

494+

await expect.poll(() => agentParams !== undefined, { timeout: 2000, interval: 1 }).toBe(true);

495+

const agent = requireRecord(agentParams, "agent followup params");

496+

expect(String(agent.message)).toContain(`id=${approvalId}`);

497+

expect(agent.sessionKey).toBe("agent:main:main");

477498

});

478499479500

it("skips approval when node allowlist is satisfied", async () => {

@@ -702,9 +723,10 @@ describe("exec approvals", () => {

702723

});

703724704725

expect(durable.details.status).toBe("approval-pending");

705-

expect(durable.details).toMatchObject({

706-

allowedDecisions: ["allow-once", "deny"],

707-

});

726+

expect(requireRecord(durable.details, "durable details").allowedDecisions).toEqual([

727+

"allow-once",

728+

"deny",

729+

]);

708730

expect(getResultText(durable)).toContain("Reply with: /approve ");

709731

expect(getResultText(durable)).toContain("allow-once|deny");

710732

expect(getResultText(durable)).not.toContain("allow-once|allow-always|deny");

@@ -824,9 +846,10 @@ describe("exec approvals", () => {

824846

});

825847826848

expect(result.details.status).toBe("approval-pending");

827-

expect(result.details).toMatchObject({

828-

allowedDecisions: ["allow-once", "deny"],

829-

});

849+

expect(requireRecord(result.details, "result details").allowedDecisions).toEqual([

850+

"allow-once",

851+

"deny",

852+

]);

830853

expect(calls).toContain("exec.approval.request");

831854

});

832855

@@ -941,13 +964,11 @@ describe("exec approvals", () => {

941964942965

expect(result.details.status).toBe("approval-pending");

943966

await expect.poll(() => agentCalls.length, { timeout: 3000, interval: 1 }).toBe(1);

944-

expect(agentCalls[0]).toEqual(

945-

expect.objectContaining({

946-

sessionKey: "agent:main:main",

947-

deliver: false,

948-

idempotencyKey: expect.stringContaining("exec-approval-followup:"),

949-

}),

950-

);

967+

expectRecordFields(agentCalls[0], {

968+

sessionKey: "agent:main:main",

969+

deliver: false,

970+

});

971+

expect(String(agentCalls[0]?.idempotencyKey)).toContain("exec-approval-followup:");

951972

expect(typeof agentCalls[0]?.message).toBe("string");

952973

expect(agentCalls[0]?.message).toContain(

953974

"An async command the user already approved has completed.",

@@ -982,18 +1003,16 @@ describe("exec approvals", () => {

98210039831004

expect(result.details.status).toBe("approval-pending");

9841005

await expect.poll(() => agentCalls.length, { timeout: 3000, interval: 1 }).toBe(1);

985-

expect(agentCalls[0]).toEqual(

986-

expect.objectContaining({

987-

sessionKey: "agent:main:discord:channel:123",

988-

deliver: true,

989-

bestEffortDeliver: true,

990-

channel: "discord",

991-

to: "123",

992-

accountId: "default",

993-

threadId: "456",

994-

idempotencyKey: expect.stringContaining("exec-approval-followup:"),

995-

}),

996-

);

1006+

expectRecordFields(agentCalls[0], {

1007+

sessionKey: "agent:main:discord:channel:123",

1008+

deliver: true,

1009+

bestEffortDeliver: true,

1010+

channel: "discord",

1011+

to: "123",

1012+

accountId: "default",

1013+

threadId: "456",

1014+

});

1015+

expect(String(agentCalls[0]?.idempotencyKey)).toContain("exec-approval-followup:");

9971016

expect(typeof agentCalls[0]?.message).toBe("string");

9981017

expect(agentCalls[0]?.message).toContain(

9991018

"If the task requires more steps, continue from this result before replying to the user.",

@@ -1045,17 +1064,15 @@ describe("exec approvals", () => {

10451064

resolveDecision?.({ decision: "allow-once" });

1046106510471066

await expect.poll(() => agentCalls.length, { timeout: 3000, interval: 1 }).toBe(1);

1048-

expect(agentCalls[0]).toEqual(

1049-

expect.objectContaining({

1050-

sessionKey: "agent:main:discord:channel:123",

1051-

deliver: true,

1052-

bestEffortDeliver: true,

1053-

channel: "discord",

1054-

to: "123",

1055-

accountId: "default",

1056-

threadId: "456",

1057-

}),

1058-

);

1067+

expectRecordFields(agentCalls[0], {

1068+

sessionKey: "agent:main:discord:channel:123",

1069+

deliver: true,

1070+

bestEffortDeliver: true,

1071+

channel: "discord",

1072+

to: "123",

1073+

accountId: "default",

1074+

threadId: "456",

1075+

});

10591076

expect(typeof agentCalls[0]?.message).toBe("string");

10601077

expect(agentCalls[0]?.message).toContain(

10611078

"If the task requires more steps, continue from this result before replying to the user.",

@@ -1089,12 +1106,10 @@ describe("exec approvals", () => {

10891106

expect(result.details.status).toBe("approval-pending");

1090110710911108

await expect.poll(() => agentCalls.length, { timeout: 3000, interval: 1 }).toBe(1);

1092-

expect(agentCalls[0]).toEqual(

1093-

expect.objectContaining({

1094-

sessionKey: "agent:main:main",

1095-

deliver: false,

1096-

}),

1097-

);

1109+

expectRecordFields(agentCalls[0], {

1110+

sessionKey: "agent:main:main",

1111+

deliver: false,

1112+

});

10981113

expect(agentCalls[0]?.message).toContain("webchat-ok");

10991114

});

11001115

@@ -1375,11 +1390,11 @@ describe("exec approvals", () => {

13751390

expect(result.details.status).toBe("completed");

13761391

expect(getResultText(result)).toContain("cron-ok");

137713921378-

expect(vi.mocked(callGatewayTool)).toHaveBeenCalledWith(

1379-

"exec.approval.request",

1380-

expect.anything(),

1381-

expect.anything(),

1382-

expect.objectContaining({ expectFinal: false }),

1393+

const approvalRequestCall = vi

1394+

.mocked(callGatewayTool)

1395+

.mock.calls.find(([method]) => method === "exec.approval.request");

1396+

expect(requireRecord(approvalRequestCall?.[3], "approval request options").expectFinal).toBe(

1397+

false,

13831398

);

13841399

expect(

13851400

vi

@@ -1448,17 +1463,13 @@ describe("exec approvals", () => {

1448146314491464

expect(result.details.status).toBe("completed");

14501465

expect(getResultText(result)).toContain("cron-node-ok");

1451-

expect(systemRunInvoke).toMatchObject({

1452-

command: "system.run",

1453-

params: {

1454-

approved: true,

1455-

approvalDecision: "allow-once",

1456-

systemRunPlan: preparedPlan,

1457-

},

1458-

});

1459-

expect((systemRunInvoke as { params?: { runId?: string } }).params?.runId).toEqual(

1460-

expect.any(String),

1461-

);

1466+

const systemRun = requireRecord(systemRunInvoke, "system.run invoke");

1467+

expect(systemRun.command).toBe("system.run");

1468+

const params = requireRecord(systemRun.params, "system.run params");

1469+

expect(params.approved).toBe(true);

1470+

expect(params.approvalDecision).toBe("allow-once");

1471+

expect(params.systemRunPlan).toStrictEqual(preparedPlan);

1472+

expect(params.runId).toBeTypeOf("string");

14621473

});

1463147414641475

it("explains cron no-route denials with a host-policy fix hint", async () => {