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

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
腾讯CDC
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog
宝玉的分享
宝玉的分享
有赞技术团队
有赞技术团队
美团技术团队
雷峰网
雷峰网
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
博客园_首页
Recent Announcements
Recent Announcements
云风的 BLOG
云风的 BLOG
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
D
Docker
博客园 - Franky
Jina AI
Jina AI

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 run wait assertions · openclaw/openclaw@f3e...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -15,6 +15,55 @@ import {

1515

waitForAgentRunAndReadUpdatedAssistantReply,

1616

} from "./run-wait.js";

171718+

type AgentWaitGatewayRequest = {

19+

method?: string;

20+

params?: {

21+

runId?: string;

22+

timeoutMs?: unknown;

23+

};

24+

timeoutMs?: unknown;

25+

};

26+27+

function expectNumber(value: unknown, label: string): number {

28+

expect(typeof value).toBe("number");

29+

if (typeof value !== "number") {

30+

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

31+

}

32+

return value;

33+

}

34+35+

function gatewayWaitRequests(): AgentWaitGatewayRequest[] {

36+

return callGatewayMock.mock.calls.map(([request]) => request as AgentWaitGatewayRequest);

37+

}

38+39+

function requireRequestAt(

40+

requests: readonly AgentWaitGatewayRequest[],

41+

index: number,

42+

): AgentWaitGatewayRequest {

43+

const request = requests.at(index);

44+

if (!request) {

45+

throw new Error(`expected gateway request at index ${index}`);

46+

}

47+

return request;

48+

}

49+50+

function expectAgentWaitRequest(

51+

request: AgentWaitGatewayRequest,

52+

runId: string,

53+

maxParamTimeoutMs: number,

54+

): void {

55+

expect(request.method).toBe("agent.wait");

56+

expect(request.params?.runId).toBe(runId);

57+58+

const paramTimeoutMs = expectNumber(request.params?.timeoutMs, `${runId} param timeoutMs`);

59+

const requestTimeoutMs = expectNumber(request.timeoutMs, `${runId} request timeoutMs`);

60+

expect(requestTimeoutMs).toBeGreaterThan(0);

61+

expect(requestTimeoutMs).toBeLessThanOrEqual(maxParamTimeoutMs + 2_000);

62+

expect(paramTimeoutMs).toBe(requestTimeoutMs - 2_000);

63+

expect(paramTimeoutMs).toBeGreaterThan(0);

64+

expect(paramTimeoutMs).toBeLessThanOrEqual(maxParamTimeoutMs);

65+

}

66+1867

describe("readLatestAssistantReply", () => {

1968

beforeEach(() => {

2069

callGatewayMock.mockClear();

@@ -287,29 +336,14 @@ describe("waitForAgentRunsToDrain", () => {

287336

getPendingRunIds: () => activeRunIds,

288337

});

289338290-

expect(result).toEqual({

291-

timedOut: false,

292-

pendingRunIds: [],

293-

deadlineAtMs: expect.any(Number),

294-

});

295-

expect(callGatewayMock.mock.calls.map((call) => call[0])).toEqual([

296-

{

297-

method: "agent.wait",

298-

params: {

299-

runId: "run-1",

300-

timeoutMs: expect.any(Number),

301-

},

302-

timeoutMs: expect.any(Number),

303-

},

304-

{

305-

method: "agent.wait",

306-

params: {

307-

runId: "run-2",

308-

timeoutMs: expect.any(Number),

309-

},

310-

timeoutMs: expect.any(Number),

311-

},

312-

]);

339+

expect(result.timedOut).toBe(false);

340+

expect(result.pendingRunIds).toStrictEqual([]);

341+

expectNumber(result.deadlineAtMs, "deadlineAtMs");

342+343+

const requests = gatewayWaitRequests();

344+

expect(requests).toHaveLength(2);

345+

expectAgentWaitRequest(requireRequestAt(requests, 0), "run-1", 1_000);

346+

expectAgentWaitRequest(requireRequestAt(requests, 1), "run-2", 1_000);

313347

});

314348315349

it("deduplicates and trims pending run ids", async () => {

@@ -344,15 +378,9 @@ describe("waitForAgentRunsToDrain", () => {

344378

});

345379346380

expect(result.timedOut).toBe(false);

347-

expect(callGatewayMock.mock.calls.map((call) => call[0])).toEqual([

348-

expect.objectContaining({

349-

method: "agent.wait",

350-

params: expect.objectContaining({ runId: "run-1" }),

351-

}),

352-

expect.objectContaining({

353-

method: "agent.wait",

354-

params: expect.objectContaining({ runId: "run-2" }),

355-

}),

356-

]);

381+

const requests = gatewayWaitRequests();

382+

expect(requests).toHaveLength(2);

383+

expectAgentWaitRequest(requireRequestAt(requests, 0), "run-1", 1_000);

384+

expectAgentWaitRequest(requireRequestAt(requests, 1), "run-2", 1_000);

357385

});

358386

});