[BUG] Desktop app runs `git maintenance --task=loose-objects` on repos with Claude worktrees; resulting `loose-*` packs break Sublime Merge

Status Open
Reported on v2.1.286
Maintainer reply None cached
Activity 0 comments · opened Oct 3, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Environment

  • Windows 11, Claude desktop app (Code tab, sessions using worktrees under .claude/worktrees/)
  • Git for Windows 2.43.0
  • Sublime Merge build 2091 (bundled git 2.39.1)

What happens

Every ~30 minutes, rotating across the repositories where the app has worktrees under
.claude/worktrees/, a process runs:

git.exe -c core.hooksPath=\\.\NUL -c safe.directory=* -c core.fsmonitor=false
-c branch.autoSetupMerge=false -c gc.auto=0 -c maintenance.auto=false ...
maintenance run --auto --task=loose-objects --task=incremental-repack

When a repo has ≥100 loose objects (the default maintenance.loose-objects.auto), the
loose-objects task writes a pack named .git/objects/pack/loose-<hash>.pack (+ .idx, .rev).

What Should Happen?

Expected

Don't run repository maintenance on user repositories without opt-in (or at least make it
configurable and documented), since it changes the on-disk object layout that other git
clients rely on.

Error Messages/Logs

Steps to Reproduce

Evidence

  • I enabled a global trace2 event log (trace2.eventTarget) for 3 days (Oct 1–3, 5,636 git processes).
  • 15 invocations of the command above, only on the 3 repos that have .claude/worktrees/.

None of the other 13 repos with git activity in the log received it.

  • 3,816 git processes used the same flag set (core.hooksPath=\\.\NUL, safe.directory=*, …),

2,444 of them run inside a .claude/worktrees/<worktree> directory — i.e. the app's worktree management.

  • Nothing else on the machine configures maintenance: no maintenance.* config, no

git maintenance start, no git scheduled tasks. Sublime Merge's own git (2.39.1) never ran maintenance.

  • Two loose-* packs were created on 2026-09-28 (17:29:23 and 18:28:23 UTC), in two of those repos.
  • Anonymized trace2 excerpt attached (repository paths replaced; full log withheld because it

contains local paths).

Impact

Git itself is fine (git fsck and git status clean), but Sublime Merge does not read objects
stored in loose-* packs. Trees stored there look missing from HEAD, so Sublime Merge shows
phantom "staged" files with <diff disabled - couldn't load diff object …>. It's sporadic
(only when the 100-loose-objects threshold is crossed), which made it look like my own git
commits/pushes were corrupting the repo.

Workaround

  • Fix an affected repo: git -c pack.writeReverseIndex=false repack -a -d
  • Prevent it: git config --global maintenance.loose-objects.auto 0 and

git config --global maintenance.incremental-repack.auto 0
(the app overrides gc.auto and maintenance.auto on the command line, but not these).

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Don't know the version, but this wasn't happening a week ago or more. I suspect the changes to the worktree cleanup may have caused this.

Claude Code Version

2.1.286

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Caveat

trace2 didn't record process ancestry on Windows, so attributing the caller to the desktop app
is inferred from the flag family and the fact that it only targets repos with Claude worktrees.

trace2-excerpt-anon.md

View original on GitHub ↗