mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-23 01:38:53 +00:00
Follow-up and main reply paths re-entered each embedded fallback candidate with the same queued transcript prompt. After the first candidate persisted that queued user message, later candidates appended it again. Failed embedded candidates could also persist an assistant error stub on each retry, leaving same-role transcript runs that downstream providers reject. The fallback callers now keep two persistence latches for one fallback run: queuedUserMessagePersistedAcrossFallback flips from onUserMessagePersisted, and assistantErrorPersistedAcrossFallback flips only after the session guard actually persists an assistant stopReason="error" message. Later candidates suppress only the entries that were already written, so CLI or otherwise non-persisting failures do not hide the first embedded error separator. Plumb the assistant-error persistence callback through the embedded runner, attempt params, and session guard wrapper. Add guard and runner regression tests for all-embedded fallback retries and CLI-to-embedded fallback. Closes #83404