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

推荐订阅源

L
LangChain Blog
V
V2EX
爱范儿
爱范儿
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
小众软件
小众软件
Vercel News
Vercel News
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
J
Java Code Geeks
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
B
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 inbound context assertions · opencla...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -10,6 +10,9 @@ import type { MatrixRawEvent } from "./types.js";

1010

describe("createMatrixRoomMessageHandler inbound body formatting", () => {

1111

type MatrixHandlerHarness = ReturnType<typeof createMatrixHandlerTestHarness>;

1212

type FinalizedReplyContext = {

13+

MessageThreadId?: string;

14+

RawBody?: string;

15+

ReplyToId?: string;

1316

ReplyToBody?: string;

1417

ReplyToSender?: string;

1518

ThreadStarterBody?: string;

@@ -64,6 +67,13 @@ describe("createMatrixRoomMessageHandler inbound body formatting", () => {

6467

return vi.mocked(finalizeInboundContext).mock.calls.at(-1)?.[0] as FinalizedReplyContext;

6568

}

666970+

function latestSessionKey(recordInboundSession: MatrixHandlerHarness["recordInboundSession"]) {

71+

const context = vi.mocked(recordInboundSession).mock.calls.at(-1)?.[0] as

72+

| { sessionKey?: string }

73+

| undefined;

74+

return context?.sessionKey;

75+

}

76+6777

beforeEach(() => {

6878

installMatrixMonitorTestRuntime({

6979

matchesMentionPatterns: () => false,

@@ -101,18 +111,13 @@ describe("createMatrixRoomMessageHandler inbound body formatting", () => {

101111

}),

102112

);

103113104-

expect(finalizeInboundContext).toHaveBeenCalledWith(

105-

expect.objectContaining({

106-

MessageThreadId: "$thread-root",

107-

ThreadStarterBody: "Matrix thread root $thread-root from Alice:\nRoot topic",

108-

}),

114+

const finalized = latestFinalizedReplyContext(finalizeInboundContext);

115+

expect(finalized.MessageThreadId).toBe("$thread-root");

116+

expect(finalized.ThreadStarterBody).toBe(

117+

"Matrix thread root $thread-root from Alice:\nRoot topic",

109118

);

110119

// Thread messages get thread-scoped session keys (thread isolation feature).

111-

expect(recordInboundSession).toHaveBeenCalledWith(

112-

expect.objectContaining({

113-

sessionKey: "agent:ops:main:thread:$thread-root",

114-

}),

115-

);

120+

expect(latestSessionKey(recordInboundSession)).toBe("agent:ops:main:thread:$thread-root");

116121

});

117122118123

it("starts the thread-scoped session from the triggering message when threadReplies is always", async () => {

@@ -131,17 +136,10 @@ describe("createMatrixRoomMessageHandler inbound body formatting", () => {

131136

}),

132137

);

133138134-

expect(finalizeInboundContext).toHaveBeenCalledWith(

135-

expect.objectContaining({

136-

MessageThreadId: "$thread-root",

137-

ReplyToId: undefined,

138-

}),

139-

);

140-

expect(recordInboundSession).toHaveBeenCalledWith(

141-

expect.objectContaining({

142-

sessionKey: "agent:ops:main:thread:$thread-root",

143-

}),

144-

);

139+

const finalized = latestFinalizedReplyContext(finalizeInboundContext);

140+

expect(finalized.MessageThreadId).toBe("$thread-root");

141+

expect(finalized.ReplyToId).toBeUndefined();

142+

expect(latestSessionKey(recordInboundSession)).toBe("agent:ops:main:thread:$thread-root");

145143

});

146144147145

it("records formatted poll results for inbound poll response events", async () => {

@@ -198,16 +196,10 @@ describe("createMatrixRoomMessageHandler inbound body formatting", () => {

198196

},

199197

} as MatrixRawEvent);

200198201-

expect(finalizeInboundContext).toHaveBeenCalledWith(

202-

expect.objectContaining({

203-

RawBody: expect.stringMatching(/1\. Pizza \(1 vote\)[\s\S]*Total voters: 1/),

204-

}),

205-

);

206-

expect(recordInboundSession).toHaveBeenCalledWith(

207-

expect.objectContaining({

208-

sessionKey: "agent:ops:main",

209-

}),

210-

);

199+

const finalized = latestFinalizedReplyContext(finalizeInboundContext);

200+

expect(finalized.RawBody).toContain("1. Pizza (1 vote)");

201+

expect(finalized.RawBody).toContain("Total voters: 1");

202+

expect(latestSessionKey(recordInboundSession)).toBe("agent:ops:main");

211203

});

212204213205

it("records reply context for quoted poll start events inside always-threaded replies", async () => {

@@ -268,14 +260,13 @@ describe("createMatrixRoomMessageHandler inbound body formatting", () => {

268260

}),

269261

);

270262271-

expect(finalizeInboundContext).toHaveBeenCalledWith(

272-

expect.objectContaining({

273-

MessageThreadId: "$thread-root",

274-

ReplyToId: undefined,

275-

ReplyToSender: "Alice",

276-

ReplyToBody: "[Poll]\nLunch?\n\n1. Pizza\n2. Sushi",

277-

ThreadStarterBody: "Matrix thread root $thread-root from Bob:\nRoot topic",

278-

}),

263+

const finalized = latestFinalizedReplyContext(finalizeInboundContext);

264+

expect(finalized.MessageThreadId).toBe("$thread-root");

265+

expect(finalized.ReplyToId).toBeUndefined();

266+

expect(finalized.ReplyToSender).toBe("Alice");

267+

expect(finalized.ReplyToBody).toBe("[Poll]\nLunch?\n\n1. Pizza\n2. Sushi");

268+

expect(finalized.ThreadStarterBody).toBe(

269+

"Matrix thread root $thread-root from Bob:\nRoot topic",

279270

);

280271

});

281272

@@ -311,14 +302,13 @@ describe("createMatrixRoomMessageHandler inbound body formatting", () => {

311302

}),

312303

);

313304314-

expect(finalizeInboundContext).toHaveBeenCalledWith(

315-

expect.objectContaining({

316-

MessageThreadId: "$thread-root",

317-

ReplyToId: undefined,

318-

ReplyToSender: "Alice",

319-

ReplyToBody: "Root topic",

320-

ThreadStarterBody: "Matrix thread root $thread-root from Alice:\nRoot topic",

321-

}),

305+

const finalized = latestFinalizedReplyContext(finalizeInboundContext);

306+

expect(finalized.MessageThreadId).toBe("$thread-root");

307+

expect(finalized.ReplyToId).toBeUndefined();

308+

expect(finalized.ReplyToSender).toBe("Alice");

309+

expect(finalized.ReplyToBody).toBe("Root topic");

310+

expect(finalized.ThreadStarterBody).toBe(

311+

"Matrix thread root $thread-root from Alice:\nRoot topic",

322312

);

323313

expect(getEvent).toHaveBeenCalledTimes(1);

324314

expect(getMemberDisplayName).toHaveBeenCalledTimes(2);