From 9ab0635db6abb1abf15e664141a0f8b6f0c33eae Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Sun, 6 Sep 2026 17:02:29 -0700 Subject: [PATCH] fix(server): run OpenCode CLI commands sequentially (#10427) Co-authored-by: Claude Fable 5.1 --- apps/server/src/provider/opencodeRuntime.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/server/src/provider/opencodeRuntime.ts b/apps/server/src/provider/opencodeRuntime.ts index 19725d9472cab0bb9c3fa8948e33aadfc433a1b1..ce2840f6c13d5e85b1a4fcfb9469b6cb3c7b6947 100644 --- a/apps/server/src/provider/opencodeRuntime.ts +++ b/apps/server/src/provider/opencodeRuntime.ts @@ -945,10 +945,11 @@ const makeOpenCodeRuntime = Effect.gen(function* () { ...commandContext, }).pipe(Effect.exit); - // First attempt — run all inventory commands in parallel. + // Every OpenCode CLI command opens the same shared SQLite database. Running them + // concurrently causes "database is locked" failures, so run them one at a time. const [initialModelsResult, initialAgentsResult, initialSkillsResult] = yield* Effect.all( [runModelsCli(), runAgentsCli(), runSkillsCli()], - { concurrency: "unbounded" }, + { concurrency: 1 }, ); let modelsResult = initialModelsResult; let agentsResult = initialAgentsResult; @@ -966,7 +967,7 @@ const makeOpenCodeRuntime = Effect.gen(function* () { needsAgentsRetry ? runAgentsCli() : Effect.succeed(agentsResult), needsSkillsRetry ? runSkillsCli() : Effect.succeed(skillsResult), ], - { concurrency: "unbounded" }, + { concurrency: 1 }, ); modelsResult = m2; agentsResult = a2; -- 2.54.0