Skip to content

fix(cache): scope semantic cache writes to extracted files#1835

Closed
TPAteeq wants to merge 1 commit into
Graphify-Labs:v8from
TPAteeq:fix/1757-semantic-cache-source-scope
Closed

fix(cache): scope semantic cache writes to extracted files#1835
TPAteeq wants to merge 1 commit into
Graphify-Labs:v8from
TPAteeq:fix/1757-semantic-cache-source-scope

Conversation

@TPAteeq

@TPAteeq TPAteeq commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add an allowed_source_files boundary to save_semantic_cache.
  • Prevent semantic results from replacing cache entries for files outside the dispatched extraction batch.
  • Apply the boundary to both native CLI extraction and every generated agent workflow.
  • Preserve out-of-scope nodes in the graph while skipping and warning about unsafe cache writes.
  • Preserve backward compatibility for callers without an allowlist.

Validation

  • 3117 passed, 30 skipped
  • ruff check passed
  • tools.skillgen --check passed
  • Monolith round-trip validation passed
  • graphify update . completed successfully

Closes #1757

@safishamsi

Copy link
Copy Markdown
Collaborator

Landed on v8 (579ba1d, your commit preserved) plus a follow-up (da9616d) — ships in 0.9.14. Thanks @TPAteeq, the allowlist design is right and the skillgen threading was clean.

One gap I fixed on top: the guard covered the final CLI write, but the per-chunk incremental checkpoint in llm.py:_checkpoint_chunk — the write that actually runs on every extract/update via extract_corpus_parallel — was still calling save_semantic_cache without an allowlist (merge_existing=True), so a stray mis-attributed node could still pollute a victim file's entry before the final write. I scoped that call to the chunk's own dispatched files and added an extract_corpus_parallel integration test proving an out-of-chunk attribution leaves the victim's cache untouched. Also hoisted the import warnings to module level. Credited your commit in the history.

@safishamsi safishamsi closed this Jul 12, 2026
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.

save_semantic_cache silently overwrites another file's legitimate cache when a subagent mis-attributes source_file to a file outside the current chunk

2 participants