You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Empty/truncated LLM responses persisted as successful completions #3
A truncated/empty/aborted response (connection died mid-turn, upstream stream ended without a finish frame, API returned an unexpected shape) is persisted as a successful assistant message and the prompt returns status: "completed" (crates/server/src/handler/session.rs:271-279).
This mirrors upstream anomalyco/opencode#40061 (closes #39968): when an SSE connection dies without a finish frame, the AI SDK synthesizes finishReason "other"/undefined which opencode mapped to benign "unknown", so truncated output was persisted as success and opencode run exited 0. Upstream now maps "other"/undefined → "error" and fails the turn while keeping partial output.
Impact
Silent data loss: user believes the model answered; content is empty/partial with no signal.
Breaks automation/exit-code semantics ("run completed" when it didn't).
Spec / Acceptance criteria
Provider complete() validates the response shape before returning Ok:
Anthropic: require content array with a text block; empty content → Err("empty completion").
OpenAI-compatible: require choices[0].message.content non-empty; also honor choices[0].finish_reason — map length/content_filter/missing to an error (or explicit flag).
Session handler distinguishes "completed" vs "error": on Err, respond status: "error" with the message (keep any partial content in the session as-is, but do not mark the turn completed).
Test: stub a provider returning {"choices":[{"message":{"content":""},"finish_reason":"stop"}]} → prompt fails with a clear error, not "completed".
Activity
fix: LLM timeouts, model ref parsing, and response validation
grave0x commentedon Aug 1, 2026
Fixed in de68bbe (crates/llm, crates/server). Build + workspace tests pass (25 tests).
docs(roadmap): mark completed features green