fix(suggestions): only offer applicable changes - #2649
Conversation
PR Summary by QodoOnly publish committable inline suggestions when they are safely applyable
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
|
Code review by qodo was updated up to the latest commit 67eda35 |
|
Code review by qodo was updated up to the latest commit 885dd19 |
885dd19 to
740fad4
Compare
|
Code review by qodo was updated up to the latest commit 740fad4 |
740fad4 to
a2ea25e
Compare
Code Review by Qodo
1.
|
a2ea25e to
c6bc35d
Compare
|
Code review by qodo was updated up to the latest commit c6bc35d |
c6bc35d to
25b6402
Compare
|
Code review by qodo was updated up to the latest commit 25b6402 |
25b6402 to
0d4d7c6
Compare
|
Code review by qodo was updated up to the latest commit 0d4d7c6 |
|
Code review by qodo was updated up to the latest commit 37678bb |
|
Code review by qodo was updated up to the latest commit 5aed97e |
5aed97e to
dadff7b
Compare
|
Code review by qodo was updated up to the latest commit dadff7b |
|
Code review by qodo was updated up to the latest commit bc761b5 |
IsmaelMartinez
left a comment
There was a problem hiding this comment.
Verified end to end: merges cleanly onto main, suite green, and reverting the source while keeping your tests turns 25 of them red, so the coverage is real. The approach is right, and gating committability on the anchored range verifying against the head file is the durable fix. It complements #2626, which stops the model producing truncated improved_code in the first place.
Two questions inline before I approve. Thanks for contributing!
| if not data_above_threshold['code_suggestions'][-1]['existing_code']: | ||
| get_settings().pr_code_suggestions.dual_publishing_score_threshold): | ||
| data_above_threshold["code_suggestions"].append(suggestion) | ||
| if suggestion.get("improved_code") and not data_above_threshold["code_suggestions"][-1][ |
There was a problem hiding this comment.
This no longer requires improved_code to admit a suggestion above the threshold, where main gates on and suggestion.get('improved_code'). Deliberate? Suggestions with no improved_code now reach the dual-publishing path where they were previously skipped.
There was a problem hiding this comment.
will come back on this one
| for code_suggestion in code_suggestions: | ||
| self.git_provider.publish_code_suggestions([code_suggestion]) | ||
| if fallback_comments: | ||
| self.git_provider.publish_comment("\n\n---\n\n".join(fallback_comments)) |
There was a problem hiding this comment.
This posts a fresh comment on every run. pr_agent/algo/inline_comment_dedup.py exists for exactly that pile-up, behind config.persistent_inline_comments. Worth routing through it, or is a per-run note the intent?
There was a problem hiding this comment.
hmmm will check & test
There was a problem hiding this comment.
Sorry, my dedup suggestion above doesn't hold, please ignore it. inline_comment_dedup only reads review comments, and this path posts a plain PR comment, so the marker would never be read back.
The pile-up itself is still real. I got a bit confused with another PR, apologies.
|
Merging. The applicable-only filter is the right call, and the tests cover the anchor validation well. One follow-up rather than a blocker: the new |
IsmaelMartinez
left a comment
There was a problem hiding this comment.
Verified against current main: merges clean, 2444 passing locally.
Summary
Only exposes an Apply change action when the proposed replacement matches the exact lines it would replace.
Scope
All providers.
The validation preserves blank-line positions and rejects reversed or out-of-range anchors, missing file content, unavailable existing code, source mismatches, and malformed non-string source values. Invalid suggestions are skipped without stopping later valid suggestions. When a provider omits full file content, changed lines are verified against the unified diff. Suggestions with valid anchors remain inline, while suggestions whose anchors cannot be verified are published as regular PR comments. Provider failures remain visible, and a loaded empty diff cache is reused without another provider request.
Validation
git diff --checkpasses.Related to #2110.