Repository navigation
Description
Description
If the disk holding OpenCode's data directory (~/.local/share/opencode) fills up for a moment during a turn and a database write fails, the ACP session/prompt request never returns, even after space is freed. The client gets no error, and every new prompt in that session is refused with "Session already has an active ACP prompt" (turn.ts#L378-L384) until the user cancels or restarts. Failing the turn would be fine; the problem is that its outcome never arrives.
Why (at dae4077):
- A failed SQLite write in a durable publish becomes a defect (bus.ts#L435-L437), and subscribers are only notified after the commit (bus.ts#L473-L476). So a
SQLITE_FULLduring the turn ends the drain, and that event never reaches the client. - The turn's outcome is another durable event (execution.ts#L135-L142, session-event.ts#L244-L264), published once, right after the failure, while the disk is most likely still full. If that write fails, it is only logged (execution.ts#L62-L72) and dropped as the coordinator goes idle (run-coordinator.ts#L96-L103). Nothing retries it once space is back.
- The ACP adapter waits for that event to end the prompt (translate.ts#L226-L231), with no timeout or idle check (turn.ts#L209-L217). It also ignores every event, terminal ones included, until its prompt's
session.inbox.deliveredarrives (translate.ts#L126-L128). So if the failure comes before delivery (theexecution.startedwrite or the inbox promotion), the prompt hangs even when the failure event is written.
The unmerged branch fix/disk-full-session-recovery (96871b8, e7d4987) adds storage retries in core, which looks like it covers point 2 for most outages. It is not on dev, though, and it does not change point 3.
Possible fix on the ACP side: also end the turn when the session goes idle (session.wait resolves through awaitIdle even when the outcome event was lost, session.ts#L278-L281). If the prompt was never delivered by then, report the session.execution.failed seen before delivery, as opencode run does (noninteractive.ts#L253-L256, #L761-L763).
Plugins
No response
OpenCode version
2.1.4 (analysed on dev at dae4077, 2026-10-27; the same lifecycle and ACP code is in the v2.1.4 tag)
Steps to reproduce
No script attached. The conditions are the ones in the description: OpenCode used through ACP (opencode acp), and the filesystem holding ~/.local/share/opencode runs out of space while a turn is running (SQLite returns SQLITE_FULL), then has space again a few seconds later.
Expected: the prompt ends, with an error if the turn failed.
Actual: session/prompt stays pending after space is back, until session/cancel or a restart.
Screenshot
No response
Operating System
Linux (the code path is not OS-specific)
Terminal
Not applicable (OpenCode used through an ACP client)
Activity
opencodejr commentedon Oct 29, 2026
Thanks for the detailed analysis. I was able to reproduce this on the latest
dev(c5d9c30) by injectingSQLITE_FULLinto durable event writes, withopencode acpdriven over JSON-RPC against a mock provider:session.execution.failedis lost too (the log showsFailed to publish Session execution lifecycle).session/promptwas still pending 30 s later, and the next prompt was refused withSession already has an active ACP prompt.session.execution.startedwrite fails, for 3 s. The prompt also never resolved and the session stayed locked.One difference from the report: with a real full disk on 2.1.4 (data dir on a small tmpfs filled to
ENOSPC), I didn't get a hang. The turn either completed orsession/promptreturnedInternal error: Failed to execute statement, because the small failure event still fit in SQLite's existing WAL. The hang shows up when that outcome write also fails, or when the failure hits before the prompt is delivered, as you described.The script below reproduces it. It includes the small test-only patch to
packages/core/src/bus.tsthat it needs. Related: #53704 (core storage-retry PR) and #52796 (tool stuck pending onSQLITE_FULL).Reproduction script (inject.ts)
Run it:
bun inject.ts