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

推荐订阅源

WordPress大学
WordPress大学
G
Google Developers Blog
M
MIT News - Artificial intelligence
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
B
Blog RSS Feed
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Fortinet All Blogs
L
LangChain Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
B
Blog
J
Java Code Geeks
Hugging Face - Blog
Hugging Face - Blog
I
InfoQ
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

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 agent five-hit mock calls · openclaw/openclaw...
steipete · 2026-05-12 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -178,7 +178,7 @@ describe("anthropic transport stream", () => {

178178

);

179179
180180

expect(buildGuardedModelFetchMock).toHaveBeenCalledWith(model);

181-

const [url, init] = guardedFetchMock.mock.calls[0] ?? [];

181+

const [url, init] = guardedFetchMock.mock.calls.at(0) ?? [];

182182

expect(url).toBe("https://api.anthropic.com/v1/messages");

183183

expect(init?.method).toBe("POST");

184184

const headers = new Headers(init?.headers);

@@ -241,8 +241,8 @@ describe("anthropic transport stream", () => {

241241

} as AnthropicStreamOptions,

242242

);

243243
244-

expect(guardedFetchMock.mock.calls[0]?.[0]).toBe("https://custom-proxy.example/v1/messages");

245-

expect(guardedFetchMock.mock.calls[0]?.[1]?.method).toBe("POST");

244+

expect(guardedFetchMock.mock.calls.at(0)?.[0]).toBe("https://custom-proxy.example/v1/messages");

245+

expect(guardedFetchMock.mock.calls.at(0)?.[1]?.method).toBe("POST");

246246

expect(latestAnthropicRequestHeaders().get("anthropic-beta")).toBeNull();

247247

});

248248

@@ -468,8 +468,8 @@ describe("anthropic transport stream", () => {

468468

);

469469

const result = await stream.result();

470470
471-

expect(guardedFetchMock.mock.calls[0]?.[0]).toBe("https://api.anthropic.com/v1/messages");

472-

const headers = new Headers(guardedFetchMock.mock.calls[0]?.[1]?.headers);

471+

expect(guardedFetchMock.mock.calls.at(0)?.[0]).toBe("https://api.anthropic.com/v1/messages");

472+

const headers = new Headers(guardedFetchMock.mock.calls.at(0)?.[1]?.headers);

473473

expect(headers.get("authorization")).toBe("Bearer sk-ant-oat-example");

474474

expect(headers.get("x-app")).toBe("cli");

475475

expect(headers.get("user-agent")).toContain("claude-cli/");

Original file line numberDiff line numberDiff line change

@@ -286,7 +286,7 @@ describe("requestExecApprovalDecision", () => {

286286

ask: "always",

287287

});

288288
289-

const payload = vi.mocked(callGatewayTool).mock.calls[0]?.[2] as

289+

const payload = vi.mocked(callGatewayTool).mock.calls.at(0)?.[2] as

290290

| ApprovalRequestPayload

291291

| undefined;

292292

expect(payload?.commandSpans).toStrictEqual([

@@ -311,7 +311,7 @@ describe("requestExecApprovalDecision", () => {

311311
312312

expect(commandExplainerMock.explainShellCommand).not.toHaveBeenCalled();

313313

expect(commandExplainerMock.formatCommandSpans).not.toHaveBeenCalled();

314-

const payload = vi.mocked(callGatewayTool).mock.calls[0]?.[2] as

314+

const payload = vi.mocked(callGatewayTool).mock.calls.at(0)?.[2] as

315315

| { commandSpans?: unknown }

316316

| undefined;

317317

expect(payload?.commandSpans).toBeUndefined();

@@ -332,7 +332,7 @@ describe("requestExecApprovalDecision", () => {

332332
333333

expect(commandExplainerMock.explainShellCommand).not.toHaveBeenCalled();

334334

expect(commandExplainerMock.formatCommandSpans).not.toHaveBeenCalled();

335-

const payload = vi.mocked(callGatewayTool).mock.calls[0]?.[2] as

335+

const payload = vi.mocked(callGatewayTool).mock.calls.at(0)?.[2] as

336336

| { commandSpans?: unknown }

337337

| undefined;

338338

expect(payload?.commandSpans).toBeUndefined();

@@ -357,7 +357,7 @@ describe("requestExecApprovalDecision", () => {

357357

ask: "always",

358358

});

359359
360-

const payload = vi.mocked(callGatewayTool).mock.calls[0]?.[2] as

360+

const payload = vi.mocked(callGatewayTool).mock.calls.at(0)?.[2] as

361361

| ApprovalRequestPayload

362362

| undefined;

363363

expect(payload?.commandSpans).toStrictEqual([{ startIndex: 0, endIndex: 4 }]);

@@ -444,7 +444,7 @@ describe("requestExecApprovalDecision", () => {

444444

ask: "always",

445445

});

446446
447-

const payload = vi.mocked(callGatewayTool).mock.calls[0]?.[2] as

447+

const payload = vi.mocked(callGatewayTool).mock.calls.at(0)?.[2] as

448448

| ApprovalRequestPayload

449449

| undefined;

450450

expect(payload?.commandSpans).toEqual([{ startIndex: 0, endIndex: 4 }]);

Original file line numberDiff line numberDiff line change

@@ -311,7 +311,7 @@ describe("processGatewayAllowlist", () => {

311311

sessionKey: "agent:main:telegram:direct:123",

312312

});

313313
314-

const followupTargetInput = buildExecApprovalFollowupTargetMock.mock.calls[0]?.[0] as

314+

const followupTargetInput = buildExecApprovalFollowupTargetMock.mock.calls.at(0)?.[0] as

315315

| { sessionKey?: string }

316316

| undefined;

317317

expect(followupTargetInput?.sessionKey).toBe("agent:main:telegram:direct:123");

@@ -375,24 +375,24 @@ describe("processGatewayAllowlist", () => {

375375

await vi.waitFor(() => {

376376

expect(sendExecApprovalFollowupResultMock).toHaveBeenCalledTimes(1);

377377

});

378-

const followupTargetInput = buildExecApprovalFollowupTargetMock.mock.calls[0]?.[0] as

378+

const followupTargetInput = buildExecApprovalFollowupTargetMock.mock.calls.at(0)?.[0] as

379379

| { direct?: boolean }

380380

| undefined;

381381

expect(followupTargetInput?.direct).toBe(true);

382382
383-

const followupTarget = sendExecApprovalFollowupResultMock.mock.calls[0]?.[0] as

383+

const followupTarget = sendExecApprovalFollowupResultMock.mock.calls.at(0)?.[0] as

384384

| { direct?: boolean }

385385

| null

386386

| undefined;

387387

expect(followupTarget?.direct).toBe(true);

388-

const followupText = sendExecApprovalFollowupResultMock.mock.calls[0]?.[1] ?? "";

388+

const followupText = sendExecApprovalFollowupResultMock.mock.calls.at(0)?.[1] ?? "";

389389

expect(followupText).toContain("Diagnostics export created.");

390390

expect(followupText).toContain("Path: /tmp/openclaw-diagnostics.zip");

391391

expect(followupText).toContain("Contents (2 files):");

392392

expect(followupText).toContain("OpenAI Codex harness:");

393393

expect(followupText).toContain("Codex diagnostics sent to OpenAI servers:");

394394

expect(followupText).toContain("Codex thread id: `thread-1`");

395-

const approvalInput = approvalFollowup.mock.calls[0]?.[0] as

395+

const approvalInput = approvalFollowup.mock.calls.at(0)?.[0] as

396396

| {

397397

approvalId?: string;

398398

sessionId?: string;

Original file line numberDiff line numberDiff line change

@@ -28,8 +28,8 @@ describe("subscribeEmbeddedPiSession", () => {

2828

emitAssistantTextDelta({ emit, delta: "<final>Hi there</final>" });

2929
3030

expect(onPartialReply).toHaveBeenCalledTimes(1);

31-

const firstPayload = onPartialReply.mock.calls[0][0];

32-

expect(firstPayload.text).toBe("Hi there");

31+

const firstPayload = onPartialReply.mock.calls.at(0)?.[0];

32+

expect(firstPayload?.text).toBe("Hi there");

3333
3434

onPartialReply.mockClear();

3535

@@ -77,7 +77,7 @@ describe("subscribeEmbeddedPiSession", () => {

7777

emitAssistantTextDelta({ emit, delta: "<final>Hello world</final>" });

7878
7979

expect(onPartialReply).toHaveBeenCalledTimes(1);

80-

expect(onPartialReply.mock.calls[0][0].text).toBe("Hello world");

80+

expect(onPartialReply.mock.calls.at(0)?.[0]?.text).toBe("Hello world");

8181

});

8282
8383

it("strips final tags split across streamed deltas without emitting tag remnants", () => {

@@ -183,7 +183,7 @@ describe("subscribeEmbeddedPiSession", () => {

183183

await Promise.resolve();

184184
185185

expect(onBlockReply).toHaveBeenCalledTimes(1);

186-

expect(onBlockReply.mock.calls[0]?.[0]?.text).toBe("Answer ends with <fi");

186+

expect(onBlockReply.mock.calls.at(0)?.[0]?.text).toBe("Answer ends with <fi");

187187

});

188188
189189

it("keeps a trailing final-tag prefix when synchronous message_end drains chunked text_end replies", async () => {

@@ -246,8 +246,8 @@ describe("subscribeEmbeddedPiSession", () => {

246246
247247

emitAssistantTextDelta({ emit, delta: "Hello world" });

248248
249-

const payload = onPartialReply.mock.calls[0][0];

250-

expect(payload.text).toBe("Hello world");

249+

const payload = onPartialReply.mock.calls.at(0)?.[0];

250+

expect(payload?.text).toBe("Hello world");

251251

});

252252

it("emits block replies on message_end", async () => {

253253

const { session, emit } = createStubSessionHarness();

@@ -270,7 +270,7 @@ describe("subscribeEmbeddedPiSession", () => {

270270

await Promise.resolve();

271271
272272

expect(onBlockReply).toHaveBeenCalledTimes(1);

273-

const payload = onBlockReply.mock.calls[0][0];

274-

expect(payload.text).toBe("Hello block");

273+

const payload = onBlockReply.mock.calls.at(0)?.[0];

274+

expect(payload?.text).toBe("Hello block");

275275

});

276276

});

Original file line numberDiff line numberDiff line change

@@ -20,8 +20,8 @@ describe("subscribeEmbeddedPiSession", () => {

2020

emitAssistantTextDeltaAndEnd({ emit, text });

2121
2222

expect(onBlockReply).toHaveBeenCalledTimes(2);

23-

expect(onBlockReply.mock.calls[0][0].text).toBe("First block line");

24-

expect(onBlockReply.mock.calls[1][0].text).toBe("Second block line");

23+

expect(onBlockReply.mock.calls.at(0)?.[0]?.text).toBe("First block line");

24+

expect(onBlockReply.mock.calls.at(1)?.[0]?.text).toBe("Second block line");

2525

expect(subscription.assistantTexts).toEqual(["First block line", "Second block line"]);

2626

});

2727

it("avoids splitting inside fenced code blocks", () => {

@@ -39,8 +39,8 @@ describe("subscribeEmbeddedPiSession", () => {

3939

emitAssistantTextDeltaAndEnd({ emit, text });

4040
4141

expect(onBlockReply).toHaveBeenCalledTimes(3);

42-

expect(onBlockReply.mock.calls[0][0].text).toBe("Intro");

43-

expect(onBlockReply.mock.calls[1][0].text).toBe("```bash\nline1\nline2\n```");

44-

expect(onBlockReply.mock.calls[2][0].text).toBe("Outro");

42+

expect(onBlockReply.mock.calls.at(0)?.[0]?.text).toBe("Intro");

43+

expect(onBlockReply.mock.calls.at(1)?.[0]?.text).toBe("```bash\nline1\nline2\n```");

44+

expect(onBlockReply.mock.calls.at(2)?.[0]?.text).toBe("Outro");

4545

});

4646

});

Original file line numberDiff line numberDiff line change

@@ -144,8 +144,8 @@ describe("subscribeEmbeddedPiSession", () => {

144144

await Promise.resolve();

145145
146146

expect(onToolResult).toHaveBeenCalledTimes(1);

147-

const payload = onToolResult.mock.calls[0][0];

148-

expect(payload.text).toContain("/tmp/a.txt");

147+

const payload = onToolResult.mock.calls.at(0)?.[0];

148+

expect(payload?.text).toContain("/tmp/a.txt");

149149
150150

toolHarness.emit({

151151

type: "tool_execution_end",

@@ -177,10 +177,10 @@ describe("subscribeEmbeddedPiSession", () => {

177177

await Promise.resolve();

178178
179179

expect(onToolResult).toHaveBeenCalledTimes(1);

180-

const payload = onToolResult.mock.calls[0][0];

181-

expect(payload.text).toContain("🌐");

182-

expect(payload.text).toContain("Browser");

183-

expect(payload.text).toContain("https://example.com");

180+

const payload = onToolResult.mock.calls.at(0)?.[0];

181+

expect(payload?.text).toContain("🌐");

182+

expect(payload?.text).toContain("Browser");

183+

expect(payload?.text).toContain("https://example.com");

184184

});

185185
186186

it("emits exec output in full verbose mode and includes PTY indicator", async () => {

@@ -202,9 +202,9 @@ describe("subscribeEmbeddedPiSession", () => {

202202

await Promise.resolve();

203203
204204

expect(onToolResult).toHaveBeenCalledTimes(1);

205-

const summary = onToolResult.mock.calls[0][0];

206-

expect(summary.text).toContain("Exec");

207-

expect(summary.text).toContain("pty");

205+

const summary = onToolResult.mock.calls.at(0)?.[0];

206+

expect(summary?.text).toContain("pty");

207+

expect(summary?.text).toContain("claude");

208208
209209

toolHarness.emit({

210210

type: "tool_execution_end",

@@ -217,9 +217,9 @@ describe("subscribeEmbeddedPiSession", () => {

217217

await Promise.resolve();

218218
219219

expect(onToolResult).toHaveBeenCalledTimes(2);

220-

const output = onToolResult.mock.calls[1][0];

221-

expect(output.text).toContain("hello");

222-

expect(output.text).toContain("```txt");

220+

const output = onToolResult.mock.calls.at(1)?.[0];

221+

expect(output?.text).toContain("hello");

222+

expect(output?.text).toContain("```txt");

223223
224224

toolHarness.emit({

225225

type: "tool_execution_end",

@@ -232,7 +232,7 @@ describe("subscribeEmbeddedPiSession", () => {

232232

await Promise.resolve();

233233
234234

expect(onToolResult).toHaveBeenCalledTimes(3);

235-

const readOutput = onToolResult.mock.calls[2][0];

236-

expect(readOutput.text).toContain("file data");

235+

const readOutput = onToolResult.mock.calls.at(2)?.[0];

236+

expect(readOutput?.text).toContain("file data");

237237

});

238238

});

Original file line numberDiff line numberDiff line change

@@ -178,13 +178,13 @@ describe("ssh sandbox backend", () => {

178178

configLabelMatch: true,

179179

});

180180

const sessionSettings = requireRecord(

181-

sshMocks.createSshSandboxSessionFromSettings.mock.calls[0]?.[0],

181+

sshMocks.createSshSandboxSessionFromSettings.mock.calls.at(0)?.[0],

182182

"ssh session settings",

183183

);

184184

expect(sessionSettings.target).toBe("peter@example.com:2222");

185185

expect(sessionSettings.workspaceRoot).toBe("/remote/openclaw");

186186

const commandParams = requireRecord(

187-

sshMocks.runSshSandboxCommand.mock.calls[0]?.[0],

187+

sshMocks.runSshSandboxCommand.mock.calls.at(0)?.[0],

188188

"ssh run command params",

189189

);

190190

expect(commandParams.remoteCommand).toContain("/remote/openclaw/openclaw-ssh-agent-worker");

@@ -206,7 +206,7 @@ describe("ssh sandbox backend", () => {

206206

});

207207
208208

const commandParams = requireRecord(

209-

sshMocks.runSshSandboxCommand.mock.calls[0]?.[0],

209+

sshMocks.runSshSandboxCommand.mock.calls.at(0)?.[0],

210210

"ssh run command params",

211211

);

212212

expect(commandParams.allowFailure).toBe(true);

@@ -294,13 +294,13 @@ describe("ssh sandbox backend", () => {

294294

expect(execSpec.argv.at(-1)).toContain("/remote/openclaw/openclaw-ssh-agent-worker");

295295

expect(sshMocks.uploadDirectoryToSshTarget).toHaveBeenCalledTimes(2);

296296

const workspaceUploadParams = requireRecord(

297-

sshMocks.uploadDirectoryToSshTarget.mock.calls[0]?.[0],

297+

sshMocks.uploadDirectoryToSshTarget.mock.calls.at(0)?.[0],

298298

"workspace upload params",

299299

);

300300

expect(workspaceUploadParams.localDir).toBe("/tmp/workspace");

301301

expect(workspaceUploadParams.remoteDir).toContain("/workspace");

302302

const agentUploadParams = requireRecord(

303-

sshMocks.uploadDirectoryToSshTarget.mock.calls[1]?.[0],

303+

sshMocks.uploadDirectoryToSshTarget.mock.calls.at(1)?.[0],

304304

"agent upload params",

305305

);

306306

expect(agentUploadParams.localDir).toBe("/tmp/agent");

Original file line numberDiff line numberDiff line change

@@ -131,7 +131,7 @@ function mockAgentStartFailure() {

131131

}

132132
133133

function getSpawnedEventCall(): Record<string, unknown> {

134-

const [event] = (hookRunnerMocks.runSubagentSpawned.mock.calls[0] ?? []) as unknown as [

134+

const [event] = (hookRunnerMocks.runSubagentSpawned.mock.calls.at(0) ?? []) as unknown as [

135135

Record<string, unknown>,

136136

];

137137

return event;

@@ -242,8 +242,9 @@ describe("sessions_spawn subagent lifecycle hooks", () => {

242242
243243

expectFields(result, { status: "accepted", runId: "run-1" }, "spawn result");

244244

expect(hookRunnerMocks.runSubagentSpawning).toHaveBeenCalledTimes(1);

245-

const [spawningEvent, spawningContext] = (hookRunnerMocks.runSubagentSpawning.mock.calls[0] ??

246-

[]) as unknown as [Record<string, unknown>, Record<string, unknown>];

245+

const [spawningEvent, spawningContext] = (hookRunnerMocks.runSubagentSpawning.mock.calls.at(

246+

0,

247+

) ?? []) as unknown as [Record<string, unknown>, Record<string, unknown>];

247248

const spawningChildSessionKey = expectSubagentSessionKey(

248249

spawningEvent?.childSessionKey,

249250

"spawning event child session key",

@@ -275,7 +276,7 @@ describe("sessions_spawn subagent lifecycle hooks", () => {

275276

);

276277
277278

expect(hookRunnerMocks.runSubagentSpawned).toHaveBeenCalledTimes(1);

278-

const [event, ctx] = (hookRunnerMocks.runSubagentSpawned.mock.calls[0] ?? []) as unknown as [

279+

const [event, ctx] = (hookRunnerMocks.runSubagentSpawned.mock.calls.at(0) ?? []) as unknown as [

279280

Record<string, unknown>,

280281

Record<string, unknown>,

281282

];

@@ -321,7 +322,7 @@ describe("sessions_spawn subagent lifecycle hooks", () => {

321322

expectFields(result, { status: "accepted", runId: "run-1" }, "spawn result");

322323

expect(hookRunnerMocks.runSubagentSpawning).not.toHaveBeenCalled();

323324

expect(hookRunnerMocks.runSubagentSpawned).toHaveBeenCalledTimes(1);

324-

const [event] = (hookRunnerMocks.runSubagentSpawned.mock.calls[0] ?? []) as unknown as [

325+

const [event] = (hookRunnerMocks.runSubagentSpawned.mock.calls.at(0) ?? []) as unknown as [

325326

Record<string, unknown>,

326327

];

327328

expectFields(

@@ -440,7 +441,7 @@ describe("sessions_spawn subagent lifecycle hooks", () => {

440441
441442

expect(result.status).toBe("error");

442443

expect(hookRunnerMocks.runSubagentEnded).toHaveBeenCalledTimes(1);

443-

const [event] = (hookRunnerMocks.runSubagentEnded.mock.calls[0] ?? []) as unknown as [

444+

const [event] = (hookRunnerMocks.runSubagentEnded.mock.calls.at(0) ?? []) as unknown as [

444445

Record<string, unknown>,

445446

];

446447

expectSubagentSessionKey(event.targetSessionKey, "ended event target session key");