[BUG] Plugin cache still creates duplicate SHA-named dirs when ~/.claude is a git repo (2.1.217) — #41043 was stale-closed, not fixed
Preflight Checklist
- [x] I have searched existing issues — #41043 reported this exact bug, but it was closed as
not_plannedby the stale bot on 2026-05-22 without a fix. This report confirms it still reproduces on 2.1.217 with additional evidence. - [x] This is a single bug report
- [x] I am using the latest version of Claude Code
Environment
- Claude Code 2.1.217, Windows 11 Pro (10.0.26200)
~/.claudeis itself a git repository (dotfiles/config management),plugins/is gitignored
What's Wrong?
Same root cause as #41043: when ~/.claude is a git repo, the plugin version computation for the official marketplace resolves to the user's config repo HEAD instead of the marketplace version, creating a duplicate SHA-named cache directory for every commit the user makes to their config repo.
Verified mechanism on 2.1.217:
~/.claude/plugins/marketplaces/claude-plugins-official/is a GCS snapshot — it contains a.gcs-shafile (real marketplace SHA, e.g.20a5a1f1a2b55b13e85dff5416613a796d089016) but no.gitdirectory.- Version detection appears to run
git rev-parse HEADin that directory. Since there is no local.git, git walks up the tree and finds~/.claude/.git, returning the user's config repo HEAD. Runninggit rev-parse HEADmanually inside the marketplace directory reproduces this 1:1 — it returns the config repo's HEAD. - Result:
installed_plugins.jsonrecordsversion/gitCommitShaequal to the user's config repo commit SHA, and a new cache version directory named after that SHA is created underplugins/cache/claude-plugins-official/<plugin>/on every marketplace refresh following a config repo commit.
Observed accumulation: 297 orphan version directories across 9 official plugins (33 versions each, directory names all verifiable as config repo commit SHAs via git cat-file -t), accumulated between 2026-07-11 and 2026-07-22.
Additional risk
Any write-mode git command the CLI runs in that marketplace directory (pull / checkout / clean / config) would operate on the user's ~/.claude repo instead. #65372 already demonstrated a marketplace auto-update rewriting .git/config of an unrelated repo — same failure class.
What Should Happen?
- When
.gcs-shaexists, use it as the version key instead of falling through to git HEAD resolution. - Any git invocation against a marketplace/cache path should be constrained (e.g.
git -C <dir> --git-dir=<dir>/.git, or setGIT_CEILING_DIRECTORIES) so it can never walk up into an unrelated parent repository. - Reopen consideration of #41043 — it was closed by the stale bot, not fixed.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗