anomalyco / anomalyco/opencode

Snapshot cleanup fails forever and leaks tmp_pack_* after project gc prunes shared objects

Open
#46,034 2 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Aug 28, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

Description

The hourly snapshot cleanup (git gc --prune=7.days) started failing with fatal: unable to read <sha> / fatal: failed to run repack and never recovered. The snapshot repo shares the project object database via objects/info/alternates (the seed() mechanism). After running git gc (history rewrite) in the project, objects the snapshot still referenced were pruned from the project object store. Every hourly gc attempt now dies on the same missing object and leaves an orphaned tmp_pack_* (~90MB each) in objects/pack/. cleanup() logs "cleanup failed" and returns without removing anything, so the repo never recovers. My snapshot folder reached 62GB: 699 tmp_pack files, 699 identical "cleanup failed" log entries, git count-objects shows garbage: 699 / size-garbage: 61.69 GiB. This is a second failure mode of the known tmp_pack leak (#14811, #10034, #8749): those report interrupted gc; this one is a deterministic, permanent failure.

Plugins

none

OpenCode version

1.18.25

Steps to reproduce
  1. Open a project and let the snapshot seed its alternates from the project .git/objects
  2. Run git gc in the project (or rewrite history / force-push) so old objects are pruned
  3. Keep an opencode session running — the hourly snapshot cleanup fails every time
  4. Check the log for repeated "cleanup failed" and count tmp_pack_* files growing in ~/.local/share/opencode/snapshot/<hash>/objects/pack/
Screenshot and/or share link

No response

Operating System

Zorin OS 18.1 (Ubuntu 24.04 based)

Terminal

GNOME Terminal (default)

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.