[Bug]: OpenCode (ACP) provider creates new session instead of resuming after app/system restart #2838
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
- Connect to OpenCode as a provider (via ACP)
- Have an active conversation with context
- Either: restart the computer / quit and reopen T3 Code, or simply leave the thread idle for some time (~30+ minutes)
- Send a follow-up message in the same thread
Expected behavior#
T3 Code should call resumeSession (ACP protocol) with the previous session ID, restoring conversation context. OpenCode's ACP agent supports resumeSession and will replay the last 20 messages to restore context.
Actual behavior#
T3 Code calls newSession instead of resumeSession, creating a fresh session with no context. The AI responds with "I don't have context from a previous conversation." The old session still exists in OpenCode's database (visible in OpenCode's own UI as a separate session).
This happens both after app/system restart and after the session is reaped due to inactivity. In both cases, the next message creates a new ACP session rather than resuming the existing one.
Root cause analysis#
T3 Code's session reaping (provider.session.reaped, reason: inactivity_threshold) kills the provider connection after idle time. When the user sends a new message, T3 Code reconnects but calls newSession instead of resumeSession with the previous ACP session ID.
Looking at T3 Code's session docs, resumeCursor is persisted and used for Codex provider sessions. However, for ACP providers (like OpenCode), the session resume path doesn't appear to persist or pass the ACP session ID on reconnect.
OpenCode's ACP agent advertises sessionCapabilities: { resume: {} } in its initialize response and implements resumeSession which loads the session from SQLite and replays messages. T3 Code just needs to:
- Persist the ACP session ID (e.g.,
ses_19567fd2affe3jFlm4rRaKT5AO) - Call
resumeSession({ sessionId, cwd })instead ofnewSessionwhen reconnecting to an ACP agent after transport disconnect, inactivity reap, or app restart
Impact#
Blocks work completely — all conversation context is lost after any interruption.
Version or commit#
Latest (v0.0.28)
Environment#
macOS, OpenCode provider via ACP
Related issues#
- #2188 (same symptom but for Codex provider, closed)
- #2140 (same symptom on restart, closed as duplicate of #2121)
Workaround#
After context is lost, open the original session directly in OpenCode's own UI (where the full context is preserved) instead of continuing through T3 Code.
juliusmarminge added labelsduplicate
juliusmarminge closed this
Sign in to join this conversation.
Closing as a duplicate of #2378. Both report OpenCode losing or failing to resume its session after being idle or after restart.