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

推荐订阅源

B
Blog
Microsoft Security Blog
Microsoft Security Blog
Jina AI
Jina AI
博客园 - 叶小钗
J
Java Code Geeks
博客园 - 聂微东
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
美团技术团队
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
罗磊的独立博客
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
T
Tailwind CSS Blog
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
小众软件
小众软件

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(ui): pair sequential tool results by fallback order ·...
chinar-amrut · 2026-05-31 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -238,24 +238,35 @@ export function formatCollapsedToolPreviewText(value: string | undefined): strin

238238

return normalized.slice(0, 120);

239239

}

240240
241-

function findLatestCard(cards: ToolCard[], id: string, name: string): ToolCard | undefined {

242-

for (let i = cards.length - 1; i >= 0; i--) {

243-

const card = cards[i];

244-

if (!card) {

245-

continue;

246-

}

247-

if (card.id === id || (card.name === name && !card.outputText)) {

241+

function findFirstUnmatchedCard(

242+

cards: ToolCard[],

243+

id: string,

244+

name: string,

245+

fallbackMatchedCards: WeakSet<ToolCard>,

246+

): ToolCard | undefined {

247+

let nameOnlyCandidate: ToolCard | undefined;

248+

for (const card of cards) {

249+

if (card.id === id) {

248250

return card;

249251

}

252+

if (

253+

!nameOnlyCandidate &&

254+

card.name === name &&

255+

card.outputText === undefined &&

256+

!fallbackMatchedCards.has(card)

257+

) {

258+

nameOnlyCandidate = card;

259+

}

250260

}

251-

return undefined;

261+

return nameOnlyCandidate;

252262

}

253263
254264

export function extractToolCards(message: unknown, prefix = "tool"): ToolCard[] {

255265

const m = message as Record<string, unknown>;

256266

const content = normalizeContent(m.content);

257267

const messageIsError = readToolErrorFlag(m);

258268

const cards: ToolCard[] = [];

269+

const fallbackMatchedCards = new WeakSet<ToolCard>();

259270

const transcriptMessageId = resolveTranscriptMessageId(m);

260271
261272

for (let index = 0; index < content.length; index++) {

@@ -280,11 +291,12 @@ export function extractToolCards(message: unknown, prefix = "tool"): ToolCard[]

280291

if (kind === "toolresult" || kind === "tool_result") {

281292

const name = typeof item.name === "string" ? item.name : "tool";

282293

const cardId = resolveToolCardId(item, m, index, prefix);

283-

const existing = findLatestCard(cards, cardId, name);

294+

const existing = findFirstUnmatchedCard(cards, cardId, name, fallbackMatchedCards);

284295

const text = extractToolText(item);

285296

const preview = extractToolPreview(text, name);

286297

const isError = readToolErrorFlag(item) ?? messageIsError;

287298

if (existing) {

299+

fallbackMatchedCards.add(existing);

288300

existing.outputText = text;

289301

existing.preview = preview;

290302

if (isError !== undefined) {