fix: propagate exception from verified inline comment publishing - #2258
Conversation
The bare except:pass in _publish_inline_comments_fallback_with_verification silently swallows all exceptions when publishing verified review comments. This causes publish_code_suggestions to believe the operation succeeded, preventing the one-by-one retry path from activating. Replace with Exception logging and re-raise so the caller can detect the failure and retry individual comments.
Review Summary by QodoPropagate exception from verified inline comment publishing
WalkthroughsDescription• Replace bare except: pass with proper exception handling • Log error details when verified inline comments fail to publish • Re-raise exception to allow caller to detect failure and retry • Enables one-by-one retry mechanism in publish_code_suggestions() Diagramflowchart LR
A["publish_code_suggestions()"] -->|calls| B["_publish_inline_comments_fallback_with_verification()"]
B -->|previously| C["except: pass<br/>silently fails"]
C -->|result| D["Returns True<br/>no retry"]
B -->|now| E["except Exception<br/>log and raise"]
E -->|result| F["Propagates error<br/>enables retry"]
File Changes1. pr_agent/git_providers/github_provider.py
|
Code Review by Qodo
1.
|
Address review feedback: the caller already logs the exception, so logging here causes duplicate entries. Just re-raise and let the upstream handler log with full context.
|
Updated: removed the duplicate error log. The caller already logs the exception, so this just re-raises to propagate the failure. Keeps it consistent with the file's convention. |
|
Persistent review updated to latest commit c534e99 |
|
Hi @karesansui-u, I independently hit this exact bug while working on the inline-comment publishing path (my persistent-inline-comments work in PR #2424). When I agree with your fix: propagating the exception so If it's useful, the test commit sits directly on top of your branch so you can cherry-pick it straight in: |
Adds a regression test on top of the fix in this branch: asserts the verified bulk-publish failure propagates out of publish_inline_comments, and that publish_code_suggestions then returns False so the one-by-one retry in pr_code_suggestions runs. Verified to fail on unpatched main and pass with this branch's fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With the duplicate log removed the try/except only re-raised, which is the same as not catching at all.
IsmaelMartinez
left a comment
There was a problem hiding this comment.
Approving. The bare except: pass is still on main, and your diagnosis holds: with the change the failure reaches publish_code_suggestions, which returns False, so the one-by-one retry in pr_code_suggestions finally runs.
Apologies for the wait, both the three months before I first replied and the time since.
Rather than leave the test offer from June hanging, I have pushed it to your branch along with one tidy-up: now the duplicate log is gone the handler only re-raised, so the try went with it. The test goes red against main on both assertions and the suite is green. Nothing left for you to do.
Thanks for this, and for #2256.
Code Review by Qodo
1. _Status422Error docstring is non-imperative
|
Bug description
In
github_provider.py,_publish_inline_comments_fallback_with_verification()has a bareexcept: passthat silently swallows all exceptions when publishing verified review comments:The caller
publish_code_suggestions()believes the operation succeeded and returnsTrue. The one-by-one retry path inpr_code_suggestions.pynever activates:Impact
When the GitHub API returns an error (rate limit, network failure, permission error), review comments are silently dropped. The user sees no output and no error. The retry mechanism designed to handle partial failures is completely bypassed.
Fix
Replace
except: passwithexcept Exception as e:that logs the error and re-raises, allowing the caller to detect the failure and retry.Affected files
pr_agent/git_providers/github_provider.py(L478-479) — 2 line change