-
Notifications
You must be signed in to change notification settings - Fork 363
Description
Summary
We observed severe reply delays in OpenClaw Web UI that were strongly correlated with heartbeat turns and memory-lancedb-pro auto-recall injection.
After investigation, the issue appears to be caused by a combination of:
- heartbeat turns being processed too much like normal conversation turns
memory-lancedb-proauto-injecting<relevant-memories>duringbefore_agent_start- compaction being triggered but then cancelled by safeguard because there are "no real conversation messages to summarize"
Disabling heartbeat and setting autoRecall: false made the system recover immediately: no more repeated compacting context, and normal reply latency returned.
What we observed
1) Heartbeat turns seem to enter the normal prompt-building path
Our heartbeat prompt is NO_REPLY.
In practice, these heartbeat turns did not behave like a minimal health-check / HEARTBEAT_OK path. Instead, they seemed to be treated like normal turns, and we could see suspiciously long context being built around them.
2) Auto-recall appears to inject memories even for heartbeat-like turns
We observed that NO_REPLY heartbeat turns appeared to receive LanceDB memory injection, resulting in unexpectedly long prompt context.
This is especially surprising because heartbeat turns are low-value system pulses and should ideally not trigger long-term memory recall at all.
3) Compaction safeguard repeatedly cancelled compaction
We captured logs like:
Compaction safeguard: cancelling compaction with no real conversation messages to summarize.
memory-lancedb-pro: injecting 3 memories into context for agent main
This suggests a bad interaction:
- context grows
- compaction triggers
- safeguard sees too few real user/assistant messages
- compaction is cancelled
- auto-recall continues injecting memories
- latency becomes minutes long
Related existing issues
This seems related in spirit to several existing issues:
- 使用记忆增强插件,对话过程周期性出现长期记忆。怎么设置不出现? #13
periodically showing long-term memories in replies - autoRecall 绕过了框架层 memorySearch.enabled 开关 #58
autoRecall bypasses framework-level memorySearch.enabled - Make autoRecall injection safer and less likely to leak verbatim #85
Make autoRecall injection safer and less likely to leak verbatim - autoRecall retrieval query not stripped of OpenClaw metadata — wrong memories returned #100
autoRecall retrieval query not stripped of OpenClaw metadata
So while this report is specifically about heartbeat interaction, it may share the same root family: autoRecall boundary/gating is too broad, and metadata/system turns can pollute recall behavior.
Current workaround
The following workaround restored normal behavior for us:
{
"agents": {
"defaults": {
"heartbeat": {
"every": "0",
"model": "aihubmix-router/gpt-5-nano",
"prompt": "NO_REPLY",
"lightContext": true
}
}
},
"plugins": {
"entries": {
"memory-lancedb-pro": {
"config": {
"autoRecall": false
}
}
}
}
}Suggested fix / expected behavior
I think heartbeat / system-pulse turns should be excluded from generic auto-recall by default.
Suggested behavior:
- Do not trigger
autoRecallfor heartbeat /NO_REPLY/ system-event turns - Prefer
lightContext: trueor equivalent minimal context path for heartbeat - Strip framework metadata before any recall gating / retrieval query construction
- Improve logs when compaction is cancelled, e.g. indicate how much of recent context comes from system events / memory injections / heartbeat turns
Why this matters
Heartbeat is supposed to be a tiny health pulse. If it can trigger memory injection and normal prompt-building, it can become a silent context amplifier that degrades the main session over time.
In our case, turning off autoRecall solved the practical problem. But if heartbeat still enters the normal path, there may still be a framework-side issue worth fixing.
Happy to provide more environment details or logs if useful.