anomalyco / anomalyco/opencode

Concurrent runs can fail on shared snapshot gc.pid.lock

Open
#49,190 2 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Sep 15, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Bug

OpenCode 1.18.30 can fail a concurrent opencode run because snapshot cleanup races on the shared global Git snapshot repository.

Observed on macOS during a real long-running soak with one project and multiple concurrent opencode run --auto processes:

cleanup failed exitCode=128
fatal: Unable to create `/Users/abu/.local/share/opencode/snapshot/global/<snapshot>/gc.pid.lock`: File exists.
Another git process seems to be running in repository, or lock file may be stale

The Memory V1 backend remained healthy during the same run: 17 real sessions, 790 native sources, 302 tool starts, 0 failed memory jobs, 0 pending jobs. One OpenCode process exited non-zero due to the snapshot lock contention.

Expected

Concurrent sessions should serialize snapshot GC, retry lock contention, or treat a competing cleanup as non-fatal without failing the user session.

Reproduction

  1. Use one OpenCode project/worktree.
  2. Start two or more opencode run --auto processes concurrently.
  3. Let them perform normal read/tool work so snapshot tracking and cleanup run.
  4. Observe cleanup failed and occasional non-zero session exit.

Tracking report in the affected integration: https://github.com/Abuarchiv/agent-memory-v1/issues/1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.