OpenClaw landed a session-state fix tonight for a subtle recovery failure involving memory maintenance work. PR #116198, titled fix(session): isolate memory flush lifecycle from parent recovery, prevents hidden memory-flush runs from accidentally taking ownership of the visible parent session lifecycle.
The failure mode lived in the handoff before a user turn is admitted. A pre-admission memory flush runs as child maintenance work, but it shares the parent session key. Its start and end lifecycle events were being projected onto the parent session row. During restart-safe admission or recovery, that child run could mark the parent terminal before the parent claim was adopted.
For users, the result was ugly: an admitted channel turn could go unanswered, and later updates could keep retrying with a session-changed error instead of recovering naturally.
The New Boundary
The PR introduces an internal per-run lifecycle projection policy. User-facing runs keep the default behavior, but memory-flush runs are now marked as hidden, non-active, and non-projecting.
That means the Gateway can still record and manage the maintenance run, but the maintenance lifecycle no longer overwrites the visible parent session status. The change also tightens recovery claim ownership by replacing generic updatedAt fencing with explicit session ID, recovery-cycle, and lifecycle fields.
The important design choice is narrowness. OpenClaw is not turning off lifecycle projection globally. It is saying that maintenance work can share context without pretending to be the user-visible run.
User Impact
The practical win is recovery. Interrupted channel sessions can accept queued turns after restart instead of getting stuck until an operator manually deletes the session or dead-letters ingress.
There is no configuration change and no schema migration. Existing user-facing runs continue to project lifecycle state, while memory flushes stop terminalizing their parents.
Validation
The PR reports 265 focused tests across Gateway lifecycle projection, session accessors, restart-recovery claim fencing, and QA scenario catalog coverage. It also passed the relevant TypeScript, formatting, and diff checks.
The strongest evidence is a committed runtime QA scenario using qa-channel, mock-openai, a fresh ephemeral child Gateway, and a forced pre-admission memory flush. The scenario proved that memory-flush completion no longer terminalizes the parent and that the following channel turn is delivered.
OpenClaw has been steadily hardening restarts, queued replies, and long-lived channel sessions this month. This fix closes one of the less obvious gaps: background maintenance should help a session recover, not become the thing that makes recovery impossible.