Summary
Branch.head_sha in the graph does not update when re-indexing an already-existing project. It stays frozen at whatever commit was HEAD when the project was first created, even though the graph content itself (nodes/edges) updates correctly on re-index.
Environment
- cbm v0.9.0, linux-amd64 release, SHA-256 verified against
checksums.txt
- Invoked directly via
cli (no MCP server auto-install), isolated CBM_CACHE_DIR/CBM_ALLOWED_ROOT against a throwaway git repo
Repro (~5 commands)
-
Fresh index at commit A:
cli index_repository --repo-path <repo> --name smoketest
→ MATCH (b:Branch) RETURN b.head_sha = A. Correct.
-
Advance HEAD to commit B (real commit, e.g. adding a function). Re-index the same project (default mode):
cli index_repository --repo-path <repo> --name smoketest
→ graph content updates correctly (node/edge counts increase, new function present in the graph).
→ Branch.head_sha still reads A — unchanged.
-
Advance HEAD to commit C. Re-index explicitly with --mode full:
→ graph content updates again correctly.
→ Branch.head_sha now reads B — one commit behind the re-index that caused it, not C.
-
Control: delete_project then fresh index_repository (no prior project) at current HEAD:
→ Branch.head_sha correctly matches current HEAD immediately.
So the bug is specific to re-indexing an existing project — both default and --mode full — not to indexing itself.
Why this matters
Branch.head_sha (and index_status, which we separately confirmed reads live git HEAD rather than indexed-state — always "fresh," not useful either) are the two natural surfaces for a caller to answer "is the index actually caught up with the repo?" Neither gives a trustworthy answer in the normal long-lived-project + incremental-watcher-reindex scenario. A caller trusting Branch.head_sha as a freshness signal would see staleness silently understated forever after the first index, even while the watcher is correctly doing its job content-wise.
Suggested area to look
Whatever code path updates the Branch node's head_sha property likely only runs on project creation, not on the re-index/update path that touches node/edge content.
Summary
Branch.head_shain the graph does not update when re-indexing an already-existing project. It stays frozen at whatever commit was HEAD when the project was first created, even though the graph content itself (nodes/edges) updates correctly on re-index.Environment
checksums.txtcli(no MCP server auto-install), isolatedCBM_CACHE_DIR/CBM_ALLOWED_ROOTagainst a throwaway git repoRepro (~5 commands)
Fresh index at commit A:
cli index_repository --repo-path <repo> --name smoketest→
MATCH (b:Branch) RETURN b.head_sha=A. Correct.Advance HEAD to commit B (real commit, e.g. adding a function). Re-index the same project (default mode):
cli index_repository --repo-path <repo> --name smoketest→ graph content updates correctly (node/edge counts increase, new function present in the graph).
→
Branch.head_shastill readsA— unchanged.Advance HEAD to commit C. Re-index explicitly with
--mode full:→ graph content updates again correctly.
→
Branch.head_shanow readsB— one commit behind the re-index that caused it, notC.Control:
delete_projectthen freshindex_repository(no prior project) at current HEAD:→
Branch.head_shacorrectly matches current HEAD immediately.So the bug is specific to re-indexing an existing project — both default and
--mode full— not to indexing itself.Why this matters
Branch.head_sha(andindex_status, which we separately confirmed reads live git HEAD rather than indexed-state — always "fresh," not useful either) are the two natural surfaces for a caller to answer "is the index actually caught up with the repo?" Neither gives a trustworthy answer in the normal long-lived-project + incremental-watcher-reindex scenario. A caller trustingBranch.head_shaas a freshness signal would see staleness silently understated forever after the first index, even while the watcher is correctly doing its job content-wise.Suggested area to look
Whatever code path updates the
Branchnode'shead_shaproperty likely only runs on project creation, not on the re-index/update path that touches node/edge content.