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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
Recent Announcements
Recent Announcements
Vercel News
Vercel News
M
MIT News - Artificial intelligence
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
H
Help Net Security
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
G
Google Developers Blog
罗磊的独立博客
爱范儿
爱范儿
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
月光博客
月光博客
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research

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 chat abort persistence assertions · opencla...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -89,6 +89,49 @@ function findMessageWithIdempotencyKey(

8989

return undefined;

9090

}

919192+

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

93+

expect(typeof value).toBe("object");

94+

expect(value, label).not.toBeNull();

95+

return value as Record<string, unknown>;

96+

}

97+98+

function expectAbortPayload(payload: unknown, expected?: { runIds?: string[] }) {

99+

const actual = expectRecord(payload, "abort payload");

100+

expect(actual.aborted).toBe(true);

101+

if (expected?.runIds) {

102+

expect(actual.runIds).toEqual(expected.runIds);

103+

}

104+

return actual;

105+

}

106+107+

function expectAbortPayloadContainsRunIds(payload: unknown, runIds: string[]) {

108+

const actual = expectAbortPayload(payload);

109+

expect(Array.isArray(actual.runIds)).toBe(true);

110+

for (const runId of runIds) {

111+

expect(actual.runIds as unknown[]).toContain(runId);

112+

}

113+

}

114+115+

function expectPersistedAbortMessage(

116+

message: unknown,

117+

expected: {

118+

idempotencyKey: string;

119+

origin: string;

120+

runId: string;

121+

stopReason?: string;

122+

},

123+

) {

124+

const actual = expectRecord(message, "persisted abort message");

125+

expect(actual.idempotencyKey).toBe(expected.idempotencyKey);

126+

if (expected.stopReason) {

127+

expect(actual.stopReason).toBe(expected.stopReason);

128+

}

129+

const abort = expectRecord(actual.openclawAbort, "persisted abort metadata");

130+

expect(abort.aborted).toBe(true);

131+

expect(abort.origin).toBe(expected.origin);

132+

expect(abort.runId).toBe(expected.runId);

133+

}

134+92135

function setMockSessionEntry(transcriptPath: string, sessionId: string) {

93136

sessionEntryState.transcriptPath = transcriptPath;

94137

sessionEntryState.sessionId = sessionId;

@@ -137,7 +180,7 @@ describe("chat abort transcript persistence", () => {

137180138181

const [ok1, payload1] = respond.mock.calls.at(-1) ?? [];

139182

expect(ok1).toBe(true);

140-

expect(payload1).toMatchObject({ aborted: true, runIds: [runId] });

183+

expectAbortPayload(payload1, { runIds: [runId] });

141184142185

context.chatAbortControllers.set(runId, createActiveRun("main", { sessionId }));

143186

context.chatRunBuffers.set(runId, "Partial from run abort");

@@ -154,14 +197,11 @@ describe("chat abort transcript persistence", () => {

154197

const persisted = collectMessagesWithIdempotencyKey(lines, `${runId}:assistant`);

155198156199

expect(persisted).toHaveLength(1);

157-

expect(persisted[0]).toMatchObject({

158-

stopReason: "stop",

200+

expectPersistedAbortMessage(persisted[0], {

159201

idempotencyKey: `${runId}:assistant`,

160-

openclawAbort: {

161-

aborted: true,

162-

origin: "rpc",

163-

runId,

164-

},

202+

origin: "rpc",

203+

runId,

204+

stopReason: "stop",

165205

});

166206

});

167207

@@ -194,20 +234,16 @@ describe("chat abort transcript persistence", () => {

194234195235

const [ok, payload] = respond.mock.calls.at(-1) ?? [];

196236

expect(ok).toBe(true);

197-

expect(payload).toMatchObject({ aborted: true });

198-

expect(payload.runIds).toEqual(expect.arrayContaining(["run-a", "run-b"]));

237+

expectAbortPayloadContainsRunIds(payload, ["run-a", "run-b"]);

199238200239

const lines = await readTranscriptLines(transcriptPath);

201240

const runAPersisted = findMessageWithIdempotencyKey(lines, "run-a:assistant");

202241

const runBPersisted = findMessageWithIdempotencyKey(lines, "run-b:assistant");

203242204-

expect(runAPersisted).toMatchObject({

243+

expectPersistedAbortMessage(runAPersisted, {

205244

idempotencyKey: "run-a:assistant",

206-

openclawAbort: {

207-

aborted: true,

208-

origin: "rpc",

209-

runId: "run-a",

210-

},

245+

origin: "rpc",

246+

runId: "run-a",

211247

});

212248

expect(runBPersisted).toBeUndefined();

213249

});

@@ -241,18 +277,15 @@ describe("chat abort transcript persistence", () => {

241277242278

const [ok, payload] = respond.mock.calls.at(-1) ?? [];

243279

expect(ok).toBe(true);

244-

expect(payload).toMatchObject({ aborted: true, runIds: ["run-stop-1"] });

280+

expectAbortPayload(payload, { runIds: ["run-stop-1"] });

245281246282

const lines = await readTranscriptLines(transcriptPath);

247283

const persisted = findMessageWithIdempotencyKey(lines, "run-stop-1:assistant");

248284249-

expect(persisted).toMatchObject({

285+

expectPersistedAbortMessage(persisted, {

250286

idempotencyKey: "run-stop-1:assistant",

251-

openclawAbort: {

252-

aborted: true,

253-

origin: "stop-command",

254-

runId: "run-stop-1",

255-

},

287+

origin: "stop-command",

288+

runId: "run-stop-1",

256289

});

257290

});

258291

@@ -277,7 +310,7 @@ describe("chat abort transcript persistence", () => {

277310278311

const [ok, payload] = respond.mock.calls.at(-1) ?? [];

279312

expect(ok).toBe(true);

280-

expect(payload).toMatchObject({ aborted: true, runIds: [runId] });

313+

expectAbortPayload(payload, { runIds: [runId] });

281314282315

const lines = await readTranscriptLines(transcriptPath);

283316

const persisted = findMessageWithIdempotencyKey(lines, `${runId}:assistant`);