Preserve delivered assistant replies in session repair (#76420)

Summary:
- The PR removes session-file repair's trailing-assistant disk trim, updates regression coverage, clarifies transcript hygiene docs, and adds a changelog entry for the Telegram/WebChat history loss fix.
- Reproducibility: yes. Current main has a clear source path: a normal trailing assistant JSONL record is popped by `repairSessionFileIfNeeded`, and the main-branch test suite asserts that deletion.

Automerge notes:
- PR branch already contained follow-up commit before automerge: docs(agents): clarify session repair preservation
- PR branch already contained follow-up commit before automerge: fix(agents): preserve delivered assistant replies in session repair

Validation:
- ClawSweeper review passed for head 66c187fd76.
- Required merge gates passed before the squash merge.

Prepared head SHA: 66c187fd76
Review: https://github.com/openclaw/openclaw/pull/76420#issuecomment-4365323320

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
This commit is contained in:
Ayaan Zaidi
2026-05-03 09:34:11 +05:30
committed by GitHub
parent 6a3f5d0b1f
commit e8756d99ae
4 changed files with 23 additions and 86 deletions

View File

@@ -7,9 +7,7 @@ read_when:
title: "Transcript hygiene"
---
OpenClaw applies **provider-specific fixes** to transcripts before a run (building model context). Most of these are **in-memory** adjustments used to satisfy strict provider requirements. A separate session-file repair pass may also rewrite stored JSONL before the session is loaded, either by dropping malformed JSONL lines or by repairing persisted turns that are syntactically valid but known to be rejected by a
provider during replay. When a repair occurs, the original file is backed up alongside
the session file.
OpenClaw applies **provider-specific fixes** to transcripts before a run (building model context). Most of these are **in-memory** adjustments used to satisfy strict provider requirements. A separate session-file repair pass may also rewrite stored JSONL before the session is loaded, but only for malformed lines or persisted turns that are invalid durable records. Delivered assistant replies are preserved on disk; provider-specific assistant-prefill stripping happens only while constructing outbound payloads. When a repair occurs, the original file is backed up alongside the session file.
Scope includes: