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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
Recent Announcements
Recent Announcements
Vercel News
Vercel News
M
MIT News - Artificial intelligence
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
H
Help Net Security
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
G
Google Developers Blog
罗磊的独立博客
爱范儿
爱范儿
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
月光博客
月光博客
人人都是产品经理
人人都是产品经理
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: keep internal completion wakes out of chat memory · ...
steipete · 2026-04-26 · via Recent Commits to openclaw:main

File tree

  • packages/memory-host-sdk/src/host

  • src

    • gateway

    • memory-host-sdk/host

Original file line numberDiff line numberDiff line change

@@ -73,6 +73,9 @@ Docs: https://docs.openclaw.ai

7373

and honor configured `params.chat_template_kwargs` for OpenAI-compatible

7474

completions, so vLLM/Nemotron replies stay visible instead of becoming

7575

thinking-only. Fixes #71891. Thanks @jmystaki-create and @dennis-lynch.

76+

- Subagents/memory: keep inter-session completion wakes out of memory and

77+

dreaming session exports, and strip internal runtime-context blocks from

78+

realtime Control UI chat events.

7679

- Agents/Claude: treat zero-token empty `stop` turns as failed provider output,

7780

retry once, repair replay, and allow configured model fallback instead of

7881

preserving them as successful silent replies. Fixes #71880. Thanks @MagnaAI.

Original file line numberDiff line numberDiff line change

@@ -185,4 +185,32 @@ describe("buildSessionEntry", () => {

185185

expect(entry).not.toBeNull();

186186

expect(entry!.content).toBe("User: Actual user text");

187187

});

188+
189+

it("skips inter-session user messages", async () => {

190+

const jsonlLines = [

191+

JSON.stringify({

192+

type: "message",

193+

message: {

194+

role: "user",

195+

content: "A background task completed. Internal relay text.",

196+

provenance: { kind: "inter_session", sourceTool: "subagent_announce" },

197+

},

198+

}),

199+

JSON.stringify({

200+

type: "message",

201+

message: { role: "assistant", content: "User-facing summary." },

202+

}),

203+

JSON.stringify({

204+

type: "message",

205+

message: { role: "user", content: "Actual user follow-up." },

206+

}),

207+

];

208+

const filePath = path.join(tmpDir, "inter-session-session.jsonl");

209+

fsSync.writeFileSync(filePath, jsonlLines.join("\n"));

210+
211+

const entry = await buildSessionEntry(filePath);

212+

expect(entry).not.toBeNull();

213+

expect(entry!.content).toBe("Assistant: User-facing summary.\nUser: Actual user follow-up.");

214+

expect(entry!.lineMap).toEqual([2, 3]);

215+

});

188216

});

Original file line numberDiff line numberDiff line change

@@ -8,6 +8,7 @@ import {

88

} from "../../../../src/config/sessions/artifacts.js";

99

import { resolveSessionTranscriptsDirForAgent } from "../../../../src/config/sessions/paths.js";

1010

import { redactSensitiveText } from "../../../../src/logging/redact.js";

11+

import { hasInterSessionUserProvenance } from "../../../../src/sessions/input-provenance.js";

1112

import { hashText } from "./hash.js";

1213
1314

export type SessionFileEntry = {

@@ -170,14 +171,17 @@ export async function buildSessionEntry(absPath: string): Promise<SessionFileEnt

170171

continue;

171172

}

172173

const message = (record as { message?: unknown }).message as

173-

| { role?: unknown; content?: unknown }

174+

| { role?: unknown; content?: unknown; provenance?: unknown }

174175

| undefined;

175176

if (!message || typeof message.role !== "string") {

176177

continue;

177178

}

178179

if (message.role !== "user" && message.role !== "assistant") {

179180

continue;

180181

}

182+

if (message.role === "user" && hasInterSessionUserProvenance(message)) {

183+

continue;

184+

}

181185

const text = extractSessionText(message.content, message.role);

182186

if (!text) {

183187

continue;

Original file line numberDiff line numberDiff line change

@@ -215,6 +215,34 @@ describe("agent event handler", () => {

215215

nowSpy?.mockRestore();

216216

});

217217
218+

it("strips internal runtime context from assistant chat events", () => {

219+

const { broadcast, nodeSendToSession, nowSpy } = emitRun1AssistantText(

220+

createHarness({ now: 1_000 }),

221+

[

222+

"Visible before.",

223+

"",

224+

"<<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>",

225+

"OpenClaw runtime context (internal):",

226+

"[Internal task completion event]",

227+

"secret child result",

228+

"<<<END_OPENCLAW_INTERNAL_CONTEXT>>>",

229+

"",

230+

"Visible after.",

231+

].join("\n"),

232+

);

233+
234+

const chatCalls = chatBroadcastCalls(broadcast);

235+

expect(chatCalls).toHaveLength(1);

236+

const payload = chatCalls[0]?.[1] as {

237+

message?: { content?: Array<{ text?: string }> };

238+

};

239+

expect(payload.message?.content?.[0]?.text).toBe("Visible before.\n\nVisible after.");

240+

expect(payload.message?.content?.[0]?.text).not.toContain("BEGIN_OPENCLAW_INTERNAL_CONTEXT");

241+

expect(payload.message?.content?.[0]?.text).not.toContain("secret child result");

242+

expect(sessionChatCalls(nodeSendToSession)).toHaveLength(1);

243+

nowSpy?.mockRestore();

244+

});

245+
218246

it.each([" NO_REPLY ", " ANNOUNCE_SKIP ", " REPLY_SKIP "])(

219247

"does not emit chat delta for suppressed control text %s",

220248

(replyText) => {

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,4 @@

1+

import { stripInternalRuntimeContext } from "../agents/internal-runtime-context.js";

12

import { DEFAULT_HEARTBEAT_ACK_MAX_CHARS, stripHeartbeatToken } from "../auto-reply/heartbeat.js";

23

import { normalizeVerboseLevel } from "../auto-reply/thinking.js";

34

import {

@@ -688,9 +689,11 @@ export function createAgentEventHandler({

688689

text: string,

689690

delta?: unknown,

690691

) => {

691-

const cleanedText = stripInlineDirectiveTagsForDisplay(text).text;

692+

const cleanedText = stripInternalRuntimeContext(stripInlineDirectiveTagsForDisplay(text).text);

692693

const cleanedDelta =

693-

typeof delta === "string" ? stripInlineDirectiveTagsForDisplay(delta).text : "";

694+

typeof delta === "string"

695+

? stripInternalRuntimeContext(stripInlineDirectiveTagsForDisplay(delta).text)

696+

: "";

694697

const previousRawText = chatRunState.rawBuffers.get(clientRunId) ?? "";

695698

const mergedRawText = resolveMergedAssistantText({

696699

previousText: previousRawText,

Original file line numberDiff line numberDiff line change

@@ -598,6 +598,24 @@ describe("buildSessionEntry", () => {

598598

content: "User: Actual user text",

599599

lineMap: [3],

600600

},

601+

{

602+

name: "inter-session user provenance",

603+

fileName: "inter-session-session.jsonl",

604+

records: [

605+

{

606+

type: "message",

607+

message: {

608+

role: "user",

609+

content: "A background task completed. Internal relay text.",

610+

provenance: { kind: "inter_session", sourceTool: "subagent_announce" },

611+

},

612+

},

613+

{ type: "message", message: { role: "assistant", content: "User-facing summary." } },

614+

{ type: "message", message: { role: "user", content: "Actual user follow-up." } },

615+

],

616+

content: "Assistant: User-facing summary.\nUser: Actual user follow-up.",

617+

lineMap: [2, 3],

618+

},

601619

] as const;

602620
603621

for (const testCase of cases) {

Original file line numberDiff line numberDiff line change

@@ -14,6 +14,7 @@ import {

1414

import { resolveSessionTranscriptsDirForAgent } from "../../config/sessions/paths.js";

1515

import { isExecCompletionEvent } from "../../infra/heartbeat-events-filter.js";

1616

import { redactSensitiveText } from "../../logging/redact.js";

17+

import { hasInterSessionUserProvenance } from "../../sessions/input-provenance.js";

1718

import { isCronRunSessionKey } from "../../sessions/session-key-utils.js";

1819

import { hashText } from "./hash.js";

1920

@@ -504,14 +505,17 @@ export async function buildSessionEntry(

504505

continue;

505506

}

506507

const message = (record as { message?: unknown }).message as

507-

| { role?: unknown; content?: unknown }

508+

| { role?: unknown; content?: unknown; provenance?: unknown }

508509

| undefined;

509510

if (!message || typeof message.role !== "string") {

510511

continue;

511512

}

512513

if (message.role !== "user" && message.role !== "assistant") {

513514

continue;

514515

}

516+

if (message.role === "user" && hasInterSessionUserProvenance(message)) {

517+

continue;

518+

}

515519

const rawText = collectRawSessionText(message.content);

516520

if (rawText === null) {

517521

continue;