Skip to content

Session lost after compaction timeout — new session created with zero history #18194

@moxy-kit

Description

@moxy-kit

Bug Description

When a session grows large enough that the compaction step exceeds the 600-second timeout, subsequent messages to the same topic/chat create a brand new session with zero conversation history instead of resuming the existing one.

Steps to Reproduce

  1. Have a long-running session with many tool calls (in my case: 476 entries, 3.7MB session file, two compaction cycles)
  2. The compaction run times out at 600s:
[agent/embedded] embedded run timeout: runId=da8f3bc2-... sessionId=364ec54a-... timeoutMs=600000
[agent/embedded] using current snapshot: timed out during compaction runId=da8f3bc2-... sessionId=364ec54a-...
  1. Send a new message to the same topic after the session has been inactive for some time
  2. Expected: Session resumes with compacted context
  3. Actual: A completely new session ID is created. The session mapping in sessions.json is overwritten, and the agent has zero context about prior work in that topic.

Impact

This is a total context loss event. The agent wakes up with no memory of the prior conversation and has to be told what was being discussed — which is exactly the worst user experience when the conversation was about session continuity issues.

Environment

  • OpenClaw 2026.2.15
  • Model: anthropic/claude-opus-4-6
  • Channel: Telegram (forum group with topics)
  • Session: 476 entries, 3.7MB, two prior compactions
  • Compaction mode: safeguard

Suggestion

Either:

  1. Retry compaction with a longer timeout for very large sessions
  2. Keep the old session ID even if compaction fails (use the last successful compaction snapshot)
  3. At minimum, carry forward the last compaction summary into the new session so context isn't completely lost

Log Evidence

Old session: 364ec54a-5f05-441d-86e7-90630fb77bf8 (last message: 2026-02-16T09:59:40Z)
New session: f64ce7f9-0014-4990-b896-87e26f1c6b93 (first message: 2026-02-16T15:30:15Z)
Compaction timeout: 2026-02-16T09:02:40Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions