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

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页
雷峰网
雷峰网
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
腾讯CDC
T
Tailwind CSS Blog
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
The Cloudflare Blog
D
DataBreaches.Net
Recent Announcements
Recent Announcements
Engineering at Meta
Engineering at Meta
B
Blog
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
博客园 - 司徒正美
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
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
fix: strip delivery function response leaks · openclaw/op...
steipete · 2026-05-16 · via Recent Commits to openclaw:main

@@ -245,6 +245,25 @@ function findMatchingToolCallCloseIndex(text: string, start: number, tagName: st

245245

return -1;

246246

}

247247248+

function findAdjacentOpeningToolCallTag(

249+

text: string,

250+

start: number,

251+

tagName: string,

252+

): ParsedToolCallTag | null {

253+

let idx = start;

254+

while (idx < text.length && /\s/.test(text[idx])) {

255+

idx += 1;

256+

}

257+

if (text[idx] !== "<") {

258+

return null;

259+

}

260+

const tag = parseToolCallTagAt(text, idx);

261+

if (!tag || tag.isClose || tag.tagName !== tagName) {

262+

return null;

263+

}

264+

return tag;

265+

}

266+248267

function parseToolCallTagAt(text: string, start: number): ParsedToolCallTag | null {

249268

if (text[start] !== "<") {

250269

return null;

@@ -299,7 +318,10 @@ function parseToolCallTagAt(text: string, start: number): ParsedToolCallTag | nu

299318300319

export function stripToolCallXmlTags(

301320

text: string,

302-

options: { stripFunctionCallsXmlPayloads?: boolean } = {},

321+

options: {

322+

stripFunctionCallsXmlPayloads?: boolean;

323+

stripFunctionResponseAfterPluralToolCalls?: boolean;

324+

} = {},

303325

): string {

304326

if (!text || !TOOL_CALL_QUICK_RE.test(text)) {

305327

return text;

@@ -355,11 +377,24 @@ export function stripToolCallXmlTags(

355377

continue;

356378

}

357379

const payloadStart = tag.isTruncated ? tag.contentStart : tag.end;

380+

const isPluralToolCallWrapper =

381+

tag.tagName === "function_calls" || tag.tagName === "tool_calls";

382+

const matchingCloseStart = isPluralToolCallWrapper

383+

? findMatchingToolCallCloseIndex(text, tag.end, tag.tagName)

384+

: -1;

385+

const matchingCloseTag =

386+

matchingCloseStart === -1 ? null : parseToolCallTagAt(text, matchingCloseStart);

387+

const shouldStripPluralWrapperBeforeResponse =

388+

options.stripFunctionResponseAfterPluralToolCalls === true &&

389+

isPluralToolCallWrapper &&

390+

matchingCloseTag !== null &&

391+

findAdjacentOpeningToolCallTag(text, matchingCloseTag.end, "function_response") !== null;

358392

const shouldDetectXmlPayload =

359393

tag.tagName === "tool_call" ||

360394

tag.tagName === "function" ||

361-

(options.stripFunctionCallsXmlPayloads === true &&

362-

(tag.tagName === "function_calls" || tag.tagName === "tool_calls"));

395+

((options.stripFunctionCallsXmlPayloads === true ||

396+

shouldStripPluralWrapperBeforeResponse) &&

397+

isPluralToolCallWrapper);

363398

const payloadKind = shouldDetectXmlPayload

364399

? detectToolCallPayloadKind(text, payloadStart)

365400

: TOOL_CALL_JSON_PAYLOAD_START_RE.test(text.slice(payloadStart))

@@ -732,6 +767,7 @@ type AssistantVisibleTextPipelineOptions = {

732767

preserveDowngradedToolText?: boolean;

733768

preserveMinimaxToolXml?: boolean;

734769

stripFunctionCallsXmlPayloads?: boolean;

770+

stripFunctionResponseAfterPluralToolCalls?: boolean;

735771

reasoningMode: ReasoningTagMode;

736772

reasoningTrim: ReasoningTagTrim;

737773

stageOrder: "reasoning-first" | "reasoning-last";

@@ -743,6 +779,7 @@ const ASSISTANT_VISIBLE_TEXT_PIPELINE_OPTIONS: Record<

743779

> = {

744780

delivery: {

745781

finalTrim: "both",

782+

stripFunctionResponseAfterPluralToolCalls: true,

746783

reasoningMode: "strict",

747784

reasoningTrim: "both",

748785

stageOrder: "reasoning-last",

@@ -794,6 +831,7 @@ function applyAssistantVisibleTextStagePipeline(

794831

cleaned = stripRelevantMemoriesTags(cleaned);

795832

cleaned = stripToolCallXmlTags(cleaned, {

796833

stripFunctionCallsXmlPayloads: options.stripFunctionCallsXmlPayloads,

834+

stripFunctionResponseAfterPluralToolCalls: options.stripFunctionResponseAfterPluralToolCalls,

797835

});

798836

cleaned = stripLegacyBracketToolCallBlocks(cleaned);

799837

cleaned = stripPlainTextToolCallBlocks(cleaned);