You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When /add_docs cannot publish its batch of suggestions and every individual retry returns False, it currently finishes without reporting that nothing was published. This change posts a failure comment and records the command failure through the existing run-status path.
All individual retries still run. A successful retry, an unknown provider result, and an empty documentation result retain their existing behavior.
Validation:
494 focused tests passed, including exhausted publication, partial success, unknown results, empty suggestions, and failure-comment errors.
• push_inline_docs now returns a tri-state result (True/False/None) reflecting whether all retries
failed.
• /add_docs posts a failure comment and raises to trigger the existing record_command_failure
path when every individual retry returns False.
• Partial success, unknown/ambiguous results, and empty documentation continue to be treated as
non-failures.
• Added extensive unit tests covering exhausted, partial, ambiguous, empty, and comment-error
scenarios.
Diagram
graph TD
A["push_inline_docs"] --> B{"Aggregate publish\nsucceeded?"}
B -->|True| C["Return True"]
B -->|False| D["Retry each\nsuggestion"]
D --> E{"All retries\nFalse?"}
E -->|Yes| F["Return False"]
E -->|No| G["Return True/None"]
F --> H["run(): publish\nfailure comment"]
H --> I["record_command_failure"]
Loading
High-Level Assessment
Using a tri-state return value (True/False/None) to disambiguate exhausted failure from ambiguous/partial outcomes is a minimal, low-risk fix that reuses the existing failure-comment and record_command_failure infrastructure rather than introducing new error-handling machinery.
Files changed (2) +155 / -8
Bug fix (1) +17 / -3
pr_add_docs.pyReport exhausted inline documentation publication as a failure+17/-3
Report exhausted inline documentation publication as a failure
• push_inline_docs now returns True/False/None to distinguish success, exhausted retries, and ambiguous/empty outcomes. run() posts a failure comment and raises RuntimeError when push_inline_docs returns False, triggering the existing command-failure recording path.
PRAddDocs.run() records the exhausted publication failure and then suppresses its RuntimeError,
while _run_command() treats the normal return as success. When a non-automated /add_docs request
exhausts its retries, its request returns True and its span is marked successful; unlike the
automated-check path, it also has no run-details collector initialized to retain the failure flag.
+ self.git_provider.publish_comment("Failed to publish code documentation for this PR.")+ raise RuntimeError("Failed to publish code documentation after individual retries")
Evidence
The changed branch publishes the failure comment and raises, but run() catches the exception and
calls record_command_failure(). That function has no effect without an initialized collector;
PRAddDocs.run() does not initialize one, whereas the automated GitHub command loop explicitly
does. For ordinary requests, _run_command() unconditionally marks the span OK and returns True
when the tool returns normally.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
An exhausted `/add_docs` publication posts a failure comment, but ordinary command handling reports the request as successful because the tool suppresses the exception and no run-details collector is initialized for that path.
## Fix Focus Areas
- pr_agent/tools/pr_add_docs.py[80-86]
- pr_agent/agent/pr_agent.py[400-411]
- pr_agent/algo/run_details.py[97-121]
## Recommended Fix
Initialize run details at the command boundary and have command handling inspect the recorded failure after the tool returns. Return `False` and mark the span as failed when the flag is set, while retaining the existing automated-check behavior.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
2. Docs omit the publication failure outcome✓ Resolved
Description
PRAddDocs.run() now posts a failure comment and records a command failure when the batch and every
individual retry return False, but the add-docs guide describes only successful inline
publication. Users following that guide have no explanation of the new comment or failed run status
when no suggestion can be published.
+ if publication_result is False:+ self.git_provider.publish_comment("Failed to publish code documentation for this PR.")+ raise RuntimeError("Failed to publish code documentation after individual retries")
Evidence
The changed branch publishes a new user-visible failure comment and records failure, while the
guide's workflow description covers inline suggestions without this failure outcome.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
The add-docs guide does not describe the new failure outcome when all publication attempts fail.
## Fix Focus Areas
- docs/docs/tools/add_docs.md[23-69]
- pr_agent/tools/pr_add_docs.py[80-83]
## Recommended Fix
Add a brief failure-outcome note to the add-docs guide explaining when the failure comment appears and that the command is marked failed.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Author self-review: I have reviewed the code review findings, and addressed the relevant ones.
Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR
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
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.
When
/add_docscannot publish its batch of suggestions and every individual retry returnsFalse, it currently finishes without reporting that nothing was published. This change posts a failure comment and records the command failure through the existing run-status path.All individual retries still run. A successful retry, an unknown provider result, and an empty documentation result retain their existing behavior.
Validation:
PYTHONPATH=. uv run pytest tests/unittest -q: 9846 passed, 33 skipped, 1 xfailed.Provider outcomes were checked with controlled tests; live provider E2E checks were not run.