Summary
When the gateway is restarted (e.g., after an update), active sessions with compaction.memoryFlush.enabled: true do not trigger the configured flush before shutdown. Session history is permanently lost.
Steps to reproduce
- Configure compaction.memoryFlush.enabled: true with a systemPrompt instructing the agent to write a memory file
- Build up an active session (multi-message context, tool calls, decisions made)
- Run openclaw gateway restart (or update OpenClaw, which triggers a restart)
- Start a new session and check the workspace memory/ directory
Expected behavior
Before shutdown, the gateway triggers one final agent turn using the memoryFlush.systemPrompt, causing the agent to write a summary to memory/YYYY-MM-DD.md. New sessions can recall prior context via memory search.
Actual behavior
Gateway restarts immediately. No memory file is written. Prior session context is completely lost. New session starts blank.
OpenClaw version
2026.2.22-2 ·
Operating system
macOS 25.3.0 (arm64)
Install method
nom global
Logs, screenshots, and evidence
workspace-teams/memory/ contains only two files — both written manually mid-session. No auto-flush file from gateway shutdown. Prior session (spanning agent creation, Teams config, API key setup, routing decisions) is entirely unrecoverable from memory.
Impact and severity
High — any context not manually captured is lost on every restart. Particularly severe after updates (which force a restart). Consequence: users lose all in-session decisions, open tasks, and configuration context. memoryFlush config is silently non-functional on the shutdown path.
Additional information
Potentially related to #24165 (compaction not triggering during sessions). This is specifically the shutdown/restart path. The fix would be to add a graceful shutdown hook that fires memoryFlush for all active sessions before the gateway exits.
Summary
When the gateway is restarted (e.g., after an update), active sessions with compaction.memoryFlush.enabled: true do not trigger the configured flush before shutdown. Session history is permanently lost.
Steps to reproduce
Expected behavior
Before shutdown, the gateway triggers one final agent turn using the memoryFlush.systemPrompt, causing the agent to write a summary to memory/YYYY-MM-DD.md. New sessions can recall prior context via memory search.
Actual behavior
Gateway restarts immediately. No memory file is written. Prior session context is completely lost. New session starts blank.
OpenClaw version
2026.2.22-2 ·
Operating system
macOS 25.3.0 (arm64)
Install method
nom global
Logs, screenshots, and evidence
Impact and severity
High — any context not manually captured is lost on every restart. Particularly severe after updates (which force a restart). Consequence: users lose all in-session decisions, open tasks, and configuration context. memoryFlush config is silently non-functional on the shutdown path.
Additional information
Potentially related to #24165 (compaction not triggering during sessions). This is specifically the shutdown/restart path. The fix would be to add a graceful shutdown hook that fires memoryFlush for all active sessions before the gateway exits.