You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unversioned semantic cache replays a degraded 1-node chunk as authoritative: shrink guard then refuses every subsequent write (no model is ever re-consulted) #5083
A degraded semantic extraction — a doc file returning only the file-level node instead of its entities — is saved to the unversioned semantic cache without a partial flag. Every later run reads it as a cache hit, so the shrink guard refuses the write and no LLM call is ever made again. The corpus becomes permanently un-updatable until an operator manually deletes the cache entry.
Reproduction (observed 2026-11-07, both on --update and on a cold rebuild)
Attempt 1 extracts README.md via LLM, chunk 1/1 done, but the response contains only the doc-level node ({"id": "readme", ...}, no table entities). The run ends with unverified semantic shrink detected for 'README.md' (prior N -> 1 nodes) — write refused, exit 1.
The 1-node result is written to graphify-out/cache/semantic/p{fingerprint}/{hash}.jsonwithout"partial": true.
Every subsequent attempt (any model, including ones that extract the same file correctly in isolation) logs semantic cache: 1 hit / 0 miss, replays the 1-node chunk, and fails in ~0.5 s. 10/10 attempts failed without a single LLM call.
Deleting the cache entry and re-running succeeds on the first attempt (fresh extraction of the same file yields ~24 nodes, guard passes, write lands).
cache.py:1136-1152 already treats three invalid producers as cache misses (corrupt JSON, partial flag, zero-node semantic results), but a plausible-looking 1-node entry passes all three and is served as authoritative forever — the cache is deliberately unversioned (documented at cache.py:1038-1043, trade-off AST cache survives graphify upgrades: content-only keys keep serving stale extractor output #1252).
Secondary: the refusal message advises --allow-partial, but when the shrink came from a cached chunk, following that advice overwrites the graph with the degraded version (destroys the god nodes) — the advice is wrong for this case.
Suggestion
Write the partial flag when a fresh semantic extraction for a source is smaller than that source's existing contribution in graph.json (or otherwise looks degraded), so load_cached's existing miss-path self-heals it.
The shrink-guard stderr message should distinguish "fresh extraction is smaller" from "a cached smaller chunk is being replayed", and point at the cache entry, not only at --allow-partial.
Workaround we implemented client-side (not a fix)
Our wrapper (graphify-with-fallback, separate project) now deletes cache entries that match graphify's own shrink signature against the baseline graph.json after each attempt. Happy to share the ~100-line implementation as a reference or PR.
Fixed in 0.9.105 (now on PyPI) via #5101: a degraded semantic cache entry is now stamped partial after the shrink guard fires, so the next run re-dispatches it instead of replaying the degraded result.
Verified on 0.9.105 that our large-corpus rebuild now surfaces the previously-blocked write instead of wedging on the poisoned cache entry. Good fix, good diagnostics, and good call shipping it in a point release rather than letting the branch sit.
Activity
github-actions commentedon Nov 8, 2026
Thanks for opening this issue, @kpiq. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.
fix(cache): stop a degraded semantic entry from pinning the corpus (#…
safishamsi commentedon Nov 9, 2026
Fixed in 0.9.105 (now on PyPI) via #5101: a degraded semantic cache entry is now stamped partial after the shrink guard fires, so the next run re-dispatches it instead of replaying the degraded result.
kpiq commentedon Nov 10, 2026
@nothariharan, @safishamsi — thanks — closing the loop today.
Verified on 0.9.105 that our large-corpus rebuild now surfaces the previously-blocked write instead of wedging on the poisoned cache entry. Good fix, good diagnostics, and good call shipping it in a point release rather than letting the branch sit.
— @kpiq