Skip to content

Commit 0f0b3bf

Browse files
committed
fix(sandbox): scope data volume per workspace to prevent SQLite contention
Sessions, snapshots, logs, and the SQLite database in ~/.local/share/opencode are all project-specific. Sharing a single opencode-data volume across workspaces risks WAL-mode write contention when multiple containers run concurrently, and causes session bleed between unrelated projects. Scoping the volume name to the sanitized workspace directory name isolates each project's data cleanly.
1 parent bd52a2f commit 0f0b3bf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

bin/opencode-sandbox

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,9 @@ done
272272
# Persistent state volume (theme, model selection, prompt history)
273273
VOLUME_FLAGS+=(-v "opencode-state:/home/opencode/.local/state/opencode")
274274

275-
# Persistent data volume (sessions, auth, snapshots)
276-
VOLUME_FLAGS+=(-v "opencode-data:/home/opencode/.local/share/opencode")
275+
# Persistent data volume (sessions, snapshots, logs — scoped per workspace to
276+
# avoid SQLite WAL contention and session bleed between unrelated projects)
277+
VOLUME_FLAGS+=(-v "opencode-data-${WORKSPACE_NAME}:/home/opencode/.local/share/opencode")
277278

278279
# ---------------------------------------------------------------------------
279280
# Run

0 commit comments

Comments
 (0)