Skip to content

feat: support dismissing PR-level reviews in resolve_comment#169

Merged
ichoosetoaccept merged 1 commit intomainfrom
02-17-feat-support-dismissing-pr-level-reviews-in-resolve_comment
Feb 17, 2026
Merged

feat: support dismissing PR-level reviews in resolve_comment#169
ichoosetoaccept merged 1 commit intomainfrom
02-17-feat-support-dismissing-pr-level-reviews-in-resolve_comment

Conversation

@ichoosetoaccept
Copy link
Member

@ichoosetoaccept ichoosetoaccept commented Feb 17, 2026

Extend resolve_comment to support dismissing PR-level reviews (PRR_ IDs) via the dismissPullRequestReview GraphQL mutation, instead of rejecting them with an error.

Changes

  • New _DISMISS_REVIEW_MUTATION GraphQL mutation and _dismiss_pr_review helper
  • resolve_comment now routes PRR_ IDs to dismiss, PRRT_ IDs to resolve, and rejects IC_ IDs with a clear error
  • Updated tool docstring in server.py to reflect PRR_ support
  • Tests: dismiss success, dismiss failure, and IC_ rejection

Fixes #120

@greptile-apps
Copy link

greptile-apps bot commented Feb 17, 2026

Greptile Summary

Extends resolve_comment to support dismissing PR-level reviews (PRR_ IDs) via the dismissPullRequestReview GraphQL mutation. Previously rejected PRR_ IDs with an error; now routes them to the new _dismiss_pr_review helper function.

  • Added _DISMISS_REVIEW_MUTATION GraphQL mutation and _dismiss_pr_review helper function
  • Updated routing logic: PRRT_ → resolve thread, PRR_ → dismiss review, IC_ → reject with error
  • Updated docstrings in server.py and comments.py to reflect PRR_ support
  • Added test coverage for dismiss success and failure scenarios

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • Implementation follows existing patterns and includes test coverage for success/failure paths. Minor gap in test coverage for GraphQL errors in the dismiss flow.
  • No files require special attention - all changes are well-structured

Important Files Changed

Filename Overview
src/codereviewbuddy/server.py Updated docstring to document PRR_ support in resolve_comment
src/codereviewbuddy/tools/comments.py Added _dismiss_pr_review helper and routing logic for PRR_ IDs; missing GraphQL error test
tests/test_comments.py Added tests for PRR_ dismiss success, failure, and IC_ rejection; missing GraphQL error case

Flowchart

flowchart TD
    Start([resolve_comment called]) --> CheckIC{thread_id starts<br/>with IC_?}
    CheckIC -->|Yes| RejectIC[Raise GhError:<br/>Cannot resolve bot comments]
    CheckIC -->|No| CheckPRR{thread_id starts<br/>with PRR_?}
    CheckPRR -->|Yes| DismissReview[Call _dismiss_pr_review]
    DismissReview --> GraphQLDismiss[Execute dismissPullRequestReview<br/>GraphQL mutation]
    GraphQLDismiss --> CheckGraphQLErr{GraphQL errors?}
    CheckGraphQLErr -->|Yes| RaiseGraphQLErr[Raise GhError]
    CheckGraphQLErr -->|No| CheckDismissState{state == DISMISSED?}
    CheckDismissState -->|Yes| ReturnDismissSuccess[Return success message]
    CheckDismissState -->|No| RaiseDismissFail[Raise GhError:<br/>Failed to dismiss]
    CheckPRR -->|No, PRRT_| FetchThread[Fetch thread details]
    FetchThread --> CheckPolicy{Check resolve_levels<br/>policy & reply requirement}
    CheckPolicy -->|Blocked| RaisePolicy[Raise GhError:<br/>Policy violation]
    CheckPolicy -->|Allowed| ResolveThread[Execute resolveReviewThread<br/>GraphQL mutation]
    ResolveThread --> CheckResolveErr{GraphQL errors?}
    CheckResolveErr -->|Yes| RaiseResolveErr[Raise GhError]
    CheckResolveErr -->|No| CheckResolveState{isResolved == true?}
    CheckResolveState -->|Yes| ReturnResolveSuccess[Return success message]
    CheckResolveState -->|No| RaiseResolveFail[Raise GhError:<br/>Failed to resolve]
Loading

Last reviewed commit: 19167eb

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@ichoosetoaccept ichoosetoaccept force-pushed the 02-17-fix-apply-_check_graphql_errors-to-query-paths branch from 95cfa5a to a877d2f Compare February 17, 2026 10:10
@ichoosetoaccept ichoosetoaccept force-pushed the 02-17-feat-support-dismissing-pr-level-reviews-in-resolve_comment branch from 400193b to 198ba04 Compare February 17, 2026 10:10
@ichoosetoaccept
Copy link
Member Author

@greptileai review

Copy link
Member Author

ichoosetoaccept commented Feb 17, 2026

Merge activity

  • Feb 17, 11:17 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 17, 11:18 AM UTC: Graphite rebased this pull request as part of a merge.
  • Feb 17, 11:19 AM UTC: @ichoosetoaccept merged this pull request with Graphite.

@ichoosetoaccept ichoosetoaccept changed the base branch from 02-17-fix-apply-_check_graphql_errors-to-query-paths to graphite-base/169 February 17, 2026 11:17
@ichoosetoaccept ichoosetoaccept changed the base branch from graphite-base/169 to main February 17, 2026 11:17
@ichoosetoaccept ichoosetoaccept force-pushed the 02-17-feat-support-dismissing-pr-level-reviews-in-resolve_comment branch from 198ba04 to 19167eb Compare February 17, 2026 11:18
@ichoosetoaccept ichoosetoaccept merged commit 84585f4 into main Feb 17, 2026
7 checks passed
@ichoosetoaccept ichoosetoaccept deleted the 02-17-feat-support-dismissing-pr-level-reviews-in-resolve_comment branch February 17, 2026 11:19
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

}
mocker.patch("codereviewbuddy.tools.comments.gh.graphql", return_value=response)
with pytest.raises(GhError, match="Failed to dismiss"):
resolve_comment(42, "PRR_kwDOtest123")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider adding test for GraphQL errors in PRR dismiss flow (similar to test_inline_thread_graphql_error_raises on line 1138)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/test_comments.py
Line: 1131:1131

Comment:
consider adding test for GraphQL errors in PRR dismiss flow (similar to `test_inline_thread_graphql_error_raises` on line 1138)

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

ichoosetoaccept added a commit that referenced this pull request Feb 17, 2026
Add a test verifying that GraphQL errors during the `dismissPullRequestReview` mutation (PRR_ dismiss flow) correctly raise `GhError`. Mirrors the existing `test_inline_thread_graphql_error_raises` pattern.

Suggested by Greptile during review of PR #169.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support dismissing PR-level reviews (PRR_) in resolve_comment

1 participant