openclaw - 💡(How to fix) Fix [Bug] transcript repair inserts 'missing tool result' after LCM compaction [1 comments, 2 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#74222Fetched 2026-04-30 06:27:08
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Author
Timeline (top)
closed ×1commented ×1cross-referenced ×1

Error Message

Summary: After LCM (Lossless Context Management) compaction, the session transcript repair logic inserts synthetic error messages: [openclaw] missing tool result in session history; inserted synthetic error result for transcript repair.

  • When a tool call exists in an assistant message but its corresponding tool result has been compacted away, the repair logic inserts a synthetic error
  1. Transcript repair sees orphan tool calls → inserts error messages Option A: In transcript repair, detect if tool result was compacted (check LCM summaries) instead of inserting error Option C: Add config option to disable synthetic error insertion (missingToolResultText: null) Impact: Cosmetic but confusing - execution succeeds but UI shows error messages

Root Cause

Root Cause:

  • File: session-transcript-repair-D9T_omS-.js → function repairToolUseResultPairing
  • When a tool call exists in an assistant message but its corresponding tool result has been compacted away, the repair logic inserts a synthetic error
  • LCM compaction removes tool results from the buffer but keeps tool calls
  • recentTurnsPreserve: 10 (default) is insufficient for long sessions with many tool calls

Fix Action

Fix / Workaround

Current Workaround: Increase agents.defaults.compaction.recentTurnsPreserve to 25+ and use mode: "safeguard" - but this is config-level workaround, not a fix.

RAW_BUFFERClick to expand / collapse

Bug Report

Summary: After LCM (Lossless Context Management) compaction, the session transcript repair logic inserts synthetic error messages: [openclaw] missing tool result in session history; inserted synthetic error result for transcript repair.

Root Cause:

  • File: session-transcript-repair-D9T_omS-.js → function repairToolUseResultPairing
  • When a tool call exists in an assistant message but its corresponding tool result has been compacted away, the repair logic inserts a synthetic error
  • LCM compaction removes tool results from the buffer but keeps tool calls
  • recentTurnsPreserve: 10 (default) is insufficient for long sessions with many tool calls

Steps to Reproduce:

  1. Start a long session (100+ messages with many tool calls)
  2. Let LCM compaction run (triggered by context window limits)
  3. Tool results get compacted, tool calls remain
  4. Transcript repair sees orphan tool calls → inserts error messages

Current Workaround: Increase agents.defaults.compaction.recentTurnsPreserve to 25+ and use mode: "safeguard" - but this is config-level workaround, not a fix.

Suggested Fix: Option A: In transcript repair, detect if tool result was compacted (check LCM summaries) instead of inserting error Option B: Preserve tool result/tool call pairs together during compaction Option C: Add config option to disable synthetic error insertion (missingToolResultText: null)

Environment:

  • OpenClaw version: 2026.4.26
  • Context engine: lossless-claw
  • Session length: 119 messages
  • Model: glm-5:cloud

Impact: Cosmetic but confusing - execution succeeds but UI shows error messages

extent analysis

TL;DR

Increase recentTurnsPreserve to 25+ and set mode to "safeguard" as a temporary workaround to reduce synthetic error messages.

Guidance

  • Review the session-transcript-repair-D9T_omS-.js file, specifically the repairToolUseResultPairing function, to understand how synthetic error messages are inserted.
  • Consider implementing one of the suggested fixes: detecting compacted tool results, preserving tool result/tool call pairs, or adding a config option to disable synthetic error insertion.
  • Verify the effectiveness of any changes by testing with long sessions (100+ messages) and many tool calls.
  • Monitor the impact of increased recentTurnsPreserve values on performance and adjust as needed.

Example

No code snippet is provided as the issue does not contain sufficient code details.

Notes

The provided workaround is config-level and may not be a permanent solution. The suggested fixes require further implementation and testing.

Recommendation

Apply the workaround by increasing recentTurnsPreserve to 25+ and setting mode to "safeguard", as it is a relatively safe and easy change to implement while a more permanent solution is developed.

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