Skip to content
TypeScript

fix(server): run OpenCode CLI commands sequentially (#10427)

Theo Browne9ab0635db6ab
diff --git a/apps/server/src/provider/opencodeRuntime.ts b/apps/server/src/provider/opencodeRuntime.ts
index 19725d9472c..ce2840f6c13 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;