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
Silent stream truncation persisted as complete response + TUI desync after mid-stream provider errors #44210
TUI responses get cut off mid-generation: mid-text, mid-reasoning, or before/during tool calls. UI stays blocked until I manually type "resume". Happens dozens of times per day.
Dug through ~/.local/share/opencode/log/opencode.log and SQLite storage (opencode.db). Provider fails in two ways; opencode's handling leaves the user stuck in both.
Failure mode 1: loud stream errors, then TUI desync
level=ERROR message="stream error" providerID=opencode modelID=x-preview-f-free
error.error="AI_APICallError: Upstream request failed: Endpoint is unavailable."
error.error="AI_APICallError: Service Unavailable"
Errors are logged and sometimes auto-retried (~3s retry observed). That part works. But in one incident the backend retried, completed every loop step, logged clean exiting loop, while the TUI stayed locked on a spinner for ~40 minutes (log silent between 15:36:47Z and 16:15:31Z, until I nudged it). The recovered response never rendered client-side either.
So: mid-stream error + successful server-side retry = TUI can stay desynced permanently even though the backend finished.
Failure mode 2: silent truncation persisted as complete response
Provider closes the SSE stream early, no error event. AI SDK seems to treat end-of-stream as normal completion. opencode then:
persists partial text to storage
logs nothing
exits the loop cleanly
Evidence from 2026-08-22:
UTC
Event
16:20:50
stream starts (x-preview-f-free)
16:21:24.820
partial text part written to DB
16:21:24.862
exiting loop, 42 ms later
(none)
no ERROR or WARN logged
Stored part ends mid-word:
part msg_02a466164001QEP4TCIt5B1QXx (session ses_fd5f975f3ffeGcbaIQY7uioPOj)
type=text, 1448 chars
tail: "...## Cosa fare\n\n- **Subito**: `/models` per passare a un modello stabile nelle"
No error reaches the user here either. Response stops mid-sentence; backend considers the turn complete; nothing gets retried. This is why the failures are invisible.
Expected behavior
Detect incomplete generations (stream ends without a proper finish): show an error or retry instead of silently saving partial output.
After error + successful auto-retry: unlock the TUI and render the completed response instead of staying stuck.
Environment
opencode version: 1.18.18
Platform: Windows 11, PowerShell 7.6 (pwsh), TUI
Model/provider: opencode / x-preview-f-free
Incidents date: 2026-08-22 (8x "Endpoint is unavailable", 3x "Service Unavailable", multiple silent truncations across several sessions)
Please review these issues and add any unique details from your report as comments there if they add new information. If your report covers distinct aspects not addressed in those issues, a maintainer can clarify.
Activity
github-actions commentedon Aug 22, 2026
This issue might be a duplicate of existing issues. Please check:
opencodeproviderPlease review these issues and add any unique details from your report as comments there if they add new information. If your report covers distinct aspects not addressed in those issues, a maintainer can clarify.
federico-fabiani commentedon Aug 22, 2026
Consolidated into #44044 (evidence posted there). See also #38747, #32366, #40146.
fix(stream): surface upstream truncation honestly + retry dead-empty …
fix(stream): surface upstream truncation honestly + retry dead-empty …