diff --git a/src/agents/embedded-agent-runner/run/runtime-context-prompt.test.ts b/src/agents/embedded-agent-runner/run/runtime-context-prompt.test.ts index f892ec432409..b80509f9839a 100644 --- a/src/agents/embedded-agent-runner/run/runtime-context-prompt.test.ts +++ b/src/agents/embedded-agent-runner/run/runtime-context-prompt.test.ts @@ -219,7 +219,9 @@ describe("runtime context prompt submission", () => { "OpenClaw runtime event.", "This context is runtime-generated, not user-authored. Keep internal details private.", "", + "<<>>", "internal event", + "<<>>", ].join("\n"), }); }); @@ -242,7 +244,9 @@ describe("runtime context prompt submission", () => { "OpenClaw runtime event.", "This context is runtime-generated, not user-authored. Keep internal details private.", "", + "<<>>", "internal event", + "<<>>", ].join("\n"), }); }); @@ -339,7 +343,9 @@ describe("runtime context prompt submission", () => { "OpenClaw runtime context for the immediately preceding user message.", "This context is runtime-generated, not user-authored. Keep internal details private.", "", + "<<>>", "secret runtime context", + "<<>>", ].join("\n"), display: false, details: { source: "openclaw-runtime-context" }, diff --git a/src/agents/embedded-agent-runner/run/runtime-context-prompt.ts b/src/agents/embedded-agent-runner/run/runtime-context-prompt.ts index 76ba70319e80..57d00d9c04f6 100644 --- a/src/agents/embedded-agent-runner/run/runtime-context-prompt.ts +++ b/src/agents/embedded-agent-runner/run/runtime-context-prompt.ts @@ -3,6 +3,8 @@ */ import { extractInternalRuntimeContext, + INTERNAL_RUNTIME_CONTEXT_BEGIN, + INTERNAL_RUNTIME_CONTEXT_END, OPENCLAW_NEXT_TURN_RUNTIME_CONTEXT_HEADER, OPENCLAW_RUNTIME_CONTEXT_CUSTOM_TYPE, OPENCLAW_RUNTIME_CONTEXT_NOTICE, @@ -153,13 +155,18 @@ function buildRuntimeContextMessageContent(params: { runtimeContext: string; kind: "next-turn" | "runtime-event"; }): string { + // Wrap the runtime context body in delimited internal-context markers so + // stripInternalRuntimeContext can fully remove the block when it leaks + // into user-visible surfaces (e.g. Feishu streaming cards, #92589). return [ params.kind === "runtime-event" ? OPENCLAW_RUNTIME_EVENT_HEADER : OPENCLAW_NEXT_TURN_RUNTIME_CONTEXT_HEADER, OPENCLAW_RUNTIME_CONTEXT_NOTICE, "", + INTERNAL_RUNTIME_CONTEXT_BEGIN, params.runtimeContext, + INTERNAL_RUNTIME_CONTEXT_END, ].join("\n"); }