invalid pi-ai replay state: block count does not match assistant content after truncated output + continue #1703
Replies: 2 comments
|
Your reproduction adds the missing trigger to a mechanism that was already diagnosed on #1627 (same error, denial123789 traced it). I verified the full chain against current master (47f9438) — your "possible cause" is exactly right, and the failure point is one function. 1. The mechanism, end to end
So the truncation alone does not corrupt; the continue action does — it mutates durable content that the replay state assumed immutable. 2. Why the divergence is structural, not a one-off bug
3. Fix directions
4. Classification note This is not a session-log corruption (the durable log is intact — the content is fine, the metadata is stale). It belongs to the same class as #1627 and my #1593 serializer-family work: durable content and its side-channel metadata can diverge, and the adapter hard-fails instead of degrading. Worth folding into one "replay-state coherence" workstream with #1627. Thanks for the precise repro — the continue trigger was the missing half of the picture. |
|
Thanks for the detailed diagnosis — this matches exactly what we saw with the A quick practical note for anyone hitting this before the fix lands:
Happy to help test a patch if you open a PR for the “drop/re-project replay state on continue” fix. |
Uh oh!
There was an error while loading. Please reload this page.
Description
When a pi-ai-backed model response is truncated by
max_tokens(stopReasonlength), the UI shows “已达到输出 token 上限回答被截断”. If the user then sends “继续” to continue the truncated assistant message, the next request fails with:Environment
bootstrapMaxTokens: 1024(later raised to 16384)Steps to reproduce
maxTokenscap (e.g. 1024).run_codeprogram).invalid pi-ai replay state: block count does not match assistant content.Expected behavior
After a truncated assistant message, “继续” should resume cleanly, or the replay state should be discarded/rebuilt so the conversation can continue.
Actual behavior
The turn fails with an
INVALID_REPLAY_STATEerror and the conversation cannot continue from that truncated message.Possible cause
toPiReplayStatestoresblocksfrom the pi-aidonemessage even whenstopReasonislength. When the harness later continues/edits the truncated assistant content, the durable assistant content block count no longer matches the saved replay state blocks, soreplayedAssistantrejects withblock count does not match assistant content.Workaround
Related
@deepseek-ai/dsh-llm-pi-ai:replayedAssistantchecksstate.blocks.length !== message.content.length.All reactions