fix(agents): keep blank user entries during session repair instead of dropping them (#75313)#75368
fix(agents): keep blank user entries during session repair instead of dropping them (#75313)#75368w-sss wants to merge 3 commits intoopenclaw:mainfrom
Conversation
|
Thanks for the context here. I did a careful shell check against current Close: current main already implements the intended session-file repair behavior through the merged #75606 follow-up. The central user problem is solved on main because blank persisted user entries are rewritten to a non-empty So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Close this PR as superseded by current main, keep the merged #75606 session-repair implementation, and track any remaining pre-compaction flush behavior separately under #75305 if it still reproduces. Do we have a high-confidence way to reproduce the issue? Yes. #75313 provides a concrete persisted-session JSONL reproduction, and current main has focused unit fixtures that verify blank user rows are rewritten and retained during session-file repair. Is this the best way to solve the issue? Yes for the code direction, but merging this exact branch is no longer the best next step because #75606 already landed the behavior on main with additional trailing-assistant repair coverage. Security review: Security review cleared: The PR diff only changes TypeScript session repair logic, colocated tests, and changelog text, with no dependency, workflow, package, secret, download, or release-script changes. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 51affb81b9a5; fix evidence: commit 51affb81b9a5, main fix timestamp 2026-05-01T16:46:53+01:00. |
Summary
Fixes #75313. Session repair previously dropped blank user-role entries entirely, which could leave a session with no user role at all (e.g.
[system, assistant, assistant, …]). Strict OpenAI-compatible chat templates (Qwen3.6, mlx-vlm, etc.) reject such message arrays withNo user query found in messages.→ HTTP 500.Fix
Instead of
{ kind: "drop" }, blank user entries are now rewritten with a synthetic"(continue)"text placeholder, preserving the user role in the session transcript.Changes
src/agents/session-file-repair.ts:repairUserEntryWithBlankTextContentreturns{ kind: "rewrite" }withBLANK_USER_FALLBACK_TEXT = "(continue)"instead of{ kind: "drop" }droppedBlankUserMessages→rewrittenBlankUserMessagesImpact
repairSessionFileIfNeeded(compaction, session resume)