What happened
pre-compaction memory flush messages that should be silent were injected into the main user session as normal user messages.
After that, compaction started treating those internal flush prompts as conversation content, and the session entered a loop where nearly every new input triggered the same flush/compaction behavior.
Expected behavior
The pre-compaction memory flush should remain an internal/silent turn.
Users should not see the flush prompt in the chat UI or session transcript.
Compaction should continue normally after the flush.
Actual behavior
The following internal prompt appeared directly in the session/chat:
Pre-compaction memory flush. Store durable memories only in memory/YYYY-MM-DD.md ... If nothing to store, reply with NO_REPLY.
Then the session kept hitting compaction with logs like:
Compaction safeguard: no real conversation messages to summarize; writing compaction boundary to suppress re-trigger loop.
Repro notes
- Use OpenClaw TUI / main session
- Keep chatting until auto-compaction / pre-compaction memory flush triggers
- The flush prompt appears in the visible conversation
- Continue chatting in the same session
- Session gets stuck repeatedly surfacing the internal flush behavior
Environment
- OpenClaw local gateway
- TUI main session
agents.defaults.compaction.mode = "safeguard"
agents.defaults.compaction.memoryFlush.enabled = true
Evidence
The session transcript contains the flush prompt as role: user, repeated multiple times in the same session JSONL.
Gateway logs repeatedly show:
Compaction safeguard: no real conversation messages to summarize; writing compaction boundary to suppress re-trigger loop.
Why this seems like a bug
Docs describe memory flush as a silent turn that should generally resolve to NO_REPLY without being surfaced to the user. In this case, the internal prompt leaked into the visible/main session and then poisoned later compaction.
Temporary workaround
- abandon the polluted session and start a new one
- optionally disable
agents.defaults.compaction.memoryFlush temporarily
Suggested fix
- ensure pre-compaction memory flush messages are never persisted into the visible/main transcript as user messages
- ensure silent/internal turns are excluded from compaction summarization input
- guard against replay loops when a session already contains leaked internal flush prompts
What happened
pre-compaction memory flushmessages that should be silent were injected into the main user session as normalusermessages.After that, compaction started treating those internal flush prompts as conversation content, and the session entered a loop where nearly every new input triggered the same flush/compaction behavior.
Expected behavior
The pre-compaction memory flush should remain an internal/silent turn.
Users should not see the flush prompt in the chat UI or session transcript.
Compaction should continue normally after the flush.
Actual behavior
The following internal prompt appeared directly in the session/chat:
Pre-compaction memory flush. Store durable memories only in memory/YYYY-MM-DD.md ... If nothing to store, reply with NO_REPLY.Then the session kept hitting compaction with logs like:
Compaction safeguard: no real conversation messages to summarize; writing compaction boundary to suppress re-trigger loop.Repro notes
Environment
agents.defaults.compaction.mode = "safeguard"agents.defaults.compaction.memoryFlush.enabled = trueEvidence
The session transcript contains the flush prompt as
role: user, repeated multiple times in the same session JSONL.Gateway logs repeatedly show:
Compaction safeguard: no real conversation messages to summarize; writing compaction boundary to suppress re-trigger loop.Why this seems like a bug
Docs describe memory flush as a silent turn that should generally resolve to
NO_REPLYwithout being surfaced to the user. In this case, the internal prompt leaked into the visible/main session and then poisoned later compaction.Temporary workaround
agents.defaults.compaction.memoryFlushtemporarilySuggested fix