Skip to content

Install CodeGraph + Semble, real competitor A/B (B10), and fix embeddings LFS incident - #17

Merged
Eilodon merged 4 commits into
mainfrom
claude/code-graph-semble-setup-cn9egz
Jul 4, 2026
Merged

Install CodeGraph + Semble, real competitor A/B (B10), and fix embeddings LFS incident#17
Eilodon merged 4 commits into
mainfrom
claude/code-graph-semble-setup-cn9egz

Conversation

@Eilodon

@Eilodon Eilodon commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Wires CodeGraph (colbymchenry, v1.2.0) into .mcp.json via npx -y @colbymchenry/codegraph serve --mcp, zero-setup parity with the existing semble entry (which was already configured/working, no changes needed there).
  • Adds B10 — Real Competitor A/B (benchmarks/b10_real_competitor_ab/): spawns real MCP servers for ci, CodeGraph, and Semble and runs the same 4 self-repo tasks used by B4/B6, measuring token cost, tool-call count, and a grep-oracle accuracy check on find_callers.
  • New shared infra: benchmarks/lib/generic_mcp_client.py (spawn-agnostic MCP stdio client, reusable beyond ci) and benchmarks/lib/competitor_tasks.yaml (same task IDs as tasks.yaml, mapped to CodeGraph/Semble tool calls).
  • Updates benchmarks/README.md (adds B9 "Scaling Curve" as its own planned row, B10 as Implemented) and docs/comparison.md (points to the real measured numbers instead of only public-docs comparison).

Key finding (B10)

On find_callers (collect_source_files), checked against a grep oracle: ci found 2/2 real callers; CodeGraph missed 1/2 — a cross-crate caller reached via a fully-qualified path (ci_core::indexer::pipeline::collect_source_files in a different crate). Semble has no call-graph concept, so that task is marked unsupported for it and excluded from the accuracy comparison (still measured for token/call cost, not hidden, per this repo's "report bad numbers honestly" policy).

Token ratios are reported but explicitly annotated as not a ranking — e.g. CodeGraph's 564x ratio on pre_edit_blast_radius reflects a terser response format (bare symbol list vs ci's source + risk assessment + is_hub + suggested_next), not better compression of the same answer. Full nuance in benchmarks/b10_real_competitor_ab/README.md.

Second commit: embeddings self-heal from an unresolved Git LFS pointer

While running B10, this session's own ci server reported embeddings_status: "failed". Root cause: this container's checkout never ran git-lfs, so the vendored default embedding model (crates/ci-core/assets/potion-code-16m/model.safetensors) was left as a ~130-byte LFS pointer stub instead of real weights — include_bytes! bakes that stub into the binary regardless, so the build "succeeds" and the failure only surfaces at runtime, permanently, with no clear diagnosis.

Fix, researched against how comparable tools (CodeGraph, Serena, model2vec-rs upstream) handle local embedding models, then adapted to ci's own constraints:

  • Embedder::load now detects an unusable vendored asset and automatically falls back to a one-time HuggingFace Hub download of the same default model (cached locally afterward), instead of failing forever. This is a functionality/reliability concern, not a privacy one — no code or repo content is ever sent anywhere; only a public static model file is fetched.
  • New semantic_search.allow_network_fallback config flag (default true) for anyone who wants semantic search to stay strictly zero-network: with it set to false, an unusable vendored asset reports the new embeddings_status: "offline_unavailable" (a known policy outcome) instead of silently attempting a network call or reporting the more generic "failed".
  • Hardened the infra that produced the incident: session-start-build-ci.sh and the documented cloud Setup Script now attempt git lfs pull before building; scripts/mcp-launcher.sh's is_binary_fresh also treats vendored assets as freshness inputs, so a fixed LFS asset invalidates a previously-built stale binary instead of being silently ignored.
  • Regression test (default_vendored_asset_is_not_an_lfs_pointer) catches this exact failure mode at test time instead of at first-run in production.

Test plan

  • codegraph init ran successfully against self-repo (83 files, 1,628 nodes, 4,423 edges)
  • benchmarks/.venv/bin/python benchmarks/b10_real_competitor_ab/run_benchmark.py runs end-to-end and produces the reported numbers
  • cargo test --release --workspace — all green (ci-core 388 passed, ci-server 96+2 passed, ci-cli builds clean)
  • Manually verified the embeddings fix end-to-end: fresh ci serve process with the rebuilt binary goes downloading → embedding → ready, and search(kind="semantic") returns correct results
  • mcp__ci__diff_impact(staged=true) run before both commits — reviewed the one genuinely high-risk-flagged symbol (EmbedStatus::as_str, 21 "callers") and confirmed 20/21 are unrelated textual name-collisions (String::as_str, etc.); the one real caller (embed_status_str) is the intended call site
  • Reviewer check: .mcp.json codegraph entry spawns cleanly in a fresh Claude Code / Cursor session

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits July 4, 2026 03:21
… (B10)

Wires CodeGraph (colbymchenry/codegraph) into .mcp.json alongside the
already-configured Semble, and adds a new benchmark (B10) that spawns real
MCP servers for ci, CodeGraph, and Semble and runs the same B4/B6 self-repo
tasks through all three — token cost, tool-call count, and a grep-oracle
accuracy check on find_callers (CodeGraph misses a cross-crate caller that
ci resolves correctly).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X83MzmbseyW5v3j9mka5Sc
…l forever

Root cause of the embeddings_status: "failed" incident: a checkout without
git-lfs installed leaves the vendored default embedding model
(crates/ci-core/assets/potion-code-16m/model.safetensors) as a ~130-byte LFS
pointer stub instead of real weights. `include_bytes!` bakes that stub into
the binary either way, so the build "succeeds" and the failure only
surfaces at runtime, permanently, with no clear diagnosis.

- Embedder::load now detects an unusable vendored asset and automatically
  falls back to a one-time HuggingFace Hub download of the same default
  model (cached locally afterward), instead of failing forever. This is a
  functionality/reliability concern, not a privacy one — no code or repo
  content is ever sent anywhere; only a public static model file is fetched.
- New semantic_search.allow_network_fallback config flag (default true) for
  anyone who wants semantic search to stay strictly zero-network: with it
  set to false, an unusable vendored asset reports the new
  embeddings_status: "offline_unavailable" (a known policy outcome) instead
  of silently attempting a network call or reporting the more generic
  "failed".
- Hardened the infra that produced the incident: session-start-build-ci.sh
  and the documented cloud Setup Script now attempt `git lfs pull` before
  building; scripts/mcp-launcher.sh's is_binary_fresh also treats vendored
  assets as freshness inputs, so a fixed LFS asset invalidates a
  previously-built stale binary instead of being silently ignored.
- Regression test (default_vendored_asset_is_not_an_lfs_pointer) catches
  this exact failure mode at test time instead of at first-run in
  production.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X83MzmbseyW5v3j9mka5Sc
@Eilodon Eilodon changed the title Install CodeGraph + Semble, add real competitor A/B benchmark (B10) Install CodeGraph + Semble, real competitor A/B (B10), and fix embeddings LFS incident Jul 4, 2026
claude added 2 commits July 4, 2026 04:53
Fixes the verify job's `cargo fmt --all -- --check` failure from the
previous commit — pure formatting, no logic change (confirmed via
diff_impact: 0 affected symbols).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X83MzmbseyW5v3j9mka5Sc
rebuild_graph's MAX_CALLEE_CANDIDATES fallback fanned out one edge to
every same-named symbol in the repo when a call's receiver type
couldn't be inferred, with no way to exclude candidates that couldn't
possibly be the real target (e.g. String::as_str()/serde_json::Value::as_str()
getting attributed to unrelated same-named enum methods). Root-caused via
a live CodeGraph-vs-ci comparison that surfaced identical caller lists
for 5 distinct as_str definitions.

Adds a sound (not heuristic) exclusion: a call site immediately `?`-tried
or `.unwrap()/.expect()`-chained can only target a candidate whose own
signature returns Option/Result — provable from the parse tree alone via
a new `looks_option_or_result_chained` check, peeling exactly one level
through `.and_then(|x| ..)` since Option/Result::and_then's signature
requires the closure to return a matching Option/Result. Candidates that
survive the filter but remain ambiguous get a new `EdgeConfidence::Ambiguous`
tier instead of masquerading as ordinary `textual` edges.

Verified against a fresh isolated build + full reindex of this repo:
crate_map.rs::from_cargo_metadata's false as_str edges are gone entirely;
remaining unresolvable fan-out is now honestly labeled `ambiguous`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X83MzmbseyW5v3j9mka5Sc
@Eilodon
Eilodon marked this pull request as ready for review July 4, 2026 07:35
@Eilodon
Eilodon merged commit 0143ad1 into main Jul 4, 2026
3 checks passed
@Eilodon
Eilodon deleted the claude/code-graph-semble-setup-cn9egz branch July 4, 2026 07:45
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.

2 participants