Repository navigation
fix: list per-file global hunk indices in chunk prompt summaries - #83
Merged
2 commits merged intoSep 27, 2026
Merged
2 commits merged into
2 commits merged into
Conversation
The chunk file summary said 'indices 0..N-1' where N was the number of that file's hunks in the chunk, while the diff labels (and the system prompt's instructions) use per-file global indices. For a file split across chunks the summary told the model to use indices already assigned in an earlier chunk. FileSummary now carries the actual indices and the summary lists them when they are not 0..N-1.
|
Warning Review limit reachedNext included review available in 48 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
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
In chunked mode every hunk in the diff is labelled with its per-file global index (
[hunk_index=N]), and system-prompt rule 6 tells the model to use exactly those. But the chunk's file summary was built fromhunk_count=len(indices_in_this_chunk)and printedindices 0..{count-1}. For a file split across chunks, chunk 2's summary said e.g.f.py: … (1 hunks, indices 0..0)while the diff below it showed[hunk_index=1]— a direct contradiction that invites the model to re-use index 0 (already assigned in chunk 1), producing overlaps and uncovered hunks thatassign_uncovered_hunksthen repairs noisily.Fix
FileSummarygainshunk_indices.ParsedDiff.statsfills0..n-1;build_chunk_stats_from_hunksfills the chunk's actual sorted per-file global indices._format_file_summaryprintsindices 0..Nwhen they are contiguous from 0 (unchanged wording for the single-shot prompt) andindices 1, 3 (this chunk only)otherwise.Tests
[2, 3]and the continuation prompt saysindices 2, 3 (this chunk only), not0..1Local review: 5/5. 446 tests pass, ruff clean.