Skip to content

Commit 456c8cd

Browse files
committed
GH#17549: fix concurrent worker deaths — DB archival + dispatch stagger
Root cause: OpenCode's session DB (11.4 GB, 1.86M parts) uses busy_timeout=0. When 8+ workers write simultaneously, SQLITE_BUSY kills sessions silently mid-turn. Affects both Anthropic and OpenAI. Two fixes: 1. opencode-db-archive.sh: Archives sessions >14 days to a separate archive DB, keeping the active DB small for reduced write contention. Processes in batches of 500 with a time budget (--max-duration-seconds) for pulse pre-flight integration. Protects active worker sessions. 2. Dispatch stagger: Increases inter-dispatch delay from 2s to 8s (PULSE_DISPATCH_STAGGER_SECONDS) so workers don't all hit the DB at the same instant. Configurable via env var. Upstream issue filed: anomalyco/opencode#21215 (busy_timeout=0)
1 parent bad3f60 commit 456c8cd

2 files changed

Lines changed: 608 additions & 1 deletion

File tree

0 commit comments

Comments
 (0)