Repository navigation
Fix AI review reliability and diff coverage - #41
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4f32eeb76
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Ok(MergeRequestChanges { | ||
| changes, | ||
| diff_refs: metadata.diff_refs, | ||
| overflow: false, |
There was a problem hiding this comment.
Detect limited /diffs responses
When a merge request hits GitLab's overall diff limits, the /diffs endpoint can still return 200 with only a limited set of files rather than an overflow field; this new path always sets overflow: false, so downstream coverage only sees the returned files and can mark the review complete while omitted files were never reviewed. I checked the GitLab List merge request diffs docs, which state this endpoint is subject to MR diff limits and returns limited results, so this path needs another signal such as MR changes_count/raw fallback to preserve incomplete coverage.
Useful? React with 👍 / 👎.
| let line_source_bytes = formatted_diff_line_bytes(&line); | ||
| chunk_lines.push(line); | ||
| let candidate = diff_hunk_from_lines(chunk_old_start, chunk_new_start, &chunk_lines); | ||
| if chunk_lines.len() > 1 && format_diff_hunk(&candidate).len() > max_chunk_diff_bytes { |
There was a problem hiding this comment.
Preserve batch limits for single-line hunks
When a generated/minified diff contains one added or removed line whose line plus hunk header already exceeds max_batch_diff_bytes, this guard prevents splitting or marking it incomplete, leaving that oversized line as a single work item. The planner then accepts the item into an empty batch and later sends the full formatted payload, so the configured request-size limit is bypassed and the AI call can become huge or time out.
Useful? React with 👍 / 👎.
What changed
/diffsAPI with legacy compatibilitycollapsed,too_large,generated_file, and legacyoverflowmetadataWhy
Large tool histories could repeat the same oversized request after a timeout, oversized hunks could lose line-number mappings, and GitLab diff limits could silently produce incomplete reviews that appeared complete.
Impact
AI review retries now use compact evidence, findings from later oversized-hunk chunks retain valid added-line positions, and incomplete GitLab diff data is visible instead of being counted as fully reviewed.
Validation
cargo test(164 library tests, 5 binary tests, 21 end-to-end tests)cargo fmt -- --checkgit diff --check