Skip to content

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

Closed

Description

@kpiq

Version: graphify 0.9.103 (pipx install graphifyy)

Summary

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)

  1. 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.
  2. The 1-node result is written to graphify-out/cache/semantic/p{fingerprint}/{hash}.json without "partial": true.
  3. 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.
  4. 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).

Analysis

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.

Activity

  1. github-actions commented on Nov 8, 2026

    @github-actions

    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.

  2. safishamsi commented on Nov 9, 2026

    @safishamsi
    Member

    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.

  3. kpiq commented on Nov 10, 2026

    @kpiq
    Author

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions