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

推荐订阅源

L
LangChain Blog
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
Vercel News
Vercel News
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
Last Week in AI
Last Week in AI
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
云风的 BLOG
云风的 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(channels): strip copied inbound metadata from replies...
steipete · 2026-04-26 · via Recent Commits to openclaw:main

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

11

import type { AgentMessage } from "@mariozechner/pi-agent-core";

22

import type { SessionManager } from "@mariozechner/pi-coding-agent";

3+

import { stripInboundMetadata } from "../../auto-reply/reply/strip-inbound-meta.js";

34

import type { OpenClawConfig } from "../../config/types.openclaw.js";

45

import type { ProviderRuntimeModel } from "../../plugins/provider-runtime-model.types.js";

56

import {

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

237238

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

238239

// trigger turn-ordering rejections.

239240

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

241+

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

240242241243

function isTranscriptOnlyOpenclawAssistant(message: AgentMessage): boolean {

242244

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

@@ -267,13 +269,48 @@ export function normalizeAssistantReplayContent(messages: AgentMessage[]): Agent

267269

}

268270

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

269271

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

272+

const strippedText = stripInboundMetadata(replayContent);

270273

out.push({

271274

...message,

272-

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

275+

content: [

276+

{

277+

type: "text",

278+

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

279+

},

280+

],

273281

});

274282

touched = true;

275283

continue;

276284

}

285+

if (Array.isArray(replayContent)) {

286+

let contentTouched = false;

287+

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

288+

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

289+

return block;

290+

}

291+

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

292+

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

293+

return block;

294+

}

295+

const strippedText = stripInboundMetadata(text);

296+

if (strippedText === text) {

297+

return block;

298+

}

299+

contentTouched = true;

300+

return {

301+

...block,

302+

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

303+

};

304+

});

305+

if (contentTouched) {

306+

out.push({

307+

...message,

308+

content: sanitizedContent,

309+

});

310+

touched = true;

311+

continue;

312+

}

313+

}

277314

if (Array.isArray(replayContent) && replayContent.length === 0) {

278315

// An assistant turn can legitimately end with `content: []` — for

279316

// example the silent-reply / NO_REPLY path locked in by