Auto-resolve stale bot review threads on re-review#63
Auto-resolve stale bot review threads on re-review#63derekmisler wants to merge 1 commit intodocker:mainfrom
Conversation
There was a problem hiding this comment.
Review Summary
- GraphQL error handling incomplete: Both the query and mutation operations only check shell exit codes, not GraphQL errors in the response JSON
- Security: Using world-writable /tmp: Could enable TOCTOU attacks in multi-user CI environments
The core logic for parsing diffs and matching threads looks solid, but the error handling needs strengthening before this can safely run in production.
|
/review |
There was a problem hiding this comment.
Review Summary
This PR adds a useful feature to auto-resolve stale bot review threads. The implementation is generally sound, but there's a moderate concern about error handling in the GraphQL pagination logic that could lead to incomplete thread resolution.
Key Finding
GraphQL Pagination Error Handling: When the pagination loop breaks due to jq parse errors, the script continues with partial data without clearly indicating to users that thread resolution may be incomplete. While the error is logged, the script proceeds to resolve threads based on potentially incomplete data from earlier pages.
Recommendation
Consider adding explicit validation after the pagination loop to check if ALL_THREADS is valid JSON and potentially exit early (or add a prominent warning) if the data is incomplete. This would make failures more obvious to users.
|
/review |
There was a problem hiding this comment.
✅ Review Complete
This PR implements a robust solution for auto-resolving stale bot review threads. The code has been thoroughly reviewed and all potential concerns have been verified.
Key strengths:
- AWK script correctly handles unified diff format (deleted lines should not increment new file line counter)
- Proper incremental line tracking through diff hunks
- Comprehensive error handling with
continue-on-error: truefor graceful degradation - Sound null-safety checks in jq operations
- Defensive programming with FETCH_OK flag to prevent acting on partial data
- Safe temp file handling with immediate trap setup
The implementation correctly parses pr.diff, fetches paginated review threads via GraphQL, and resolves threads where the commented line is no longer in the diff. No issues found.
9b84242 to
2e3fbe3
Compare
Signed-off-by: Derek Misler <derek.misler@docker.com>
2e3fbe3 to
08e70e8
Compare
Summary
review-pr/action.ymlthat runs before the review agent to auto-resolve stale bot review threadspr.diffto build a set offile:linepairs, fetches unresolved review threads via GraphQL, and resolves threads where the commented line is no longer in the diff (issue was addressed)Details
Uses GitHub's GraphQL
resolveReviewThreadmutation (REST API has no equivalent). The step is entirely bash/jq — no LLM involvement. Key design decisions:pathorline(outdated diff positions, file-level comments) are kept open rather than incorrectly auto-resolved+++ b/lines instead ofdiff --githeaders for unambiguous filename extractioncontinue-on-error: true— failures never block the actual review+lines → old threads resolvedfile:linegone → resolved; new review catches at new linefile:linein diff → kept opencontinue-on-error: true→ review still runsTest plan
/review, get inline comments/reviewagain📋 Summary: Resolved X threads, kept Y threads open