Repository navigation
Conversation
…as complete A chunk whose LLM response is truncated (`finish_reason="length"`) and can't be recovered by splitting, or that hits the adaptive-retry depth cap, returns a partial node set. Today that set is checkpointed and written to the content-hash semantic cache + manifest-stamped as complete, so the incomplete nodes are served forever until the file content changes or `--force`. Truncated give-up results are now tagged with an internal `_partial` marker. `save_semantic_cache` stamps the affected file's entry `partial: True` (detected from the marker or an explicit `partial_source_files` arg), and `load_cached` treats a partial entry as a cache MISS, so the file re-dispatches and retries. The file is also left unstamped in the manifest (like a failed chunk, #933) so detect_incremental re-queues it on the next incremental run — not only on a full / `--force` / content-change run. A file sliced across chunks accumulates via a partial-aware `merge_existing` peek (`load_cached(allow_partial=True)`) so a truncated slice is never dropped or silently promoted to complete. Self-heals: a later complete extraction overwrites the same key with a non-partial entry. The marker is stripped after the final save so it never leaks into graph.json.
safishamsi
added a commit
that referenced
this pull request
Jul 16, 2026
…#1950) The _partial item-marker approach couldn't fire on the most common truncation shape: a mid-JSON cut parses to zero items, so a sliced document whose second slice truncated empty was still stamped complete (the PR's own headline case). - The adaptive-retry give-up sites now record the chunk's own source files in a result-level _partial_files list, independent of parsed items; it propagates through _merge_two / the recursion merges / _merge_into so it reaches both the per-chunk checkpoint and the run-level manifest stamp. - _partial_source_files unions _partial_files with the item markers. - save_semantic_cache seeds an empty group for a named partial file with no items so its entry is stamped partial, and carries a partial prev entry's flag forward so a later clean slice merging over it can't re-promote it to complete. - the CLI final save now passes partial_source_files (computed before the save) so an empty-parse file isn't written back as a complete entry. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Member
|
Landed on v8 (ships in 0.9.18), cherry-picked to preserve your authorship. Thanks @TPAteeq — truncated chunks are no longer cached/stamped as complete. Follow-up added for the empty-parse case: a mid-JSON cut parses to zero items, so the give-up sites now record the chunk own files independently of parsed items (propagated through the merges), the cache stamps a partial file even with no items, and a later clean slice cannot re-promote a partial entry. That closes the sliced-document scenario end to end. |
safishamsi
added a commit
that referenced
this pull request
Jul 17, 2026
…is cleared) Follow-up to #1956: a doc stamped complete on a prior run that truncates (partial) this run must have its stale semantic_hash cleared so it is re-queued. Partial files are dropped by _stamped_manifest_files and therefore land in clear_semantic — pin that composed behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
PerryLin-0420
pushed a commit
to PerryLin-0420/graphify-decouple
that referenced
this pull request
Aug 13, 2026
…Graphify-Labs#1950) The _partial item-marker approach couldn't fire on the most common truncation shape: a mid-JSON cut parses to zero items, so a sliced document whose second slice truncated empty was still stamped complete (the PR's own headline case). - The adaptive-retry give-up sites now record the chunk's own source files in a result-level _partial_files list, independent of parsed items; it propagates through _merge_two / the recursion merges / _merge_into so it reaches both the per-chunk checkpoint and the run-level manifest stamp. - _partial_source_files unions _partial_files with the item markers. - save_semantic_cache seeds an empty group for a named partial file with no items so its entry is stamped partial, and carries a partial prev entry's flag forward so a later clean slice merging over it can't re-promote it to complete. - the CLI final save now passes partial_source_files (computed before the save) so an empty-parse file isn't written back as a complete entry. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
PerryLin-0420
pushed a commit
to PerryLin-0420/graphify-decouple
that referenced
this pull request
Aug 13, 2026
…ion (truncated doc's hash is cleared) Follow-up to Graphify-Labs#1956: a doc stamped complete on a prior run that truncates (partial) this run must have its stale semantic_hash cleared so it is re-queued. Partial files are dropped by _stamped_manifest_files and therefore land in clear_semantic — pin that composed behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
safishamsi
pushed a commit
that referenced
this pull request
Oct 20, 2026
The Read tool returns at most 2000 lines per call and reports no error when it truncates, so a subagent that read only the head of a long file still writes a well-formed chunk. Step B3 treated "chunk exists and parses" as success, and because build_merge replaces a re-extracted file's nodes, the unread tail was not merely missed: it was deleted, the run reported success, and the manifest recorded the file as done so no later --update retried it. On a 4165-line file that left 103 nodes covering 31% of the document, with 90 of 131 entries gone and the manifest treating it as finished. Three changes, in the fragments, so all thirteen disk-dispatching hosts pick them up from one edit: The extraction spec (verbose and compact) now states the cap and forbids emitting nodes for a partly-read file, and asks the subagent to report a top-level "coverage" map of file -> lines read. A short count is recoverable; a missing entry is indistinguishable from a complete read, which is why the machine check needs the prompt to ask. Step B1 bounds a chunk by total lines as well as file count (20-25 files AND ~6000 lines), and gives any file past 2000 lines a chunk to itself. File count alone was only half the mechanism: a subagent holding 25 files also dilutes attention, which is how a 590-line plan came back with zero nodes. Step B3.5 compares each reported coverage against the file's real length, names what was short, and hands the list to the two places that decide whether a file is ever looked at again: save_semantic_cache(partial_source_files=...) stamps those entries partial, which load_cached treats as a miss, and _stamped_manifest_files(partial_source_files=...) leaves them unstamped so detect_incremental re-queues them. Both are the existing contract the library path already uses for a truncated LLM response (#933, #1950), so the skill and library paths now recover the same way. Nodes already found for those files are kept; the next run's replace-on-re-extract swaps them for a complete set. The check is fail-safe in the direction that loses nothing: no coverage reported means no file is flagged, and a flagged file is re-read rather than trusted. Codex collects subagent results in memory with no per-chunk files on disk, so it gets the prompt-layer fix but not the Step B3.5 gate; its inline extraction has no chunk file to compare against. Tests execute the emitted python instead of matching its source (the #2126/#2641 convention), including a round trip through the real semantic cache: the partly-read file must come back as uncached, while the fully-read file still hits. Reverting the fix makes that round trip return an empty uncached list - the file served from cache forever, which is the bug. Fixes #2225 (cherry picked from commit 0b6a186)
safishamsi
added a commit
that referenced
this pull request
Oct 20, 2026
Land #3987 (@nothariharan, reported by @Ryanm218): on the skill extraction path a long file a subagent only skimmed was cached as complete and its unread tail silently dropped on the next replace-on- re-extract. The chunk coverage self-report is now checked against each file's real line count; a short file is cached partial and left unstamped so --update retries it, reusing the library's existing partial_source_files contract (#933, #1950). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When an LLM chunk is truncated (
finish_reason="length") and can't be recovered by splitting — or the adaptive-retry recursion hits its depth cap — the extractor keeps the partial node set it managed to parse. That partial result was then checkpointed and written to the content-hash semantic cache and manifest-stamped as a complete extraction. Because the cache is keyed by file content, the incomplete node set is served on every subsequent run forever — until the file's content changes or the user passes--force. Half a document's symbols silently masquerade as the whole, with no persisted signal that anything was missing.Fix
A truncated give-up result is tagged with an internal
_partialmarker on each of its items.save_semantic_cachestamps the affected file's cache entrypartial: True(detected either from that marker or from an explicitpartial_source_filesargument), andload_cachedtreats a partial entry as a cache miss, so the file is re-dispatched and retried instead of replayed. To make that re-dispatch actually happen on the common path, the partial file is also left unstamped in the manifest — mirroring the existing failed-chunk handling (#933) — sodetect_incrementalre-queues it on the next incrementalupdate/extract, not only on a full/--force/content-change run.A file split into slices across chunks is handled correctly: the
merge_existingcheckpoint peeks at a partial previous entry (load_cached(allow_partial=True)) so it accumulates all slices and keeps the entry partial, rather than a later clean slice silently dropping a truncated one and promoting the half-file to complete. The whole thing self-heals — a later complete extraction overwrites the same content-hash key with a non-partial entry — and the internal marker is stripped after the final save so it never leaks intograph.json.Tests
tests/test_partial_cache.pyand additions totests/test_chunking.py: partial entry is a load miss; explicitpartial_source_files; self-heal on complete re-extraction; sliced-file accumulation stays partial without losing a slice; manifest excludes partial files; the marker helpers; and an end-to-end truncatedextract_corpus_parallelcheckpoint that reloads as a miss. Full test suite green (3297 passed).