Repository navigation
Replies: 2 comments
|
Confirmed — and your durable-log evidence makes this the third report of the pi-ai replay-state coherence family, with a new trigger variant that the earlier two reports didn't capture. Verified against master (47f9438): 1. The cited check is exact
2. Your variant is distinct from the earlier two
So the invariant is: replay state is a projection of the provider's 3. Fix directions (complements my #1703 reply)
4. Convergence: #1627 + #1703 + #2143 now form a complete three-trigger picture of one missing reconciliation — worth folding into a single "replay-state coherence" fix workstream (I raised the same on #1703). Your real-log evidence (provider ollama/qwen, api openai-completions) also confirms this is not DeepSeek-provider-specific — it's the pi-ai adapter layer itself. Thanks for the precise evidence — this is the missing trigger that makes the family case airtight. |
|
Follow-up with a concrete fix: branch Change: Tests: two regression tests in I attempted to open this as a pull request, but PR creation is currently refused for my account (GraphQL |
Uh oh!
There was an error while loading. Please reload this page.
Summary
When a model turn is cut off by the output-token limit while emitting tool
calls, the durable
assistant/messageand the adapter-owned pi-ai replaystate record different block lists for that turn. The next request in the
session then fails replay conversion with:
The Web UI's own recovery guidance ("The reply was cut off … Send 'continue'
to let the model resume") therefore leads to a terminal turn failure; the
session can never be continued.
Verified evidence (from a real session's durable event log)
Truncated turn's logged
assistant/message:source:{ kind: "model", provider: "ollama", model: "qwen3.8:27b" }contentblocks:[reasoning, text]— 2 blockssource.replayState:{ kind: "pi-ai", version: 1, api: "openai-completions", stopReason: "length", blocks: [reasoning, text, tool-call, tool-call] }— 4 blocksThe stream was truncated by the token limit while two
tool-callblocks werein flight. The durable message kept only the completed blocks; the replay
state kept all four. On the next turn,
replayedAssistant()compares them:packages/llm/llm-pi-ai/src/replay.ts:164if (state.blocks.length !== message.content.length) return invalidReplay('block count does not match assistant content')Root cause (as read from source)
packages/llm/llm-pi-ai/src/stream.ts:193builds the finish chunk'sreplayStateviatoPiReplayState(event.message)— pi-ai's final message,which includes tool-call blocks that were still in flight when the limit hit.
trailing blocks.
length-truncated turnwith in-flight tool calls poisons the session's replay history.
Minimal reproduction
small
maxTokens(e.g. 8192) and a reasoning model that thinks long enoughto hit the cap while emitting tool calls.
INVALID_REPLAY_STATE.Still present in the latest published
@deepseek-ai/dsh-llm-pi-ai@0.0.1-rc.1(same check, same behavior).
Suggested fix directions
message (truncate
replayState.blocksto the logged content), orconsistent, or
stopReason: "length"as recoverable:fall back to
foreignAssistant()conversion for that message instead ofthrowing.
Happy to provide the raw session event log (JSONL) showing the exact turn.
All reactions