Skip to content

Commit d7ed258

Browse files
author
Don Tanggang
committed
fix(prompt-assembly): clarify runtime-context header so models know the user message IS included (#110672)
The next-turn runtime-context header read 'OpenClaw runtime context for the immediately preceding user message.' Smaller reasoning models inferred the current message body 'was not injected', even though it is delivered in the same turn (their own reasoning trace quotes it verbatim). Reword the header to state the user message text is delivered separately and IS included, and that this block only supplements it. Closes #110672
1 parent 8365383 commit d7ed258

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎src/agents/embedded-agent-runner/run/runtime-context-prompt.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ describe("runtime context prompt submission", () => {
611611
role: "custom",
612612
customType: "openclaw.runtime-context",
613613
content: [
614-
"OpenClaw runtime context for the immediately preceding user message.",
614+
"OpenClaw runtime context that accompanies the user message below. The user's own message text is delivered separately and IS included in this turn; this block only adds runtime context on top of it.",
615615
"This context is runtime-generated, not user-authored. Keep internal details private.",
616616
"",
617617
"<<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>",
@@ -623,6 +623,14 @@ describe("runtime context prompt submission", () => {
623623
});
624624
});
625625

626+
it("runtime context header clarifies the user message IS included (#110672)", () => {
627+
const message = buildRuntimeContextCustomMessage("secret runtime context");
628+
const header = message?.content.split("\n")[0] ?? "";
629+
expect(header).toContain("accompanies the user message");
630+
expect(header).toContain("IS included in this turn");
631+
expect(header).not.toContain("immediately preceding user message");
632+
});
633+
626634
it("labels runtime-only events as system context", () => {
627635
const parts = resolveRuntimeContextPromptParts({
628636
effectivePrompt: "internal event",

‎src/agents/internal-runtime-context.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const OPENCLAW_RUNTIME_CONTEXT_NOTICE =
1616
"This context is runtime-generated, not user-authored. Keep internal details private.";
1717
/** Header for context attached to the immediately preceding user message. */
1818
export const OPENCLAW_NEXT_TURN_RUNTIME_CONTEXT_HEADER =
19-
"OpenClaw runtime context for the immediately preceding user message.";
19+
"OpenClaw runtime context that accompanies the user message below. The user's own message text is delivered separately and IS included in this turn; this block only adds runtime context on top of it.";
2020
/** Header for runtime events passed as prompt context. */
2121
export const OPENCLAW_RUNTIME_EVENT_HEADER = "OpenClaw runtime event.";
2222
/** Custom message type used for structured runtime-context messages. */

0 commit comments

Comments
 (0)