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

推荐订阅源

宝玉的分享
宝玉的分享
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
小众软件
小众软件
月光博客
月光博客
D
DataBreaches.Net
L
LangChain Blog
美团技术团队
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
博客园 - 司徒正美
aimingoo的专栏
aimingoo的专栏
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Help Net Security
阮一峰的网络日志
阮一峰的网络日志
Y
Y Combinator Blog
I
InfoQ
U
Unit 42
Microsoft Azure Blog
Microsoft Azure Blog
J
Java Code Geeks
博客园 - 三生石上(FineUI控件)
腾讯CDC
Martin Fowler
Martin Fowler

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 cli runner spawn assertions · openclaw/open...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -154,8 +154,45 @@ function requireRegexMatch(value: string, pattern: RegExp): RegExpExecArray {

154154

return match;

155155

}

156156157+

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

158+

if (!value || typeof value !== "object") {

159+

throw new Error(`expected ${label} to be an object`);

160+

}

161+

return value as Record<string, unknown>;

162+

}

163+164+

function mockCallArg(mock: ReturnType<typeof vi.fn>, callIndex = 0, argIndex = 0): unknown {

165+

const call = mock.mock.calls[callIndex] as unknown[] | undefined;

166+

if (!call) {

167+

throw new Error(`expected mock call ${callIndex}`);

168+

}

169+

return call[argIndex];

170+

}

171+172+

async function expectRejectsWithFields(

173+

promise: Promise<unknown>,

174+

expected: Record<string, unknown>,

175+

): Promise<Record<string, unknown>> {

176+

try {

177+

await promise;

178+

} catch (error) {

179+

const actual = requireRecord(error, "rejection");

180+

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

181+

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

182+

}

183+

return actual;

184+

}

185+

throw new Error("expected promise to reject");

186+

}

187+157188

async function expectPathMissing(targetPath: string): Promise<void> {

158-

await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" });

189+

try {

190+

await fs.access(targetPath);

191+

} catch (error) {

192+

expect(requireRecord(error, "filesystem error").code).toBe("ENOENT");

193+

return;

194+

}

195+

throw new Error(`expected ${targetPath} to be missing`);

159196

}

160197161198

describe("runCliAgent spawn path", () => {

@@ -329,7 +366,7 @@ describe("runCliAgent spawn path", () => {

329366

}),

330367

);

331368332-

await expect(fs.access(systemPromptPath)).rejects.toMatchObject({ code: "ENOENT" });

369+

await expectPathMissing(systemPromptPath);

333370

});

334371335372

it("passes --session-id for new Claude sessions", async () => {

@@ -369,15 +406,12 @@ describe("runCliAgent spawn path", () => {

369406

}),

370407

);

371408372-

expect(resolveExecutionArgs).toHaveBeenCalledWith(

373-

expect.objectContaining({

374-

provider: "claude-cli",

375-

modelId: "sonnet",

376-

thinkingLevel: "high",

377-

useResume: false,

378-

baseArgs: ["-p", "--output-format", "stream-json"],

379-

}),

380-

);

409+

const resolveArgsInput = requireRecord(mockCallArg(resolveExecutionArgs), "resolved args");

410+

expect(resolveArgsInput.provider).toBe("claude-cli");

411+

expect(resolveArgsInput.modelId).toBe("sonnet");

412+

expect(resolveArgsInput.thinkingLevel).toBe("high");

413+

expect(resolveArgsInput.useResume).toBe(false);

414+

expect(resolveArgsInput.baseArgs).toEqual(["-p", "--output-format", "stream-json"]);

381415

const input = supervisorSpawnMock.mock.calls[0]?.[0] as { argv?: string[] };

382416

const effortArgIndex = input.argv?.indexOf("--effort") ?? -1;

383417

expect(effortArgIndex).toBeGreaterThanOrEqual(0);

@@ -410,10 +444,8 @@ describe("runCliAgent spawn path", () => {

410444

const manifest = JSON.parse(

411445

await fs.readFile(path.join(pluginDir, ".claude-plugin", "plugin.json"), "utf-8"),

412446

) as { name?: string; skills?: string };

413-

expect(manifest).toMatchObject({

414-

name: "openclaw-skills",

415-

skills: "./skills",

416-

});

447+

expect(manifest.name).toBe("openclaw-skills");

448+

expect(manifest.skills).toBe("./skills");

417449

await expect(

418450

fs.readFile(path.join(pluginDir, "skills", "weather", "SKILL.md"), "utf-8"),

419451

).resolves.toContain("Read forecast data before replying.");

@@ -738,7 +770,7 @@ describe("runCliAgent spawn path", () => {

738770

});

739771

abortController.abort();

740772741-

await expect(runPromise).rejects.toMatchObject({ name: "AbortError" });

773+

await expectRejectsWithFields(runPromise, { name: "AbortError" });

742774

expect(cancel).toHaveBeenCalledWith("manual-cancel");

743775

});

744776

@@ -1037,7 +1069,7 @@ describe("runCliAgent spawn path", () => {

10371069

};

10381070

});

103910711040-

await expect(

1072+

await expectRejectsWithFields(

10411073

executePreparedCliRun(

10421074

buildPreparedCliRunContext({

10431075

provider: "claude-cli",

@@ -1053,10 +1085,11 @@ describe("runCliAgent spawn path", () => {

10531085

},

10541086

}),

10551087

),

1056-

).rejects.toMatchObject({

1057-

name: "FailoverError",

1058-

message: "Claude CLI JSONL line exceeded output limit.",

1059-

});

1088+

{

1089+

name: "FailoverError",

1090+

message: "Claude CLI JSONL line exceeded output limit.",

1091+

},

1092+

);

10601093

});

1061109410621095

it("accepts operator-raised Claude live stream-json raw turn limits", async () => {

@@ -1173,7 +1206,8 @@ describe("runCliAgent spawn path", () => {

11731206

].join("\n") + "\n",

11741207

);

117512081176-

await expect(run).resolves.toMatchObject({ text: "done" });

1209+

const result = await run;

1210+

expect(result.text).toBe("done");

11771211

expect(replyRunRegistry.isStreaming("agent:main:main")).toBe(false);

11781212

operation.complete();

11791213

});

@@ -1448,16 +1482,9 @@ describe("runCliAgent spawn path", () => {

14481482

useResume: false,

14491483

});

145014841451-

expect(args).toEqual(

1452-

expect.arrayContaining([

1453-

"--input-format",

1454-

"stream-json",

1455-

"--output-format",

1456-

"stream-json",

1457-

"--permission-prompt-tool",

1458-

"stdio",

1459-

]),

1460-

);

1485+

expect(requireArgAfter(args, "--input-format")).toBe("stream-json");

1486+

expect(requireArgAfter(args, "--output-format")).toBe("stream-json");

1487+

expect(requireArgAfter(args, "--permission-prompt-tool")).toBe("stdio");

14611488

});

1462148914631490

it("restarts Claude live sessions for env changes and fresh retries", async () => {

@@ -1632,7 +1659,7 @@ describe("runCliAgent spawn path", () => {

16321659

};

16331660

});

163416611635-

await expect(

1662+

await expectRejectsWithFields(

16361663

executePreparedCliRun(

16371664

buildPreparedCliRunContext({

16381665

provider: "claude-cli",

@@ -1643,10 +1670,11 @@ describe("runCliAgent spawn path", () => {

16431670

},

16441671

}),

16451672

),

1646-

).rejects.toMatchObject({

1647-

name: "FailoverError",

1648-

message: "Credit balance is too low",

1649-

});

1673+

{

1674+

name: "FailoverError",

1675+

message: "Credit balance is too low",

1676+

},

1677+

);

16501678

});

1651167916521680

it("fails when Claude exits before a live turn starts", async () => {

@@ -1757,7 +1785,7 @@ describe("runCliAgent spawn path", () => {

17571785

});

17581786

abortController.abort();

175917871760-

await expect(first).rejects.toMatchObject({ name: "AbortError" });

1788+

await expectRejectsWithFields(first, { name: "AbortError" });

17611789

expect(cancels[0]).toHaveBeenCalledWith("manual-cancel");

17621790

stdoutListener?.(

17631791

[

@@ -2073,7 +2101,7 @@ describe("runCliAgent spawn path", () => {

20732101

);

2074210220752103

expect(first.text).toBe("first-ok");

2076-

await expect(second).rejects.toMatchObject({

2104+

await expectRejectsWithFields(second, {

20772105

name: "FailoverError",

20782106

message: "Claude CLI failed.",

20792107

});

@@ -2103,7 +2131,7 @@ describe("runCliAgent spawn path", () => {

21032131

}),

21042132

);

210521332106-

await expect(run).rejects.toMatchObject({

2134+

await expectRejectsWithFields(run, {

21072135

name: "FailoverError",

21082136

message,

21092137

reason: "billing",