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

推荐订阅源

腾讯CDC
The Cloudflare Blog
IT之家
IT之家
V
V2EX
雷峰网
雷峰网
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
小众软件
小众软件
博客园 - 叶小钗
Blog — PlanetScale
Blog — PlanetScale
C
Check Point Blog
A
About on SuperTechFans
B
Blog
月光博客
月光博客
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in 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 session history response assertions · openc...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -200,6 +200,26 @@ type SessionHistorySseStream = {

200200

streamState: { buffer: string };

201201

};

202202203+

function expectOpenClawMetadata(

204+

metadata: { id?: string; seq?: number } | undefined,

205+

expected: { id?: string; seq: number },

206+

) {

207+

if (expected.id !== undefined) {

208+

expect(metadata?.id).toBe(expected.id);

209+

}

210+

expect(metadata?.seq).toBe(expected.seq);

211+

}

212+213+

function expectErrorResponse(body: unknown, expected: { type: string; message: string }) {

214+

expect(body).toEqual({

215+

ok: false,

216+

error: {

217+

type: expected.type,

218+

message: expected.message,

219+

},

220+

});

221+

}

222+203223

async function openSessionHistorySse(

204224

port: number,

205225

sessionKey: string,

@@ -240,13 +260,14 @@ async function expectMessageEventMatch(

240260

).toBe(params.text);

241261

expect((event.data as { messageSeq?: number }).messageSeq).toBe(params.seq);

242262

if (params.id !== undefined) {

243-

expect(

263+

expectOpenClawMetadata(

244264

(event.data as { message?: { __openclaw?: { id?: string; seq?: number } } }).message

245265

?.__openclaw,

246-

).toMatchObject({

247-

id: params.id,

248-

seq: params.seq,

249-

});

266+

{

267+

id: params.id,

268+

seq: params.seq,

269+

},

270+

);

250271

}

251272

return event;

252273

}

@@ -282,15 +303,16 @@ describe("session history HTTP endpoints", () => {

282303

expect(body.sessionKey).toBe("agent:main:main");

283304

expect(body.messages).toHaveLength(1);

284305

expect(body.messages?.[0]?.content?.[0]?.text).toBe("hello from history");

285-

expect(

306+

expectOpenClawMetadata(

286307

(

287308

body.messages?.[0] as {

288309

__openclaw?: { id?: string; seq?: number };

289310

}

290311

)?.__openclaw,

291-

).toMatchObject({

292-

seq: 1,

293-

});

312+

{

313+

seq: 1,

314+

},

315+

);

294316

});

295317

});

296318

@@ -299,12 +321,9 @@ describe("session history HTTP endpoints", () => {

299321

await withGatewayHarness(async (harness) => {

300322

const res = await fetchSessionHistory(harness.port, "agent:main:missing");

301323

expect(res.status).toBe(404);

302-

await expect(res.json()).resolves.toMatchObject({

303-

ok: false,

304-

error: {

305-

type: "not_found",

306-

message: "Session not found: agent:main:missing",

307-

},

324+

expectErrorResponse(await res.json(), {

325+

type: "not_found",

326+

message: "Session not found: agent:main:missing",

308327

});

309328

});

310329

});

@@ -438,7 +457,7 @@ describe("session history HTTP endpoints", () => {

438457

}>;

439458

};

440459

expect(nextData.messages?.[0]?.content?.[0]?.text).toBe("third message");

441-

expect(nextData.messages?.[0]?.__openclaw).toMatchObject({

460+

expectOpenClawMetadata(nextData.messages?.[0]?.__openclaw, {

442461

id: thirdMessageId,

443462

seq: 3,

444463

});

@@ -528,7 +547,7 @@ describe("session history HTTP endpoints", () => {

528547

expect(body.sessionKey).toBe("agent:main:main");

529548

expect(body.messages).toHaveLength(1);

530549

expect(body.messages?.[0]?.content?.[0]?.text).toBe("Done.");

531-

expect(body.messages?.[0]?.__openclaw).toMatchObject({

550+

expectOpenClawMetadata(body.messages?.[0]?.__openclaw, {

532551

id: visibleMessageId,

533552

seq: 2,

534553

});

@@ -710,12 +729,9 @@ describe("session history HTTP endpoints", () => {

710729

},

711730

);

712731

expect(httpHistory.status).toBe(403);

713-

await expect(httpHistory.json()).resolves.toMatchObject({

714-

ok: false,

715-

error: {

716-

type: "forbidden",

717-

message: "missing scope: operator.read",

718-

},

732+

expectErrorResponse(await httpHistory.json(), {

733+

type: "forbidden",

734+

message: "missing scope: operator.read",

719735

});

720736721737

const httpHistoryWithoutScopes = await fetch(

@@ -725,12 +741,9 @@ describe("session history HTTP endpoints", () => {

725741

},

726742

);

727743

expect(httpHistoryWithoutScopes.status).toBe(403);

728-

await expect(httpHistoryWithoutScopes.json()).resolves.toMatchObject({

729-

ok: false,

730-

error: {

731-

type: "forbidden",

732-

message: "missing scope: operator.read",

733-

},

744+

expectErrorResponse(await httpHistoryWithoutScopes.json(), {

745+

type: "forbidden",

746+

message: "missing scope: operator.read",

734747

});

735748

} finally {

736749

ws.close();