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

推荐订阅源

Engineering at Meta
Engineering at Meta
博客园_首页
J
Java Code Geeks
Jina AI
Jina AI
B
Blog RSS Feed
量子位
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
L
LangChain Blog
Microsoft Security Blog
Microsoft Security Blog
小众软件
小众软件
博客园 - 聂微东
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog
I
InfoQ
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
Y
Y Combinator Blog
Vercel News
Vercel News
雷峰网
雷峰网

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 followup runner broad matchers · openclaw/ope...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -56,6 +56,54 @@ function joinPromptSections(...sections: Array<string | undefined>): string {

5656

return promptSections.join("\n\n");

5757

}

585859+

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

60+

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

61+

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

62+

}

63+

return value as Record<string, unknown>;

64+

}

65+66+

function requireMockCallArg(

67+

mock: { mock: { calls: unknown[][] } },

68+

index: number,

69+

): Record<string, unknown> {

70+

const call = mock.mock.calls[index];

71+

if (!call) {

72+

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

73+

}

74+

return requireRecord(call[0], `mock call ${index} arg`);

75+

}

76+77+

function expectBlockReplyText(onBlockReply: { mock: { calls: unknown[][] } }, text: string): void {

78+

expect(

79+

onBlockReply.mock.calls.some(

80+

(call) => requireRecord(call[0], "block reply payload").text === text,

81+

),

82+

).toBe(true);

83+

}

84+85+

function expectNoBlockReplyText(

86+

onBlockReply: { mock: { calls: unknown[][] } },

87+

text: string,

88+

): void {

89+

expect(

90+

onBlockReply.mock.calls.some(

91+

(call) => requireRecord(call[0], "block reply payload").text === text,

92+

),

93+

).toBe(false);

94+

}

95+96+

function expectNoBlockReplyTextIncludes(

97+

onBlockReply: { mock: { calls: unknown[][] } },

98+

fragment: string,

99+

): void {

100+

expect(

101+

onBlockReply.mock.calls.some((call) =>

102+

String(requireRecord(call[0], "block reply payload").text).includes(fragment),

103+

),

104+

).toBe(false);

105+

}

106+59107

function registerFollowupTestSessionStore(

60108

storePath: string,

61109

sessionStore: Record<string, SessionEntry>,

@@ -577,11 +625,7 @@ describe("createFollowupRunner runtime config", () => {

577625

await runner(queued);

578626579627

expect(queued.run.config).toBe(runtimeConfig);

580-

expect(runPreflightCompactionIfNeededMock).toHaveBeenCalledWith(

581-

expect.objectContaining({

582-

cfg: runtimeConfig,

583-

}),

584-

);

628+

expect(requireMockCallArg(runPreflightCompactionIfNeededMock, 0).cfg).toBe(runtimeConfig);

585629

const call = runEmbeddedPiAgentMock.mock.calls.at(-1)?.[0] as

586630

| {

587631

config?: unknown;

@@ -1174,14 +1218,11 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

11741218

});

1175121911761220

expect(onBlockReply).not.toHaveBeenCalled();

1177-

expect(persistSpy).toHaveBeenCalledWith(

1178-

expect.objectContaining({

1179-

storePath,

1180-

sessionKey,

1181-

modelUsed: "claude-opus-4-6",

1182-

providerUsed: "anthropic",

1183-

}),

1184-

);

1221+

const persistCall = requireMockCallArg(persistSpy, 0);

1222+

expect(persistCall.storePath).toBe(storePath);

1223+

expect(persistCall.sessionKey).toBe(sessionKey);

1224+

expect(persistCall.modelUsed).toBe("claude-opus-4-6");

1225+

expect(persistCall.providerUsed).toBe("anthropic");

11851226

expect(sessionStore[sessionKey]?.totalTokens).toBe(400);

11861227

expect(sessionStore[sessionKey]?.model).toBe("claude-opus-4-6");

11871228

// Accumulated usage is still stored for usage/cost tracking.

@@ -1234,13 +1275,10 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

12341275

),

12351276

).resolves.toBeUndefined();

123612771237-

expect(persistSpy).toHaveBeenCalledWith(

1238-

expect.objectContaining({

1239-

storePath,

1240-

sessionKey,

1241-

cfg,

1242-

}),

1243-

);

1278+

const persistCall = requireMockCallArg(persistSpy, 0);

1279+

expect(persistCall.storePath).toBe(storePath);

1280+

expect(persistCall.sessionKey).toBe(sessionKey);

1281+

expect(persistCall.cfg).toBe(cfg);

12441282

persistSpy.mockRestore();

12451283

});

12461284

@@ -1292,11 +1330,7 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

12921330

),

12931331

).resolves.toBeUndefined();

129413321295-

expect(persistSpy).toHaveBeenCalledWith(

1296-

expect.objectContaining({

1297-

providerUsed: "anthropic",

1298-

}),

1299-

);

1333+

expect(requireMockCallArg(persistSpy, 0).providerUsed).toBe("anthropic");

13001334

expect(persistSpy.mock.calls[0]?.[0]?.usageIsContextSnapshot).toBeUndefined();

13011335

persistSpy.mockRestore();

13021336

});

@@ -1317,18 +1351,11 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

1317135113181352

expect(routeReplyMock).toHaveBeenCalledTimes(2);

13191353

expect(onBlockReply).toHaveBeenCalledTimes(1);

1320-

expect(onBlockReply).toHaveBeenCalledWith(

1321-

expect.objectContaining({

1322-

isError: true,

1323-

text: expect.stringContaining("could not deliver it to the originating channel"),

1324-

}),

1325-

);

1326-

expect(onBlockReply).not.toHaveBeenCalledWith(

1327-

expect.objectContaining({ text: "hello world!" }),

1328-

);

1329-

expect(onBlockReply).not.toHaveBeenCalledWith(

1330-

expect.objectContaining({ text: "second payload" }),

1331-

);

1354+

const reply = requireMockCallArg(onBlockReply, 0);

1355+

expect(reply.isError).toBe(true);

1356+

expect(String(reply.text)).toContain("could not deliver it to the originating channel");

1357+

expectNoBlockReplyText(onBlockReply, "hello world!");

1358+

expectNoBlockReplyText(onBlockReply, "second payload");

13321359

});

1333136013341361

it("does not emit cross-channel route-failure notice when a later payload routes", async () => {

@@ -1348,11 +1375,7 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

13481375

});

1349137613501377

expect(routeReplyMock).toHaveBeenCalledTimes(2);

1351-

expect(onBlockReply).not.toHaveBeenCalledWith(

1352-

expect.objectContaining({

1353-

text: expect.stringContaining("could not deliver it to the originating channel"),

1354-

}),

1355-

);

1378+

expectNoBlockReplyTextIncludes(onBlockReply, "could not deliver it to the originating channel");

13561379

});

1357138013581381

it("uses dispatcher when origin routing metadata is incomplete", async () => {

@@ -1367,7 +1390,7 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

1367139013681391

expect(routeReplyMock).not.toHaveBeenCalled();

13691392

expect(onBlockReply).toHaveBeenCalledTimes(1);

1370-

expect(onBlockReply).toHaveBeenCalledWith(expect.objectContaining({ text: "hello world!" }));

1393+

expectBlockReplyText(onBlockReply, "hello world!");

13711394

});

1372139513731396

it("keeps message-tool-only queued followup finals private", async () => {

@@ -1385,12 +1408,9 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

13851408

} as FollowupRun,

13861409

});

138714101388-

expect(runEmbeddedPiAgentMock).toHaveBeenCalledWith(

1389-

expect.objectContaining({

1390-

sourceReplyDeliveryMode: "message_tool_only",

1391-

forceMessageTool: true,

1392-

}),

1393-

);

1411+

const runArg = requireMockCallArg(runEmbeddedPiAgentMock, 0);

1412+

expect(runArg.sourceReplyDeliveryMode).toBe("message_tool_only");

1413+

expect(runArg.forceMessageTool).toBe(true);

13941414

expect(routeReplyMock).not.toHaveBeenCalled();

13951415

expect(onBlockReply).not.toHaveBeenCalled();

13961416

});

@@ -1411,19 +1431,15 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

1411143114121432

expect(routeReplyMock).not.toHaveBeenCalled();

14131433

expect(onBlockReply).toHaveBeenCalledTimes(1);

1414-

expect(onBlockReply).toHaveBeenCalledWith(expect.objectContaining({ text: "hello world!" }));

1415-

expect(resolveProviderFollowupFallbackRouteMock).toHaveBeenCalledWith(

1416-

expect.objectContaining({

1417-

provider: "anthropic",

1418-

context: expect.objectContaining({

1419-

provider: "anthropic",

1420-

modelId: "claude",

1421-

originRoutable: true,

1422-

dispatcherAvailable: true,

1423-

payload: expect.objectContaining({ text: "hello world!" }),

1424-

}),

1425-

}),

1426-

);

1434+

expectBlockReplyText(onBlockReply, "hello world!");

1435+

const routeArg = requireMockCallArg(resolveProviderFollowupFallbackRouteMock, 0);

1436+

expect(routeArg.provider).toBe("anthropic");

1437+

const context = requireRecord(routeArg.context, "provider fallback context");

1438+

expect(context.provider).toBe("anthropic");

1439+

expect(context.modelId).toBe("claude");

1440+

expect(context.originRoutable).toBe(true);

1441+

expect(context.dispatcherAvailable).toBe(true);

1442+

expect(requireRecord(context.payload, "provider fallback payload").text).toBe("hello world!");

14271443

});

1428144414291445

it("lets provider followup route hooks drop payloads explicitly", async () => {

@@ -1501,12 +1517,9 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

1501151715021518

expect(routeReplyMock).not.toHaveBeenCalled();

15031519

expect(onBlockReply).toHaveBeenCalledTimes(1);

1504-

expect(onBlockReply).toHaveBeenCalledWith(

1505-

expect.objectContaining({

1506-

text: DELIVERY_NO_REPLY_RUNTIME_CONTRACT.silentText,

1507-

mediaUrl: "file:///tmp/followup.png",

1508-

}),

1509-

);

1520+

const reply = requireMockCallArg(onBlockReply, 0);

1521+

expect(reply.text).toBe(DELIVERY_NO_REPLY_RUNTIME_CONTRACT.silentText);

1522+

expect(reply.mediaUrl).toBe("file:///tmp/followup.png");

15101523

});

1511152415121525

it("falls back to dispatcher when successful output has no complete origin route", async () => {

@@ -1521,9 +1534,7 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

1521153415221535

expect(routeReplyMock).not.toHaveBeenCalled();

15231536

expect(onBlockReply).toHaveBeenCalledTimes(1);

1524-

expect(onBlockReply).toHaveBeenCalledWith(

1525-

expect.objectContaining({ text: DELIVERY_NO_REPLY_RUNTIME_CONTRACT.dispatcherText }),

1526-

);

1537+

expectBlockReplyText(onBlockReply, DELIVERY_NO_REPLY_RUNTIME_CONTRACT.dispatcherText);

15271538

});

1528153915291540

it("falls back to dispatcher when same-channel origin routing fails", async () => {

@@ -1547,7 +1558,7 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

1547155815481559

expect(routeReplyMock).toHaveBeenCalled();

15491560

expect(onBlockReply).toHaveBeenCalledTimes(1);

1550-

expect(onBlockReply).toHaveBeenCalledWith(expect.objectContaining({ text: "hello world!" }));

1561+

expectBlockReplyText(onBlockReply, "hello world!");

15511562

});

1552156315531564

it("routes followups with originating account/thread metadata", async () => {

@@ -1562,14 +1573,11 @@ describe("createFollowupRunner messaging delivery and dedupe", () => {

15621573

} as FollowupRun,

15631574

});

156415751565-

expect(routeReplyMock).toHaveBeenCalledWith(

1566-

expect.objectContaining({

1567-

channel: "discord",

1568-

to: "channel:C1",

1569-

accountId: "work",

1570-

threadId: "1739142736.000100",

1571-

}),

1572-

);

1576+

const routeArg = requireMockCallArg(routeReplyMock, 0);

1577+

expect(routeArg.channel).toBe("discord");

1578+

expect(routeArg.to).toBe("channel:C1");

1579+

expect(routeArg.accountId).toBe("work");

1580+

expect(routeArg.threadId).toBe("1739142736.000100");

15731581

expect(onBlockReply).not.toHaveBeenCalled();

15741582

});

15751583

});