Skip to content

fix(agents): keep blank user entries during session repair instead of dropping them (#75313)#75368

Closed
w-sss wants to merge 3 commits intoopenclaw:mainfrom
w-sss:fix/75313-session-repair-blank-user
Closed

fix(agents): keep blank user entries during session repair instead of dropping them (#75313)#75368
w-sss wants to merge 3 commits intoopenclaw:mainfrom
w-sss:fix/75313-session-repair-blank-user

Conversation

@w-sss
Copy link
Copy Markdown
Contributor

@w-sss w-sss commented May 1, 2026

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 with No 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: repairUserEntryWithBlankTextContent returns { kind: "rewrite" } with BLANK_USER_FALLBACK_TEXT = "(continue)" instead of { kind: "drop" }
  • Report field renamed: droppedBlankUserMessagesrewrittenBlankUserMessages
  • Test updates: 10/10 tests pass

Impact

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels May 1, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 1, 2026

Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

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 (continue) user message instead of being dropped, and focused tests cover both blank text-block and blank string content.

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review details

Best 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:

  • amknight: Authored the merged fix(agents): trim trailing assistant turns and rewrite blank user messages in session repair #75606 follow-up that current main and the changelog identify as covering Session-file repair drops blank user-role messages, breaking strict OpenAI-compat providers (Qwen3.6 / mlx-vlm) #75313 and the same session-file repair behavior. (role: merged fix contributor; confidence: high; commits: deaa6f656758; files: src/agents/session-file-repair.ts, src/agents/session-file-repair.test.ts, CHANGELOG.md)
  • steipete: Local shallow blame for the current session repair file points at the current main proof tree under Peter Steinberger, and the prior ClawSweeper review context traces related session/replay repair history to this maintainer. (role: recent maintainer / proof-tree owner; confidence: medium; commits: 51affb81b9a5, f0a2b09df69a, 9d33da6ddf2c; files: src/agents/session-file-repair.ts, src/agents/session-file-repair.test.ts, src/agents/pi-embedded-runner/replay-history.ts)
  • openperf: Prior review context identifies this contributor on nearby Bedrock empty-assistant session-file repair and transcript hygiene documentation in the same persisted replay repair area. (role: adjacent feature contributor; confidence: medium; commits: 930d81aa41d2; files: src/agents/session-file-repair.ts, src/agents/session-file-repair.test.ts, docs/reference/transcript-hygiene.md)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session-file repair drops blank user-role messages, breaking strict OpenAI-compat providers (Qwen3.6 / mlx-vlm)

1 participant