Bug Description
Tool results are intermittently not persisted to the session JSONL file. When the session is reloaded for the next API call, OpenClaw detects an orphaned tool_use without a matching tool_result and injects a synthetic error: [openclaw] missing tool result in session history; inserted synthetic error result for transcript repair.
Impact
- User sees no response after a tool call — has to ask again
- Happens on trivial tools (file reads, simple shell commands) — not tool-specific
- Occurs 3-5 times per session in active use
- Makes the assistant unreliable for any tool-dependent workflow
Environment
- OpenClaw version: 2026.2.9
- OS: macOS (Darwin 24.6.0, arm64)
- Node: v25.6.0
- Channel: Telegram
- Model: anthropic/claude-opus-4-6
Reproduction
- Have an active Telegram DM session
- Send messages that trigger tool calls (e.g.
exec, read, cron)
- Intermittently, the tool result is lost and the synthetic error appears
- No response is delivered to the user
Observations
- Happens even when no concurrent activity (no heartbeat, no cron jobs running)
- Happens on the simplest possible tool calls (e.g.
ls | wc -l)
- Frequency seems to increase with session length/activity
- Compaction mode is
safeguard with memoryFlush: enabled
- Session file is JSONL — the
tool_use line is written but the tool_result line is not persisted
Suspected Cause
The JSONL append for tool_result is not reliably flushed to disk before the session is read for the next turn. Could be:
- Missing
fsync / write not awaited before proceeding
- Stream buffering in Node.js file writer
- Race condition if compaction or another process reads the file before the write completes
Workaround
None reliable. User must re-send their message to retry.
Bug Description
Tool results are intermittently not persisted to the session JSONL file. When the session is reloaded for the next API call, OpenClaw detects an orphaned
tool_usewithout a matchingtool_resultand injects a synthetic error:[openclaw] missing tool result in session history; inserted synthetic error result for transcript repair.Impact
Environment
Reproduction
exec,read,cron)Observations
ls | wc -l)safeguardwithmemoryFlush: enabledtool_useline is written but thetool_resultline is not persistedSuspected Cause
The JSONL append for
tool_resultis not reliably flushed to disk before the session is read for the next turn. Could be:fsync/ write not awaited before proceedingWorkaround
None reliable. User must re-send their message to retry.