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

推荐订阅源

博客园_首页
H
Help Net Security
量子位
The Cloudflare Blog
博客园 - Franky
博客园 - 聂微东
博客园 - 司徒正美
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
罗磊的独立博客
GbyAI
GbyAI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
MongoDB | Blog
MongoDB | Blog

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(agents): drop metadata-only replay turns · openclaw/o...
steipete · 2026-04-30 · via Recent Commits to openclaw:main

@@ -234,7 +234,6 @@ function stripStaleAssistantUsageBeforeLatestCompaction(messages: AgentMessage[]

234234

// content and, on Bedrock or strict OpenAI-compatible providers, can also

235235

// trigger turn-ordering rejections.

236236

const TRANSCRIPT_ONLY_OPENCLAW_MODELS = new Set<string>(["delivery-mirror", "gateway-injected"]);

237-

const OMITTED_INBOUND_METADATA_TEXT = "[assistant copied inbound metadata omitted]";

238237239238

function sanitizeUserReplayContent(message: AgentMessage): AgentMessage | null {

240239

if (!message || message.role !== "user") {

@@ -282,6 +281,49 @@ function isTranscriptOnlyOpenclawAssistant(message: AgentMessage): boolean {

282281

);

283282

}

284283284+

function normalizeAssistantReplayTextContent(message: AgentMessage, replayContent: string) {

285+

const strippedText = stripInboundMetadata(replayContent);

286+

if (!strippedText.trim()) {

287+

return null;

288+

}

289+

return {

290+

...message,

291+

content: [{ type: "text", text: strippedText }],

292+

} as AgentMessage;

293+

}

294+295+

function normalizeAssistantReplayBlockContent(message: AgentMessage, replayContent: unknown[]) {

296+

let touched = false;

297+

const sanitizedContent: unknown[] = [];

298+

for (const block of replayContent) {

299+

if (!block || typeof block !== "object") {

300+

sanitizedContent.push(block);

301+

continue;

302+

}

303+

const text = (block as { text?: unknown }).text;

304+

if (typeof text !== "string") {

305+

sanitizedContent.push(block);

306+

continue;

307+

}

308+

const strippedText = stripInboundMetadata(text);

309+

if (strippedText === text) {

310+

sanitizedContent.push(block);

311+

continue;

312+

}

313+

touched = true;

314+

if (strippedText.trim()) {

315+

sanitizedContent.push({ ...block, text: strippedText });

316+

}

317+

}

318+

if (!touched) {

319+

return message;

320+

}

321+

if (sanitizedContent.length === 0) {

322+

return null;

323+

}

324+

return { ...message, content: sanitizedContent } as AgentMessage;

325+

}

326+285327

export function normalizeAssistantReplayContent(messages: AgentMessage[]): AgentMessage[] {

286328

let touched = false;

287329

const out: AgentMessage[] = [];

@@ -308,44 +350,19 @@ export function normalizeAssistantReplayContent(messages: AgentMessage[]): Agent

308350

}

309351

const replayContent = (message as { content?: unknown }).content;

310352

if (typeof replayContent === "string") {

311-

const strippedText = stripInboundMetadata(replayContent);

312-

out.push({

313-

...message,

314-

content: [

315-

{

316-

type: "text",

317-

text: strippedText.trim() ? strippedText : OMITTED_INBOUND_METADATA_TEXT,

318-

},

319-

],

320-

});

353+

const normalized = normalizeAssistantReplayTextContent(message, replayContent);

354+

if (normalized) {

355+

out.push(normalized);

356+

}

321357

touched = true;

322358

continue;

323359

}

324360

if (Array.isArray(replayContent)) {

325-

let contentTouched = false;

326-

const sanitizedContent = replayContent.map((block) => {

327-

if (!block || typeof block !== "object") {

328-

return block;

329-

}

330-

const text = (block as { text?: unknown }).text;

331-

if (typeof text !== "string") {

332-

return block;

333-

}

334-

const strippedText = stripInboundMetadata(text);

335-

if (strippedText === text) {

336-

return block;

361+

const normalized = normalizeAssistantReplayBlockContent(message, replayContent);

362+

if (normalized !== message) {

363+

if (normalized) {

364+

out.push(normalized);

337365

}

338-

contentTouched = true;

339-

return {

340-

...block,

341-

text: strippedText.trim() ? strippedText : OMITTED_INBOUND_METADATA_TEXT,

342-

};

343-

});

344-

if (contentTouched) {

345-

out.push({

346-

...message,

347-

content: sanitizedContent,

348-

});

349366

touched = true;

350367

continue;

351368

}