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

推荐订阅源

GbyAI
GbyAI
WordPress大学
WordPress大学
D
DataBreaches.Net
腾讯CDC
小众软件
小众软件
B
Blog RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Blog of Author Tim Ferriss
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Y
Y Combinator Blog
V
V2EX
I
InfoQ
D
Docker
量子位
N
Netflix TechBlog - Medium
Recent Announcements
Recent Announcements
A
About on SuperTechFans
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
B
Blog
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog

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 matrix group history assertions · openclaw/...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -140,6 +140,20 @@ function createFinalDeliveryFailureHandler(finalizeInboundContext: (ctx: unknown

140140

});

141141

}

142142143+

function inboundHistoryBodies(finalizeInboundContext: ReturnType<typeof vi.fn>, callIndex: number) {

144+

const ctx = finalizeInboundContext.mock.calls[callIndex]?.[0] as Record<string, unknown>;

145+

const history = ctx["InboundHistory"] as Array<{ body: string }> | undefined;

146+

return history?.map((entry) => entry.body) ?? [];

147+

}

148+149+

function expectSomeBodyContaining(bodies: readonly string[], fragment: string) {

150+

expect(bodies.some((body) => body.includes(fragment))).toBe(true);

151+

}

152+153+

function expectNoBodyContaining(bodies: readonly string[], fragment: string) {

154+

expect(bodies.some((body) => body.includes(fragment))).toBe(false);

155+

}

156+143157

describe("matrix group chat history — scenario 1: basic accumulation", () => {

144158

it("pending messages appear in InboundHistory; trigger itself does not", async () => {

145159

const finalizeInboundContext = vi.fn((ctx: unknown) => ctx);

@@ -199,15 +213,10 @@ describe("matrix group chat history — scenario 1: basic accumulation", () => {

199213

currentAgentId = "agent_b";

200214

await handler(DEFAULT_ROOM, makeRoomTriggerEvent({ eventId: "$c", body: "msg C", ts: 3000 }));

201215

{

202-

const ctx = finalizeInboundContext.mock.calls[1]?.[0] as Record<string, unknown>;

203-

const history = ctx["InboundHistory"] as Array<{ body: string }>;

204-

expect(history).toHaveLength(2);

205-

expect(history.map((h) => h.body)).toEqual(

206-

expect.arrayContaining([expect.stringContaining("msg A")]),

207-

);

208-

expect(history.map((h) => h.body)).toEqual(

209-

expect.arrayContaining([expect.stringContaining("msg B")]),

210-

);

216+

const bodies = inboundHistoryBodies(finalizeInboundContext, 1);

217+

expect(bodies).toHaveLength(2);

218+

expectSomeBodyContaining(bodies, "msg A");

219+

expectSomeBodyContaining(bodies, "msg B");

211220

}

212221213222

// @agent_b trigger D — A/B/C consumed; history is empty

@@ -398,10 +407,9 @@ describe("matrix group chat history — scenario 1: basic accumulation", () => {

398407

makeRoomTriggerEvent({ eventId: "$trigger-media", body: "trigger", ts: 2000 }),

399408

);

400409

expect(finalizeInboundContext).toHaveBeenCalledOnce();

401-

const ctx = finalizeInboundContext.mock.calls[0]?.[0] as Record<string, unknown>;

402-

const history = ctx["InboundHistory"] as Array<{ body: string }> | undefined;

403-

expect(history?.map((entry) => entry.body)).toEqual(

404-

expect.arrayContaining([expect.stringContaining("[matrix image attachment]")]),

410+

expectSomeBodyContaining(

411+

inboundHistoryBodies(finalizeInboundContext, 0),

412+

"[matrix image attachment]",

405413

);

406414

});

407415

@@ -465,11 +473,7 @@ describe("matrix group chat history — scenario 1: basic accumulation", () => {

465473466474

expect(getEvent).toHaveBeenCalledOnce();

467475

expect(getRelations).toHaveBeenCalledOnce();

468-

const ctx = finalizeInboundContext.mock.calls[0]?.[0] as Record<string, unknown>;

469-

const history = ctx["InboundHistory"] as Array<{ body: string }> | undefined;

470-

expect(history?.map((entry) => entry.body)).toEqual(

471-

expect.arrayContaining([expect.stringContaining("Lunch?")]),

472-

);

476+

expectSomeBodyContaining(inboundHistoryBodies(finalizeInboundContext, 0), "Lunch?");

473477

});

474478

});

475479

@@ -520,14 +524,9 @@ describe("matrix group chat history — scenario 2: race condition safety", () =

520524

await handler(DEFAULT_ROOM, makeRoomTriggerEvent({ eventId: "$c", body: "msg C", ts: 3000 }));

521525522526

expect(finalizeInboundContext).toHaveBeenCalledTimes(2);

523-

const ctxForC = finalizeInboundContext.mock.calls[1]?.[0] as Record<string, unknown>;

524-

const history = ctxForC["InboundHistory"] as Array<{ body: string }>;

525-

expect(history.map((h) => h.body)).toEqual(

526-

expect.arrayContaining([expect.stringContaining("msg B")]),

527-

);

528-

expect(history.map((h) => h.body)).not.toEqual(

529-

expect.arrayContaining([expect.stringContaining("msg A")]),

530-

);

527+

const bodies = inboundHistoryBodies(finalizeInboundContext, 1);

528+

expectSomeBodyContaining(bodies, "msg B");

529+

expectNoBodyContaining(bodies, "msg A");

531530

});

532531533532

it("watermark does not advance when final reply delivery fails (retry sees same history)", async () => {

@@ -559,11 +558,7 @@ describe("matrix group chat history — scenario 2: race condition safety", () =

559558

);

560559

expect(finalizeInboundContext).toHaveBeenCalledTimes(2);

561560

{

562-

const ctx = finalizeInboundContext.mock.calls[1]?.[0] as Record<string, unknown>;

563-

const history = ctx["InboundHistory"] as Array<{ body: string }> | undefined;

564-

expect(history?.map((h) => h.body)).toEqual(

565-

expect.arrayContaining([expect.stringContaining("pending msg")]),

566-

);

561+

expectSomeBodyContaining(inboundHistoryBodies(finalizeInboundContext, 1), "pending msg");

567562

}

568563

});

569564

@@ -639,10 +634,9 @@ describe("matrix group chat history — scenario 2: race condition safety", () =

639634

resolveFirstName?.();

640635

await triggerDone;

641636642-

const ctx = finalizeInboundContext.mock.calls[0]?.[0] as Record<string, unknown>;

643-

const history = ctx["InboundHistory"] as Array<{ body: string }> | undefined;

644-

expect(history?.map((entry) => entry.body)).toEqual(

645-

expect.arrayContaining([expect.stringContaining("plain before trigger")]),

637+

expectSomeBodyContaining(

638+

inboundHistoryBodies(finalizeInboundContext, 0),

639+

"plain before trigger",

646640

);

647641

});

648642