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
[Bug]: Opencode server frequently disconnects / connection lost #2579
When using opencode as a provider in t3code, the connection to the opencode server frequently drops/disconnects. Sessions suddenly die with no automatic reconnection.
Root Cause (from source code analysis)
No reconnect logic - t3code spawns opencode serve as a child process. When that process crashes or exits, the session dies immediately with no auto-restart. (apps/server/src/provider/Layers/OpenCodeAdapter.ts)
SSE event stream is fragile - Real-time communication uses Server-Sent Events (long-lived HTTP streaming) with no heartbeat/keepalive mechanism.
Short startup timeout (5 seconds) - DEFAULT_OPENCODE_SERVER_TIMEOUT_MS = 5000. If the server is slow to start (e.g., due to many plugins/MCP/LSP servers), it times out.
Text generation server idle TTL of 30 seconds - OPENCODE_TEXT_GENERATION_IDLE_TTL = "30 seconds". The shared server is killed after 30 seconds of inactivity. (apps/server/src/textGeneration/OpenCodeTextGeneration.ts)
No clear error message in UI - Users only see "disconnected" without knowing the actual cause.
Environment
t3code version:
opencode version:
OS:
Steps to Reproduce
Open t3code, select opencode as provider
Start a session and use it for a while
Let it sit idle, or just let the server run
Session suddenly disconnects / connection lost
Expected Behavior
Stable connection or auto-reconnect when disconnected
Clear error messages when something goes wrong
Server should not be killed after short idle periods
Additional Context
Related issues: #2378 (t3code should resume same conversation after idle timeout)
changed the title [-][Bug]: Opencode server sering disconnect / connection lost[/-][+][Bug]: Opencode server frequently disconnects / connection lost[/+]on May 7, 2026
Closing as a duplicate of #2644, which is the canonical OpenCode disconnect/SSE-lifecycle report. PR #2908 previously attempted the shared fix but closed unmerged; there is currently no active superseding PR, so future implementation should stay attached to #2644.
Activity
[-][Bug]: Opencode server sering disconnect / connection lost[/-][+][Bug]: Opencode server frequently disconnects / connection lost[/+]juliusmarminge commentedon Jul 20, 2026
Closing as a duplicate of #2644, which is the canonical OpenCode disconnect/SSE-lifecycle report. PR #2908 previously attempted the shared fix but closed unmerged; there is currently no active superseding PR, so future implementation should stay attached to #2644.