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

推荐订阅源

C
Check Point Blog
GbyAI
GbyAI
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
U
Unit 42
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
Vercel News
Vercel News
美团技术团队
雷峰网
雷峰网
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
D
DataBreaches.Net
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
罗磊的独立博客
MyScale Blog
MyScale Blog
博客园_首页
IT之家
IT之家
F
Fortinet All Blogs
博客园 - Franky

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 Discord reply context at LLM boundary (#82801) · open...
joshavant · 2026-05-17 · via Recent Commits to openclaw:main

@@ -313,6 +313,11 @@ describe("normalizeMessagesForLlmBoundary", () => {

313313

'Conversation info (untrusted metadata):\n```json\n{"channel":"telegram"}\n```\n\nPlain historical ask',

314314

timestamp: 1,

315315

},

316+

{

317+

role: "assistant",

318+

content: [{ type: "text", text: "Historical answer" }],

319+

timestamp: 2,

320+

},

316321

];

317322318323

const output = normalizeMessagesForLlmBoundary(

@@ -322,6 +327,73 @@ describe("normalizeMessagesForLlmBoundary", () => {

322327

expect(output[0]?.content).toBe("Plain historical ask");

323328

});

324329330+

it("preserves inbound metadata on the current user turn", () => {

331+

const historicalEnvelope =

332+

'Conversation info (untrusted metadata):\n```json\n{"channel":"discord"}\n```\n\nOld ask';

333+

const currentEnvelope =

334+

'Conversation info (untrusted metadata):\n```json\n{"channel":"discord","has_reply_context":true}\n```\n\nReply target of current user message (untrusted, for context):\n```json\n{"body":"quoted status body"}\n```\n\nCurrent ask';

335+

const input = [

336+

{

337+

role: "user",

338+

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

339+

timestamp: 1,

340+

},

341+

{

342+

role: "assistant",

343+

content: [{ type: "text", text: "Historical answer" }],

344+

timestamp: 2,

345+

},

346+

{

347+

role: "user",

348+

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

349+

timestamp: 3,

350+

},

351+

];

352+353+

const output = normalizeMessagesForLlmBoundary(

354+

input as Parameters<typeof normalizeMessagesForLlmBoundary>[0],

355+

) as unknown as Array<{ content?: Array<{ text?: string }> }>;

356+357+

expect(output[0]?.content?.[0]?.text).toBe("Old ask");

358+

expect(output[2]?.content?.[0]?.text).toContain(

359+

"Reply target of current user message (untrusted, for context):",

360+

);

361+

expect(output[2]?.content?.[0]?.text).toContain("quoted status body");

362+

});

363+364+

it("preserves current user inbound metadata through tool-result continuation", () => {

365+

const currentEnvelope =

366+

'Conversation info (untrusted metadata):\n```json\n{"channel":"discord","has_reply_context":true}\n```\n\nReply target of current user message (untrusted, for context):\n```json\n{"body":"quoted status body"}\n```\n\nCurrent ask';

367+

const input = [

368+

{

369+

role: "user",

370+

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

371+

timestamp: 1,

372+

},

373+

{

374+

role: "assistant",

375+

content: [{ type: "toolCall", id: "call_1", name: "read", arguments: {} }],

376+

timestamp: 2,

377+

},

378+

{

379+

role: "toolResult",

380+

toolCallId: "call_1",

381+

toolName: "read",

382+

content: [{ type: "text", text: "tool output" }],

383+

timestamp: 3,

384+

},

385+

];

386+387+

const output = normalizeMessagesForLlmBoundary(

388+

input as Parameters<typeof normalizeMessagesForLlmBoundary>[0],

389+

) as unknown as Array<{ content?: Array<{ text?: string }> }>;

390+391+

expect(output[0]?.content?.[0]?.text).toContain(

392+

"Reply target of current user message (untrusted, for context):",

393+

);

394+

expect(output[0]?.content?.[0]?.text).toContain("quoted status body");

395+

});

396+325397

it("strips tool result details before provider conversion", () => {

326398

const input = [

327399

{