Skip to content

fix: global concurrency cap for hook-triggered indexers - #160

Open
rajkumarsakthivel wants to merge 4 commits into
mainfrom
fix/hook-concurrency-cap
Open

fix: global concurrency cap for hook-triggered indexers#160
rajkumarsakthivel wants to merge 4 commits into
mainfrom
fix/hook-concurrency-cap

Conversation

@rajkumarsakthivel

Copy link
Copy Markdown
Member

Summary

Fixes #159. Git hooks fire in all worktrees (shared .git/hooks/), and the old hook spawned unbounded background indexers. With N worktrees this produced N detached cce index processes.

  • Global machine-wide lock via mkdir (POSIX portable, works on macOS without flock). At most one hook-triggered indexer runs at a time. Stale locks are reclaimed when the owner PID is dead.
  • Skip ephemeral worktree paths (/tmp/*, .claude/worktrees/*) since agent-created throwaway trees are deleted minutes later.
  • nice -n 10 so indexing never competes with foreground work.
  • Worktree-aware hook install: install_hooks() resolves through git rev-parse --git-common-dir so hooks install correctly from inside a worktree.
  • Upgrade path: cce init replaces old single-line hook blocks with the new guarded version instead of silently skipping when the marker is present.
  • Uninstall: handles multi-line hook blocks via start/end markers, backward-compatible with old single-line format.

Warm zinc-black palette, indigo accents, Inter+Outfit typography.
Massive 94% number as hero focal point, trust-strip with editor logos,
vertical numbered capabilities, horizontal benchmark stats, and
comparison table with green "Best" pill.
Git hooks installed by CCE fire in all worktrees (shared .git/hooks/),
and the old hook spawned unbounded background indexers. With N worktrees
this produced N detached cce-index processes (observed: 36 at ~1.85GB
each, ~66GB total on a 96GB machine).

Three changes:
- Global machine-wide lock via mkdir (POSIX portable, works on macOS
  without flock). At most one hook-triggered indexer runs at a time.
- Skip ephemeral worktree paths (/tmp/*, .claude/worktrees/*) since
  those trees are deleted minutes later.
- nice -n 10 so indexing never competes with foreground work.

Also fixes:
- install_hooks() now resolves through git common dir so hooks install
  correctly from inside a worktree.
- cce init/upgrade replaces old hook blocks with the new guarded version
  instead of silently skipping when the marker is present.
- Uninstall handles multi-line hook blocks (start/end markers).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git hooks fire for every worktree with no concurrency cap — 36 detached indexers, ~66GB RAM, host unusable

1 participant