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

推荐订阅源

人人都是产品经理
人人都是产品经理
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
雷峰网
雷峰网
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
MongoDB | Blog
MongoDB | Blog
V
V2EX
博客园 - 【当耐特】
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
Martin Fowler
Martin Fowler
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
B
Blog
V
Visual Studio Blog
D
DataBreaches.Net
C
Check Point Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
F
Fortinet All Blogs

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 thread binding assertions · openclaw...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -135,6 +135,18 @@ describe("matrix thread bindings", () => {

135135

return parsed.bindings?.[0]?.lastActivityAt;

136136

}

137137138+

async function readPersistedBindings(bindingsPath: string) {

139+

const raw = await fs.readFile(bindingsPath, "utf-8");

140+

return JSON.parse(raw) as {

141+

version?: number;

142+

bindings?: Array<{

143+

conversationId?: string;

144+

parentConversationId?: string;

145+

targetSessionKey?: string;

146+

}>;

147+

};

148+

}

149+138150

async function expectPersistedThreadBinding(

139151

bindingsPath: string,

140152

expected: {

@@ -143,17 +155,22 @@ describe("matrix thread bindings", () => {

143155

parentConversationId?: string;

144156

},

145157

) {

146-

const persistedRaw = await fs.readFile(bindingsPath, "utf-8");

147-

expect(JSON.parse(persistedRaw)).toMatchObject({

148-

version: 1,

149-

bindings: [

150-

expect.objectContaining({

151-

conversationId: expected.conversationId,

152-

parentConversationId: expected.parentConversationId ?? "!room:example",

153-

targetSessionKey: expected.targetSessionKey,

154-

}),

155-

],

156-

});

158+

const persisted = await readPersistedBindings(bindingsPath);

159+

expect(persisted.version).toBe(1);

160+

expect(persisted.bindings).toHaveLength(1);

161+

expect(persisted.bindings?.[0]?.conversationId).toBe(expected.conversationId);

162+

expect(persisted.bindings?.[0]?.parentConversationId).toBe(

163+

expected.parentConversationId ?? "!room:example",

164+

);

165+

expect(persisted.bindings?.[0]?.targetSessionKey).toBe(expected.targetSessionKey);

166+

}

167+168+

function latestSendMessageCall() {

169+

const call = sendMessageMatrixMock.mock.calls.at(-1);

170+

if (!call) {

171+

throw new Error("expected sendMessageMatrix call");

172+

}

173+

return call;

157174

}

158175159176

beforeEach(() => {

@@ -222,17 +239,14 @@ describe("matrix thread bindings", () => {

222239

accountId: "ops",

223240

threadId: "$thread",

224241

});

225-

expect(

226-

getSessionBindingService().resolveByConversation({

227-

channel: "matrix",

228-

accountId: "ops",

229-

conversationId: "$thread",

230-

parentConversationId: "!room:example",

231-

}),

232-

).toMatchObject({

233-

bindingId: binding.bindingId,

234-

targetSessionKey: "agent:ops:subagent:child",

242+

const resolved = getSessionBindingService().resolveByConversation({

243+

channel: "matrix",

244+

accountId: "ops",

245+

conversationId: "$thread",

246+

parentConversationId: "!room:example",

235247

});

248+

expect(resolved?.bindingId).toBe(binding.bindingId);

249+

expect(resolved?.targetSessionKey).toBe("agent:ops:subagent:child");

236250

});

237251238252

it("expires idle bindings via the sweeper", async () => {

@@ -328,11 +342,9 @@ describe("matrix thread bindings", () => {

328342329343

await vi.waitFor(

330344

async () => {

331-

const persistedRaw = await fs.readFile(resolveBindingsFilePath(), "utf-8");

332-

expect(JSON.parse(persistedRaw)).toMatchObject({

333-

version: 1,

334-

bindings: [],

335-

});

345+

const persisted = await readPersistedBindings(resolveBindingsFilePath());

346+

expect(persisted.version).toBe(1);

347+

expect(persisted.bindings).toEqual([]);

336348

},

337349

{ interval: 1, timeout: 100 },

338350

);

@@ -380,8 +392,12 @@ describe("matrix thread bindings", () => {

380392

message.includes("failed auto-unbinding expired bindings"),

381393

),

382394

).toBe(true);

383-

expect(logVerboseMessage).toHaveBeenCalledWith(

384-

expect.stringContaining("matrix: auto-unbinding $thread due to idle-expired"),

395+

expect(

396+

logVerboseMessage.mock.calls.some(

397+

([message]) =>

398+

typeof message === "string" &&

399+

message.includes("matrix: auto-unbinding $thread due to idle-expired"),

400+

),

385401

);

386402

},

387403

{ interval: 1, timeout: 100 },

@@ -432,15 +448,13 @@ describe("matrix thread bindings", () => {

432448

reason: "idle-expired",

433449

});

434450435-

expect(sendMessageMatrixMock).toHaveBeenCalledWith(

436-

"room:!room:example",

437-

expect.stringContaining("Session ended automatically"),

438-

expect.objectContaining({

439-

cfg: {},

440-

accountId: "ops",

441-

threadId: "$thread",

442-

}),

443-

);

451+

const [to, message, options] = latestSendMessageCall();

452+

const sendOptions = options as { cfg?: unknown; accountId?: string; threadId?: string };

453+

expect(to).toBe("room:!room:example");

454+

expect(message).toContain("Session ended automatically");

455+

expect(sendOptions.cfg).toEqual({});

456+

expect(sendOptions.accountId).toBe("ops");

457+

expect(sendOptions.threadId).toBe("$thread");

444458

});

445459446460

it("does not reload persisted bindings after the Matrix access token changes while deviceId is unknown", async () => {

@@ -524,10 +538,8 @@ describe("matrix thread bindings", () => {

524538

accountId: "ops",

525539

conversationId: "$thread",

526540

parentConversationId: "!room:example",

527-

}),

528-

).toMatchObject({

529-

targetSessionKey: "agent:ops:subagent:child",

530-

});

541+

})?.targetSessionKey,

542+

).toBe("agent:ops:subagent:child");

531543532544

const rotatedBindingsPath = path.join(

533545

resolveMatrixStoragePaths({