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

推荐订阅源

S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
博客园 - 【当耐特】
月光博客
月光博客
Vercel News
Vercel News
D
Docker
I
InfoQ
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
有赞技术团队
有赞技术团队
雷峰网
雷峰网
博客园 - 聂微东
小众软件
小众软件
Y
Y Combinator Blog
腾讯CDC
L
LangChain Blog
The GitHub Blog
The GitHub Blog
宝玉的分享
宝玉的分享
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
T
The Blog of Author Tim Ferriss

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
[Fix] Throttle agent event fanout (#80335) · openclaw/ope...
samzong · 2026-05-14 · via Recent Commits to openclaw:main

@@ -1,5 +1,6 @@

11

import fs from "node:fs";

22

import { describe, expect, it, vi } from "vitest";

3+

import { repairToolUseResultPairing } from "../../agents/session-transcript-repair.js";

34

import * as transcriptEvents from "../../sessions/transcript-events.js";

45

import type { SessionTranscriptUpdate } from "../../sessions/transcript-events.js";

56

import { resolveSessionTranscriptPathInDir } from "./paths.js";

@@ -18,6 +19,7 @@ describe("appendAssistantMessageToSessionTranscript", () => {

1819

type ExactAssistantMessage = Parameters<

1920

typeof appendExactAssistantMessageToSessionTranscript

2021

>[0]["message"];

22+

type TranscriptRepairMessage = Parameters<typeof repairToolUseResultPairing>[0][number];

2123

type TranscriptUpdateEmitterSpy = {

2224

mock: {

2325

calls: [string | SessionTranscriptUpdate][];

@@ -283,6 +285,78 @@ describe("appendAssistantMessageToSessionTranscript", () => {

283285

}

284286

});

285287288+

it("keeps delivery mirrors in transcripts while repair preserves real tool results", async () => {

289+

writeTranscriptStore();

290+

const sessionFile = resolveSessionTranscriptPathInDir(sessionId, fixture.sessionsDir());

291+

const toolCallId = "call_maniple_list";

292+293+

const toolCallResult = await appendSessionTranscriptMessage({

294+

transcriptPath: sessionFile,

295+

message: {

296+

role: "assistant",

297+

content: [

298+

{

299+

type: "toolCall",

300+

id: toolCallId,

301+

name: "maniple__list_workers",

302+

arguments: {},

303+

},

304+

],

305+

stopReason: "toolUse",

306+

},

307+

});

308+309+

const mirrorResult = await appendAssistantMessageToSessionTranscript({

310+

sessionKey,

311+

text: "Maniple List Workers",

312+

storePath: fixture.storePath(),

313+

});

314+315+

expect(mirrorResult.ok).toBe(true);

316+

if (!mirrorResult.ok) {

317+

return;

318+

}

319+

expect(mirrorResult.messageId).not.toBe(toolCallResult.messageId);

320+

const linesAfterMirror = fs.readFileSync(sessionFile, "utf-8").trim().split("\n");

321+

expect(linesAfterMirror).toHaveLength(3);

322+

const mirrorLine = JSON.parse(linesAfterMirror[2]);

323+

expect(mirrorLine.message.model).toBe("delivery-mirror");

324+325+

await appendSessionTranscriptMessage({

326+

transcriptPath: sessionFile,

327+

message: {

328+

role: "toolResult",

329+

toolCallId,

330+

toolName: "maniple__list_workers",

331+

content: [{ type: "text", text: "workers listed" }],

332+

isError: false,

333+

},

334+

});

335+336+

const messages = fs

337+

.readFileSync(sessionFile, "utf-8")

338+

.trim()

339+

.split("\n")

340+

.map((line) => JSON.parse(line) as { message?: TranscriptRepairMessage })

341+

.flatMap((entry) => (entry.message ? [entry.message] : []));

342+

expect(messages.map((message) => message.role)).toEqual([

343+

"assistant",

344+

"assistant",

345+

"toolResult",

346+

]);

347+

const repair = repairToolUseResultPairing(messages, {

348+

missingToolResultText: "aborted",

349+

});

350+351+

expect(repair.added).toHaveLength(0);

352+

expect(repair.messages.map((message) => message.role)).toEqual([

353+

"assistant",

354+

"toolResult",

355+

"assistant",

356+

]);

357+

expect((repair.messages[2] as { model?: string }).model).toBe("delivery-mirror");

358+

});

359+286360

it("finds session entry using normalized (lowercased) key", async () => {

287361

const storeKey = "agent:main:imessage:direct:+15551234567";

288362

const store = {