Skip to content

Feat/resolve review threads#1919

Merged
SamMorrowDrums merged 4 commits into
github:mainfrom
plwalters:feat/resolve-review-threads
Mar 13, 2026
Merged

Feat/resolve review threads#1919
SamMorrowDrums merged 4 commits into
github:mainfrom
plwalters:feat/resolve-review-threads

Conversation

@plwalters

Copy link
Copy Markdown
Contributor

Summary

Adds resolve_thread and unresolve_thread methods to the pull_request_review_write tool, enabling users to resolve and unresolve PR review threads via GraphQL mutations.

Why

Fixes #1768

What changed

  • Added ThreadID field to PullRequestReviewWriteParams struct
  • Added threadId parameter and new methods to tool schema
  • Implemented ResolveReviewThread function using GraphQL resolveReviewThread and unresolveReviewThread mutations
  • Added switch cases for resolve_thread and unresolve_thread methods
  • Added unit tests covering success and error scenarios
  • Updated toolsnaps and generated docs

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed — Added two new methods (resolve_thread, unresolve_thread) and a new threadId parameter to the existing pull_request_review_write tool.
  • New tool added

Prompts tested (tool changes only)

Security / limits

  • No security or limits impact — Uses existing GraphQL client authentication; thread resolution is already permission-controlled by GitHub.
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples) — Auto-generated via script/generate-docs
@plwalters plwalters requested a review from a team as a code owner January 28, 2026 17:25
@dsculptor

Copy link
Copy Markdown

Clean PR — extends the existing tool correctly, uses the right GraphQL mutations, and tests cover the key cases. Ready for merge with minor notes:

  1. Unused required paramsowner/repo/pullNumber are silently ignored for resolve_thread/unresolve_thread. A one-liner in the method description would prevent confusion.
  2. Test gapthreadId: "" is tested, but fully omitted threadId isn't. Go zero-value likely handles it, but worth an explicit case.
  3. Idempotency — Worth noting in the method description that resolving an already-resolved thread is a no-op, so agents don't add unnecessary guard logic.
  4. Minor DRY opportunity — Resolve/unresolve branches share nearly identical mutation structs. Not a blocker.

Nice work filling a real gap in the PR review workflow.

@plwalters plwalters force-pushed the feat/resolve-review-threads branch from 08aa18b to dac1776 Compare February 10, 2026 20:24
Adds `resolve_thread` and `unresolve_thread` methods to the
`pull_request_review_write` tool, enabling users to resolve and
unresolve PR review threads via GraphQL mutations.

- Add ThreadID field to PullRequestReviewWriteParams struct
- Add threadId parameter and new methods to tool schema
- Implement ResolveReviewThread function using GraphQL mutations
- Add switch cases for resolve_thread and unresolve_thread methods
- Add unit tests covering success, error, empty and omitted threadId
- Document that owner/repo/pullNumber are unused for these methods
- Document idempotency (resolving already-resolved is a no-op)
- Update toolsnaps and generated docs

Fixes github#1768

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@plwalters plwalters force-pushed the feat/resolve-review-threads branch from dac1776 to 1fdfa13 Compare February 10, 2026 20:25
@plwalters

Copy link
Copy Markdown
Contributor Author

I believe the feedback should be addressed. I'm not a frequent contributor to this repo so if there is anything I need to amend just let me know! I squashed the commits as well

@kulakowka kulakowka left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good!

@plwalters

Copy link
Copy Markdown
Contributor Author

Would love to get this feature in - currently when claude et al. are using the github MCP server they can create threads with suggestions but if the suggestion is approved / fixed they can't resolve the thread.

It may seem like a small quality of life thing but it's nice when we can get the thread resolved.

@ghodss

ghodss commented Feb 19, 2026

Copy link
Copy Markdown

We could really use this as well!

@plwalters

Copy link
Copy Markdown
Contributor Author

Everything is updated, is there anyone who can help with merging or letting me know what to update?

@thrix

thrix commented Mar 13, 2026

Copy link
Copy Markdown

Hey @plwalters, I also need this feature and wanted to help move it forward with a review.

Review

Clean PR — extends the existing pull_request_review_write tool correctly with resolve_thread and unresolve_thread methods. Uses the right GraphQL mutations, includes good input validation, and tests cover success, empty/omitted input, and error scenarios. Nice work.

Missing thread ID in get_review_comments output

This is the main gap. The tool description says "Get thread IDs from pull_request_read with method get_review_comments", but MinimalReviewThread does not include an ID field:

type MinimalReviewThread struct {
    IsResolved  bool                   `json:"is_resolved"`
    IsOutdated  bool                   `json:"is_outdated"`
    IsCollapsed bool                   `json:"is_collapsed"`
    Comments    []MinimalReviewComment `json:"comments"`
    TotalCount  int                    `json:"total_count"`
}

The underlying reviewThreadNode GraphQL type already has ID githubv4.ID, but convertToMinimalReviewThread doesn't expose it. Without this, callers have no way to discover the threadId needed for resolve/unresolve through the MCP server itself.

Fix would be:

  • Add ID string \json:"id"`toMinimalReviewThread`
  • Add ID: fmt.Sprintf("%v", thread.ID) to convertToMinimalReviewThread

owner/repo/pullNumber required but unused (minor)

The schema has Required: []string{"method", "owner", "repo", "pullNumber"}, but resolve_thread/unresolve_thread only use params.ThreadID. The description documents this clearly, so it's just a minor UX friction — callers must provide dummy values for unused fields. Not a blocker, just a trade-off of the multi-method tool pattern.

Everything else looks good

  • Correct use of githubv4.ResolveReviewThreadInput / UnresolveReviewThreadInput
  • Proper error handling with ghErrors.NewGitHubGraphQLErrorResponse
  • Idempotency documented in method descriptions
  • Tests cover resolve, unresolve, empty threadId, omitted threadId, and GraphQL errors

Generated-by: Claude Code

@SamMorrowDrums

Copy link
Copy Markdown
Collaborator

Thank you for the contribution!

@plwalters

Copy link
Copy Markdown
Contributor Author

Thanks for approving it! Our team will appreciate this one for sure

@SamMorrowDrums SamMorrowDrums merged commit f93e526 into github:main Mar 13, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants