Skip to content

fix(llm): unwrap FileSlice via unit_path in the checkpoint allowlist (#1870)#1882

Open
HerenderKumar wants to merge 1 commit into
Graphify-Labs:v8from
HerenderKumar:checkpoint-slice-allowlist
Open

fix(llm): unwrap FileSlice via unit_path in the checkpoint allowlist (#1870)#1882
HerenderKumar wants to merge 1 commit into
Graphify-Labs:v8from
HerenderKumar:checkpoint-slice-allowlist

Conversation

@HerenderKumar

Copy link
Copy Markdown

Fixes #1870

_checkpoint_chunk resolved each unit's source file with getattr(item, "rel", None) or item, but FileSlice carries its file in .path — it has no .rel — so for every sliced document the FileSlice object itself leaked into allowed_source_files. save_semantic_cache then raised on Path(FileSlice), the best-effort guard downgraded that to the incremental cache checkpoint failed warning, and every chunk containing a slice silently lost its checkpoint — so a resumed run re-billed those chunks instead of reusing the cache.

  • llm.py: build the allowlist with unit_path(...)file_slice.py's canonical unwrap (parent Path for a slice, bare Path unchanged), already imported and used elsewhere in the module — and fix the stale .rel comment
  • tests/test_chunking.py: regression test that drives extract_corpus_parallel over a corpus whose document slices into 7 units and asserts the checkpoint fires with real paths; on current v8 it fails with the exact FileSlice leak from the report

Since a slice's .path is the same value the file would have had as a bare Path, the allowlist entries for sliced files now match unsliced behavior exactly.

…raphify-Labs#1870)

_checkpoint_chunk built allowed_source_files with getattr(item, "rel",
None) or item — but FileSlice carries its file in .path, not .rel, so
every sliced document leaked the FileSlice object itself into the list.
save_semantic_cache then raised on Path(FileSlice), the best-effort
guard swallowed it, and every chunk containing a slice silently skipped
its incremental checkpoint — a resumed run re-billed those chunks
instead of reusing the cache. Build the allowlist with unit_path, which
exists for exactly this unwrap, and pin the contract with a test that
drives extract_corpus_parallel over a corpus with a sliced document.
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.

Incremental semantic cache checkpoint fails on sliced docs: _checkpoint_chunk reads FileSlice.rel, which does not exist

1 participant