openclaw - 💡(How to fix) Fix [Bug]: Auto-compaction crashes active responses after 5.18 transcript lock scope change (#13744)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

17:56:06 embedded run auto-compaction start 17:56:23 lane task error: lane=session:agent:hodl:imessage:group:32 durationMs=34376 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released"

Root Cause

5.18 introduced the #13744 fix: "release the embedded run's coarse transcript lock before model I/O while locking persistence and cleanup separately." This was intended to prevent concurrent message timeouts. The unintended consequence: auto-compaction rewrites the session file during model I/O, triggering SessionTakeoverError and killing the active response.

Fix Action

Workaround

Setting compaction.mode: "manual" in config and running compaction via a scheduled quiet-hours job when no conversations are active.

Code Example

17:56:06 embedded run auto-compaction start
17:56:23 lane task error: lane=session:agent:hodl:imessage:group:32
         durationMs=34376
         error="EmbeddedAttemptSessionTakeoverError: session file changed
         while embedded prompt lock was released"
RAW_BUFFERClick to expand / collapse

Environment

  • OpenClaw: 2026.5.18 → 2026.5.19-beta.2 (issue persists on both)
  • OS: macOS Apple Silicon (MacBook Air)
  • Install: npm global
  • Agents: 15 agents, multi-channel (iMessage group chats, Telegram, Slack)
  • Prior version: 2026.5.7 — zero crashes

What happened

After upgrading from 5.7 to 5.18, every agent with an active group chat conversation crashes when auto-compaction fires. The error is EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released.

Zero SessionTakeoverError on 5.7. 38 on the first day of 5.18. The crashes correlate 1:1 with embedded run auto-compaction start log entries — not crons, not concurrent messages, not provider failures.

Root cause

5.18 introduced the #13744 fix: "release the embedded run's coarse transcript lock before model I/O while locking persistence and cleanup separately." This was intended to prevent concurrent message timeouts. The unintended consequence: auto-compaction rewrites the session file during model I/O, triggering SessionTakeoverError and killing the active response.

Evidence

24 auto-compaction events in one day, roughly every 55 minutes. Each one that coincides with an active model call crashes that response:

17:56:06 embedded run auto-compaction start
17:56:23 lane task error: lane=session:agent:hodl:imessage:group:32
         durationMs=34376
         error="EmbeddedAttemptSessionTakeoverError: session file changed
         while embedded prompt lock was released"

This pattern repeats at 16:19, 17:01, 17:56, 18:44, 18:52 — every compaction that hits an active session. Affected agents include multiple agents with persistent group chat sessions. The crashed lane becomes wedged and stops accepting new messages until the next gateway restart.

What #83510 (5.19) fixes and what it doesn't

5.19's #83510 correctly stops the takeover error from consuming model fallbacks (no more "ALL PROVIDERS DOWN" false alerts). But the underlying crash still occurs — the response still dies, the user still gets no reply. The error is handled more gracefully but the active response is still lost.

Expected behavior

Auto-compaction should not write to a session file while a model response is in-flight. Either:

  1. Auto-compaction should check for an active embedded run and defer
  2. The compaction write should be covered by the same lock that protects the model I/O
  3. Auto-compaction should be scheduled during idle periods, not on a fixed timer that ignores session activity

Workaround

Setting compaction.mode: "manual" in config and running compaction via a scheduled quiet-hours job when no conversations are active.

Reproduction

  1. Configure an agent with a persistent group chat session (e.g., iMessage group)
  2. Send messages to the group chat frequently enough that the session stays active
  3. Wait for auto-compaction to fire (~55 min intervals)
  4. Observe SessionTakeoverError crash on the active response
  5. Observe the crashed lane becomes wedged — subsequent messages get no response

On 5.7 (before #13744 lock change): zero crashes. On 5.18+: crashes on every compaction that coincides with active model I/O.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Auto-compaction should not write to a session file while a model response is in-flight. Either:

  1. Auto-compaction should check for an active embedded run and defer
  2. The compaction write should be covered by the same lock that protects the model I/O
  3. Auto-compaction should be scheduled during idle periods, not on a fixed timer that ignores session activity

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Auto-compaction crashes active responses after 5.18 transcript lock scope change (#13744)