openclaw - 💡(How to fix) Fix LCM: no invalidation or recovery path from .jsonl edits; DB accumulates structurally invalid messages permanently [1 participants]

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…
GitHub stats
openclaw/openclaw#70870Fetched 2026-04-24 10:38:31
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Root Cause

Root cause: LCM is the canonical message source for the Anthropic API call, not the .jsonl file. But LCM has no self-healing logic and no public repair command. The .jsonl \u2192 LCM sync is append-only and one-directional.

RAW_BUFFERClick to expand / collapse

Bug Report / Feature Request

Severity: Medium — no data loss, but no recovery path once corruption accumulates

Summary: ~/.openclaw/lcm.db accumulates every failed attempt, empty assistant message, delivery-mirror entry, and malformed message permanently. There is no mechanism to invalidate the LCM DB based on .jsonl session file edits. When a session's .jsonl is repaired or deleted, the gateway continues reading from LCM and serving the corrupted message history to the model.

Evidence:

  • Conversation 260 in lcm.db had 9,176 messages with extensive consecutive-user corruption
  • Multiple gateway restarts and .jsonl edits did not clear the corrupt state
  • /new (starting a fresh session) was the only effective recovery action
  • Corrupt entries included: consecutive role: assistant messages (from delivery-mirror), empty assistant turns (from capability-guard plugin empty outputs), and malformed role sequences

Root cause: LCM is the canonical message source for the Anthropic API call, not the .jsonl file. But LCM has no self-healing logic and no public repair command. The .jsonl \u2192 LCM sync is append-only and one-directional.

Impact:

  • Users who attempt to recover a corrupt session by editing .jsonl files get no benefit
  • Corrupt entries compound over time: each new message appended to a corrupt conversation adds LCM overhead and perpetuates the bad state
  • No tooling exists to diagnose or repair LCM state without deep DB access

Request:

  1. Add openclaw lcm repair [conversation-id] command that re-derives conversation state from the .jsonl source of truth
  2. Or add invalidation logic: when a .jsonl file is deleted or significantly modified, mark the corresponding LCM conversation for re-ingestion
  3. At minimum, expose openclaw lcm status [conversation-id] so users can inspect message counts and detect corruption before it cascades

Related bugs:

  • Plugin empty outputs (issue #70868) seed LCM with bad entries
  • delivery-mirror (issue #70869) creates consecutive-assistant entries in LCM
  • The three bugs chain: empty outputs \u2192 delivery-mirror compounds \u2192 LCM never heals \u2192 unrecoverable session

extent analysis

TL;DR

Implement an openclaw lcm repair command or add invalidation logic to re-derive conversation state from the .jsonl source of truth when a session's .jsonl is repaired or deleted.

Guidance

  • To mitigate the issue, consider manually deleting the corrupted conversation from the LCM database after repairing or deleting the corresponding .jsonl file, but this requires deep DB access.
  • Implementing the requested openclaw lcm repair [conversation-id] command would allow for automated repair of corrupted conversations.
  • Adding invalidation logic to mark LCM conversations for re-ingestion when a .jsonl file is modified or deleted could prevent corruption from compounding over time.
  • Exposing an openclaw lcm status [conversation-id] command would enable users to detect corruption before it cascades.

Example

No code snippet is provided as the issue does not contain sufficient technical details to generate a specific example.

Notes

The provided guidance is based on the information given in the issue and may not be a comprehensive solution. The implementation of the suggested commands or logic would require further technical details and consideration of the system's architecture.

Recommendation

Apply a workaround by manually managing the LCM database and .jsonl files until a permanent solution, such as the openclaw lcm repair command, is implemented. This is because the current system lacks self-healing logic and public repair commands, making manual intervention necessary to prevent corruption.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING