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

推荐订阅源

有赞技术团队
有赞技术团队
G
Google Developers Blog
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
P
Proofpoint News Feed
V
Visual Studio Blog
爱范儿
爱范儿
The Cloudflare Blog
博客园 - 叶小钗
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
博客园 - 聂微东
H
Help Net Security
B
Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 【当耐特】
量子位
宝玉的分享
宝玉的分享
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

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: clear ui cron broad matchers · openclaw/openclaw@c6...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -70,6 +70,35 @@ function findRequestCall(

7070

return call;

7171

}

727273+

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

74+

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

75+

throw new Error(`expected ${label} to be a record`);

76+

}

77+

return value as Record<string, unknown>;

78+

}

79+80+

function expectRecordFields(record: Record<string, unknown>, fields: Record<string, unknown>) {

81+

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

82+

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

83+

}

84+

}

85+86+

function expectNestedRecordFields(

87+

record: Record<string, unknown>,

88+

key: string,

89+

fields: Record<string, unknown>,

90+

) {

91+

expectRecordFields(requireRecord(record[key], key), fields);

92+

}

93+94+

function requestPayload(call: readonly [method: string, payload?: unknown]) {

95+

return requireRecord(call[1], `${call[0]} payload`);

96+

}

97+98+

function requestPatch(call: readonly [method: string, payload?: unknown]) {

99+

return requireRecord(requestPayload(call).patch, `${call[0]} patch`);

100+

}

101+73102

describe("cron controller", () => {

74103

it("loads model suggestions from the configured model view", async () => {

75104

const request = vi.fn(async () => ({

@@ -150,9 +179,13 @@ describe("cron controller", () => {

150179

await addCronJob(state);

151180152181

const addCall = findRequestCall(request.mock.calls, "cron.add");

153-

expect(addCall[1]).toMatchObject({

182+

const payload = requestPayload(addCall);

183+

expectRecordFields(payload, {

154184

name: "webhook job",

155-

delivery: { mode: "webhook", to: "https://example.invalid/cron" },

185+

});

186+

expectNestedRecordFields(payload, "delivery", {

187+

mode: "webhook",

188+

to: "https://example.invalid/cron",

156189

});

157190

});

158191

@@ -189,9 +222,13 @@ describe("cron controller", () => {

189222

await addCronJob(state);

190223191224

const addCall = findRequestCall(request.mock.calls, "cron.add");

192-

expect(addCall[1]).toMatchObject({

225+

const payload = requestPayload(addCall);

226+

expectRecordFields(payload, {

193227

sessionKey: "agent:ops:main",

194-

delivery: { mode: "announce", accountId: "ops-bot" },

228+

});

229+

expectNestedRecordFields(payload, "delivery", {

230+

mode: "announce",

231+

accountId: "ops-bot",

195232

});

196233

});

197234

@@ -228,8 +265,8 @@ describe("cron controller", () => {

228265

await addCronJob(state);

229266230267

const addCall = findRequestCall(request.mock.calls, "cron.add");

231-

expect(addCall[1]).toMatchObject({

232-

delivery: { mode: "announce" },

268+

expectRecordFields(requireRecord(requestPayload(addCall).delivery, "delivery"), {

269+

mode: "announce",

233270

});

234271

expect(

235272

(addCall[1] as { delivery?: { channel?: string } } | undefined)?.delivery?.channel,

@@ -267,8 +304,9 @@ describe("cron controller", () => {

267304

await addCronJob(state);

268305269306

const addCall = findRequestCall(request.mock.calls, "cron.add");

270-

expect(addCall[1]).toMatchObject({

271-

payload: { kind: "agentTurn", lightContext: true },

307+

expectNestedRecordFields(requestPayload(addCall), "payload", {

308+

kind: "agentTurn",

309+

lightContext: true,

272310

});

273311

});

274312

@@ -391,7 +429,7 @@ describe("cron controller", () => {

391429

await addCronJob(state);

392430393431

const addCall = findRequestCall(request.mock.calls, "cron.add");

394-

expect(addCall[1]).toMatchObject({

432+

expectRecordFields(requestPayload(addCall), {

395433

name: "main job",

396434

});

397435

// Delivery is explicitly sent as { mode: "none" } to clear the announce delivery on the backend.

@@ -440,17 +478,17 @@ describe("cron controller", () => {

440478

await addCronJob(state);

441479442480

const updateCall = findRequestCall(request.mock.calls, "cron.update");

443-

expect(updateCall[1]).toMatchObject({

481+

expectRecordFields(requestPayload(updateCall), {

444482

id: "job-1",

445-

patch: {

446-

name: "edited job",

447-

description: "",

448-

agentId: null,

449-

deleteAfterRun: false,

450-

schedule: { kind: "cron", expr: "0 8 * * *", staggerMs: 0 },

451-

payload: { kind: "systemEvent", text: "updated" },

452-

delivery: { mode: "none" },

453-

},

483+

});

484+

expectRecordFields(requestPatch(updateCall), {

485+

name: "edited job",

486+

description: "",

487+

agentId: null,

488+

deleteAfterRun: false,

489+

schedule: { kind: "cron", expr: "0 8 * * *", staggerMs: 0 },

490+

payload: { kind: "systemEvent", text: "updated" },

491+

delivery: { mode: "none" },

454492

});

455493

expect(state.cronEditingJobId).toBeNull();

456494

});

@@ -504,14 +542,12 @@ describe("cron controller", () => {

504542

await addCronJob(state);

505543506544

const updateCall = findRequestCall(request.mock.calls, "cron.update");

507-

expect(updateCall[1]).toMatchObject({

545+

expectRecordFields(requestPayload(updateCall), {

508546

id: "job-clear-account-id",

509-

patch: {

510-

delivery: {

511-

mode: "announce",

512-

accountId: "",

513-

},

514-

},

547+

});

548+

expectRecordFields(requireRecord(requestPatch(updateCall).delivery, "delivery"), {

549+

mode: "announce",

550+

accountId: "",

515551

});

516552

});

517553

@@ -587,11 +623,12 @@ describe("cron controller", () => {

587623

await addCronJob(state);

588624589625

const updateCall = findRequestCall(request.mock.calls, "cron.update");

590-

expect(updateCall[1]).toMatchObject({

626+

expectRecordFields(requestPayload(updateCall), {

591627

id: "job-implicit-delivery",

592-

patch: {

593-

delivery: { mode: "announce", to: "123" },

594-

},

628+

});

629+

expectRecordFields(requireRecord(requestPatch(updateCall).delivery, "delivery"), {

630+

mode: "announce",

631+

to: "123",

595632

});

596633

expect(

597634

(updateCall[1] as { patch?: { delivery?: { channel?: string } } } | undefined)?.patch

@@ -676,19 +713,23 @@ describe("cron controller", () => {

676713

await addCronJob(state);

677714678715

const updateCall = findRequestCall(request.mock.calls, "cron.update");

679-

expect(updateCall[1]).toMatchObject({

716+

expectRecordFields(requestPayload(updateCall), {

680717

id: "job-2",

681-

patch: {

682-

schedule: { kind: "cron", expr: "0 9 * * *", staggerMs: 30_000 },

683-

payload: {

684-

kind: "agentTurn",

685-

message: "run it",

686-

model: "opus",

687-

thinking: "low",

688-

},

689-

delivery: { mode: "announce", bestEffort: true },

718+

});

719+

const patch = requestPatch(updateCall);

720+

expectRecordFields(patch, {

721+

schedule: { kind: "cron", expr: "0 9 * * *", staggerMs: 30_000 },

722+

payload: {

723+

kind: "agentTurn",

724+

message: "run it",

725+

model: "opus",

726+

thinking: "low",

690727

},

691728

});

729+

expectNestedRecordFields(patch, "delivery", {

730+

mode: "announce",

731+

bestEffort: true,

732+

});

692733

});

693734694735

it("sends lightContext=false in cron.update when clearing prior light-context setting", async () => {

@@ -735,14 +776,12 @@ describe("cron controller", () => {

735776

await addCronJob(state);

736777737778

const updateCall = findRequestCall(request.mock.calls, "cron.update");

738-

expect(updateCall[1]).toMatchObject({

779+

expectRecordFields(requestPayload(updateCall), {

739780

id: "job-clear-light",

740-

patch: {

741-

payload: {

742-

kind: "agentTurn",

743-

lightContext: false,

744-

},

745-

},

781+

});

782+

expectRecordFields(requireRecord(requestPatch(updateCall).payload, "payload"), {

783+

kind: "agentTurn",

784+

lightContext: false,

746785

});

747786

});

748787

@@ -778,18 +817,16 @@ describe("cron controller", () => {

778817

await addCronJob(state);

779818780819

const updateCall = findRequestCall(request.mock.calls, "cron.update");

781-

expect(updateCall[1]).toMatchObject({

820+

expectRecordFields(requestPayload(updateCall), {

782821

id: "job-alert",

783-

patch: {

784-

failureAlert: {

785-

after: 3,

786-

cooldownMs: 120_000,

787-

channel: "telegram",

788-

to: "123456",

789-

mode: "announce",

790-

accountId: undefined,

791-

},

792-

},

822+

});

823+

expectRecordFields(requireRecord(requestPatch(updateCall).failureAlert, "failureAlert"), {

824+

after: 3,

825+

cooldownMs: 120_000,

826+

channel: "telegram",

827+

to: "123456",

828+

mode: "announce",

829+

accountId: undefined,

793830

});

794831

});

795832

@@ -824,15 +861,13 @@ describe("cron controller", () => {

824861

await addCronJob(state);

825862826863

const updateCall = findRequestCall(request.mock.calls, "cron.update");

827-

expect(updateCall[1]).toMatchObject({

864+

expectRecordFields(requestPayload(updateCall), {

828865

id: "job-alert-mode",

829-

patch: {

830-

failureAlert: {

831-

after: 1,

832-

mode: "webhook",

833-

accountId: "bot-a",

834-

},

835-

},

866+

});

867+

expectRecordFields(requireRecord(requestPatch(updateCall).failureAlert, "failureAlert"), {

868+

after: 1,

869+

mode: "webhook",

870+

accountId: "bot-a",

836871

});

837872

});

838873

@@ -872,15 +907,13 @@ describe("cron controller", () => {

872907

await addCronJob(state);

873908874909

const updateCall = findRequestCall(request.mock.calls, "cron.update");

875-

expect(updateCall[1]).toMatchObject({

910+

expectRecordFields(requestPayload(updateCall), {

876911

id: "job-alert-implicit-channel",

877-

patch: {

878-

failureAlert: {

879-

after: 2,

880-

to: "123",

881-

mode: "announce",

882-

},

883-

},

912+

});

913+

expectRecordFields(requireRecord(requestPatch(updateCall).failureAlert, "failureAlert"), {

914+

after: 2,

915+

to: "123",

916+

mode: "announce",

884917

});

885918

expect(

886919

(updateCall[1] as { patch?: { failureAlert?: { channel?: string } } } | undefined)?.patch

@@ -963,15 +996,13 @@ describe("cron controller", () => {

963996

await addCronJob(state);

964997965998

const updateCall = findRequestCall(request.mock.calls, "cron.update");

966-

expect(updateCall[1]).toMatchObject({

999+

expectRecordFields(requestPayload(updateCall), {

9671000

id: "job-alert-no-cooldown",

968-

patch: {

969-

failureAlert: {

970-

after: 3,

971-

channel: "telegram",

972-

to: "123456",

973-

},

974-

},

1001+

});

1002+

expectRecordFields(requireRecord(requestPatch(updateCall).failureAlert, "failureAlert"), {

1003+

after: 3,

1004+

channel: "telegram",

1005+

to: "123456",

9751006

});

9761007

expect(

9771008

(updateCall[1] as { patch?: { failureAlert?: { cooldownMs?: number } } })?.patch

@@ -1007,10 +1038,10 @@ describe("cron controller", () => {

10071038

await addCronJob(state);

1008103910091040

const updateCall = findRequestCall(request.mock.calls, "cron.update");

1010-

expect(updateCall[1]).toMatchObject({

1041+

expectRecordFields(requestPayload(updateCall), {

10111042

id: "job-no-alert",

1012-

patch: { failureAlert: false },

10131043

});

1044+

expect(requestPatch(updateCall).failureAlert).toBe(false);

10141045

});

1015104610161047

it("maps cron stagger, model, thinking, and best effort into form", () => {

@@ -1109,7 +1140,7 @@ describe("cron controller", () => {

11091140

});

11101141

await addCronJob(state);

11111142

expect(request).not.toHaveBeenCalled();

1112-

expect(state.cronFieldErrors).toMatchObject({

1143+

expectRecordFields(state.cronFieldErrors, {

11131144

name: "cron.errors.nameRequired",

11141145

payloadText: "cron.errors.agentMessageRequired",

11151146

});

@@ -1215,7 +1246,7 @@ describe("cron controller", () => {

12151246

it("loads paged jobs with query/filter/sort params", async () => {

12161247

const request = vi.fn(async (method: string, payload?: unknown) => {

12171248

if (method === "cron.list") {

1218-

expect(payload).toMatchObject({

1249+

expectRecordFields(requireRecord(payload, "cron.list payload"), {

12191250

limit: 50,

12201251

offset: 0,

12211252

query: "daily",

@@ -1346,7 +1377,10 @@ describe("cron controller", () => {

13461377

it("runs cron job in due mode when requested", async () => {

13471378

const request = vi.fn(async (method: string, payload?: unknown) => {

13481379

if (method === "cron.run") {

1349-

expect(payload).toMatchObject({ id: "job-due", mode: "due" });

1380+

expectRecordFields(requireRecord(payload, "cron.run payload"), {

1381+

id: "job-due",

1382+

mode: "due",

1383+

});

13501384

return { ok: true };

13511385

}

13521386

if (method === "cron.runs") {