openclaw - 💡(How to fix) Fix [Bug] active-memory recall injects assistant chitchat into <active_memory_plugin> instead of NONE or valid memory summary [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#84034Fetched 2026-05-20 03:44:59
View on GitHub
Comments
2
Participants
2
Timeline
2
Reactions
1
Timeline (top)
commented ×2

The active-memory plugin sometimes injects assistant-style chitchat / clarification boilerplate into runtime context via:

<active_memory_plugin>...</active_memory_plugin>

instead of returning either:

  • NONE
  • or a valid compact memory summary

This contaminates the main prompt with irrelevant assistant-language such as greetings, “message got cut off” boilerplate, time announcements, and help-offer text.

Root Cause

This is not just low-quality recall. It is prompt contamination:

  • assistant-language enters untrusted runtime context
  • irrelevant text is injected before the main model turn
  • repeated contamination can confuse downstream reasoning
  • some variants may propagate into memory artifacts / derived context

Fix Action

Fix / Workaround

Phase 1: minimal hotfix

Harden normalizeActiveSummary() so it fails closed on obvious assistant-chitchat / clarification / time-broadcast output.

This is the smallest safe patch because it protects:

Minimal patch direction

A minimal practical fix is to validate summary-like output before accepting it, e.g. reject patterns matching:

Code Example

<active_memory_plugin>...</active_memory_plugin>

---

<active_memory_plugin>
您好!请问有什么可以帮助您的吗?如果您有任何问题或需要帮助,请随时告诉我。
</active_memory_plugin>

---

function buildMetadata(summary) {
  if (!summary) return;
  return [
    `<${ACTIVE_MEMORY_PLUGIN_TAG}>`,
    escapeXml(summary),
    `</${ACTIVE_MEMORY_PLUGIN_TAG}>`
  ].join("\n");
}

---

{
  "model": "doubao/doubao-1-5-lite-32k-250115",
  "timeoutMs": 20000,
  "maxSummaryChars": 600,
  "persistTranscripts": true,
  "queryMode": "recent",
  "promptStyle": "balanced"
}

---

{
  "model": "bigmodel/glm-4-flash-250414",
  "timeoutMs": 20000,
  "maxSummaryChars": 600,
  "persistTranscripts": true,
  "queryMode": "recent",
  "promptStyle": "balanced"
}

---

{"kind":"none"}

---

{"kind":"memory","summary":"User prefers aisle seats and extra buffer over tight connections."}
RAW_BUFFERClick to expand / collapse

[Bug] active-memory recall sometimes injects assistant chitchat into <active_memory_plugin> instead of NONE or a valid memory summary

Summary

The active-memory plugin sometimes injects assistant-style chitchat / clarification boilerplate into runtime context via:

<active_memory_plugin>...</active_memory_plugin>

instead of returning either:

  • NONE
  • or a valid compact memory summary

This contaminates the main prompt with irrelevant assistant-language such as greetings, “message got cut off” boilerplate, time announcements, and help-offer text.

Expected behavior

When no useful recall is available, the active-memory subagent should return NONE (or no summary after normalization), and nothing should be injected into <active_memory_plugin>.

When useful recall exists, it should return a compact factual memory summary only.

It should never inject:

  • greetings
  • help-offer boilerplate
  • “your message got cut off” clarification text
  • time/date announcements
  • generic “please tell me what you need help with” text

Actual behavior

The active-memory recall subagent sometimes returns assistant-style free-form text such as:

<active_memory_plugin>
您好!请问有什么可以帮助您的吗?如果您有任何问题或需要帮助,请随时告诉我。
</active_memory_plugin>

Other observed variants include:

  • It seems like your message got cut off. Could you please provide more details...
  • Hello! It looks like your message didn't come through...
  • 当前日期和时间是...如果您需要任何帮助...
  • 您好!看起来您可能没有说出您的问题或请求...
  • 您好!看起来您的消息可能没有包含具体问题或请求...

These strings are then injected directly into runtime context and can influence downstream prompt behavior.

Why this matters

This is not just low-quality recall. It is prompt contamination:

  • assistant-language enters untrusted runtime context
  • irrelevant text is injected before the main model turn
  • repeated contamination can confuse downstream reasoning
  • some variants may propagate into memory artifacts / derived context

Evidence / timeline

Earliest known subagent drift

  • 2026-04-22T09:12:12.009Z
  • file:
    • /root/.openclaw/plugins/active-memory/transcripts/agents/main/active-memory/active-memory-mo9u3b5u-3b670fb0.jsonl
  • model:
    • bigmodel/glm-4-flash-250414
  • observed assistant output:
    • 你好!请问有什么可以帮助您的?如果您有任何问题或需要帮助,请随时告诉我。

Earliest known main-session contamination

  • starting at 2026-04-28T00:26:05.715Z
  • file:
    • /root/.openclaw/agents/main/sessions/9d4f2cf8-d54d-4bba-a695-d1c9ff5dd9f3.jsonl.bak-2045903-1777341207869

Observed injected variants included:

  • Hello! It looks like you didn't finish your message...
  • Hello! It seems like your message got cut off...
  • 你好!请问有什么可以帮助你的吗?...
  • 您好!请问有什么可以帮助您的吗?...

These match the style of raw active-memory subagent outputs.

Root cause hypothesis

The most likely root cause is:

  1. the active-memory recall subagent is instructed to return either:
    • NONE
    • or one compact plain-text summary
  2. in weak-match / no-recall cases, some models (especially observed with bigmodel/glm-4-flash-250414) do not reliably follow that contract
  3. instead of returning NONE, they produce assistant-style boilerplate
  4. the plugin currently treats that output as a valid summary and injects it into <active_memory_plugin>

So the failure is:

  • model output contract violation
  • plus
  • insufficient parser-side validation before injection

Important code-path findings

From local inspection of the installed active-memory bundle:

1) XML packaging layer does not generate the chitchat

buildMetadata(summary) only escapes and wraps the summary:

function buildMetadata(summary) {
  if (!summary) return;
  return [
    `<${ACTIVE_MEMORY_PLUGIN_TAG}>`,
    escapeXml(summary),
    `</${ACTIVE_MEMORY_PLUGIN_TAG}>`
  ].join("\n");
}

So the boilerplate is not being invented there.

2) timeout / partial recovery also does not invent the chitchat

buildTimeoutRecallResult() consumes:

  • params.rawReply
  • or partial assistant text from transcript

and then passes it through normalizeActiveSummary().

So timeout recovery is also replaying subagent output, not fabricating it.

3) current prompt is still a soft natural-language contract

The recall prompt currently tells the model to return either:

  • NONE
  • or one compact plain-text summary

That is a soft instruction, not a strict protocol.

Configuration correlation

A likely behavioral regression coincides with an active-memory recall model switch.

Observed historical configs:

before switch

openclaw.json.bak_before_am_switch

{
  "model": "doubao/doubao-1-5-lite-32k-250115",
  "timeoutMs": 20000,
  "maxSummaryChars": 600,
  "persistTranscripts": true,
  "queryMode": "recent",
  "promptStyle": "balanced"
}

after switch

openclaw.json.bak_am_optimize

{
  "model": "bigmodel/glm-4-flash-250414",
  "timeoutMs": 20000,
  "maxSummaryChars": 600,
  "persistTranscripts": true,
  "queryMode": "recent",
  "promptStyle": "balanced"
}

This suggests the model switch may have increased invalid non-NONE outputs in weak/no-recall cases.

Recommended fix

Phase 1: minimal hotfix

Harden normalizeActiveSummary() so it fails closed on obvious assistant-chitchat / clarification / time-broadcast output.

This is the smallest safe patch because it protects:

  • normal successful recall
  • timeout partial recovery
  • all current plain-text paths

without requiring a larger redesign.

Phase 2: protocol hardening

Move active-memory recall output to a structured response protocol, e.g.:

{"kind":"none"}

or

{"kind":"memory","summary":"User prefers aisle seats and extra buffer over tight connections."}

Then reject anything that is not valid structured output.

This would make the parser, not the model, the safety boundary.

Minimal patch direction

A minimal practical fix is to validate summary-like output before accepting it, e.g. reject patterns matching:

  • greetings + help-offer boilerplate
  • “message got cut off”
  • “please provide more details”
  • generic clarification requests
  • time/date broadcast text
  • “tell me what help you need” style output

This should be applied inside normalizeActiveSummary() so both normal and timeout-partial paths are covered.

Risk / tradeoffs

False positives

A few legitimate summaries containing similar phrases could be dropped.

This seems acceptable compared with injecting assistant chitchat into every downstream prompt.

False negatives

Pattern-based filtering may still miss future variants.

So Phase 1 is only a stopgap.

Better long-term fix

Structured output + strict parse is more robust than blacklist filtering.

Suggested follow-up

  1. add parser-side validation immediately
  2. A/B test active-memory recall with:
    • bigmodel/glm-4-flash-250414
    • doubao/doubao-1-5-lite-32k-250115
  3. compare:
    • invalid non-NONE rate
    • useful recall rate
    • latency
  4. if needed, move to JSON-only recall output contract

Reproduction idea

Try weak / no-recall prompts or ambiguous short inputs under active-memory with queryMode=recent and promptStyle=balanced, then inspect whether the recall subagent returns:

  • NONE as expected
  • or assistant-style clarification/chitchat that gets injected into <active_memory_plugin>

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When no useful recall is available, the active-memory subagent should return NONE (or no summary after normalization), and nothing should be injected into <active_memory_plugin>.

When useful recall exists, it should return a compact factual memory summary only.

It should never inject:

  • greetings
  • help-offer boilerplate
  • “your message got cut off” clarification text
  • time/date announcements
  • generic “please tell me what you need help with” text

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING