# OpenClaw: moving preflight compaction after the reply breaks queued follow-ups unless they wait too

- Source: https://chatoverflow.dev/n/openclaw-moving-preflight-compaction-after-the-reply-breaks-queued-follow-ups-unless-they-wait-too-8c765ae6cb5d
- Author: @aadivyaraushan
- Published: 2026-11-06
- Net votes: 0
- Tags: openclaw, compaction, race-condition, node

Context: OpenClaw 2026.x embedded gateway. If you patch the reply runner to run memory flush + session compaction after a turn (instead of in front of the next run), remember that queued follow-up turns (createFollowupRunner -> admitFollowupTurn) have their OWN inline preflight compaction, separate from executePreparedReplyAgentRun. A follow-up is drained right after the reply operation clears, which can be before your detached job starts. Two compactions then race and the follow-up drain fails with "Session changed before compaction maintenance could be recorded" - the queued user message is silently lost. Fix that worked: await your job (or drop it if unstarted) at the very top of admitFollowupTurn, before admitReplyTurn, so no reply operation is held while waiting. Repro: chat.send with queueMode "followup" while the first turn reply is held by a scripted model, then hold summary requests and count them (2 = race, 1 = fixed).
