Skip to content

feat: include pull request review reaction counts - #3812

Open
Daiyuanranfeng wants to merge 2 commits into
github:mainfrom
Daiyuanranfeng:feat/pull-request-review-reactions
Open

Daiyuanranfeng wants to merge 2 commits into
github:mainfrom
Daiyuanranfeng:feat/pull-request-review-reactions

Conversation

@Daiyuanranfeng

Copy link
Copy Markdown

Summary

Add opt-in reaction summaries to pull_request_read for PR reviews and review-thread comments. Counts use the same compact reactions shape as issue comments.

Why

Fixes #3780. Callers can inspect feedback such as thumbs-up acknowledgements without reading individual reaction users.

What changed

  • Add include_reactions (default false) for get_reviews and get_review_comments.
  • Fetch review counts in one GraphQL nodes query for the current REST page, after lockdown filtering. Include comment counts in the existing thread query.
  • Preserve the existing exported function signatures and pagination.
  • Update the tool schema snapshot and generated README.

MCP impact

  • Tool schema or behavior changed. The optional flag adds reaction counts when enabled.

Prompts tested (tool changes only)

MCP client-session tests call pull_request_read with both methods and include_reactions: true. They validate JSON text and structured content, counts, empty results, and the default output.

Security / limits

  • Auth / permissions considered. Review enrichment runs after the existing lockdown filter.
  • Data exposure, filtering, or token/size limits considered. Only aggregate counts are returned. Review enrichment covers the current page.

Tool renaming

  • I am not renaming tools as part of this PR.

Lint & tests

  • Linted locally with script/lint (golangci-lint 2.14.0, zero issues).
  • Tested locally with script/test (go test -race ./...).
  • go test ./... also passed. UI typecheck and build passed on Node 26.13.0.
  • Tests ran on Windows with Go 1.27.3. Git Bash icon-data line endings were restored to LF locally to match the upstream blobs.

Docs

  • Updated the generated README and tool schema snapshot.

@Daiyuanranfeng
Daiyuanranfeng requested a review from a team as a code owner November 11, 2026 02:38
Copilot AI adaptive review requested due to automatic review settings November 11, 2026 02:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Both review methods undercount per-emoji reactions and total_count because ReactionGroup.users excludes bots and mannequins; querying reactors.totalCount would include them.

1 open issue
What changed in this PR

Adds opt-in reaction summaries to pull_request_read for reviews and review-thread comments, addressing #3780 with the compact format already used for issue comments.

Changes:

  • Adds include_reactions, defaulting to false, while preserving exported signatures and pagination.
  • Fetches review counts after lockdown filtering and comment counts within the existing thread query.
  • Updates client-session tests, the tool schema snapshot, and generated documentation.
File Description
README.md Documents the optional reaction-count flag.
pkg/​github/​typed_consolidated_pull_request_outputs_test.go Tests reaction counts, empty results, and default outputs.
pkg/​github/​pullrequests.go Fetches and summarizes opt-in reactions.
pkg/​github/​pullrequests_test.go Updates expected GraphQL variables.
pkg/​github/​minimal_types.go Adds reaction summaries to review and comment outputs.
pkg/​github/​consolidated_pull_request_types.go Adds and validates the boolean input.
pkg/​github/​__toolsnaps__/​pull_request_read.snap Records the updated input and output schemas.

Review effort: Balanced (auto)

Comment thread pkg/github/pullrequests.go Outdated
Content githubv4.ReactionContent
Users struct {
TotalCount githubv4.Int
} `graphql:"users(first: 1)"`

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for catching this. The shared reaction-group query now uses reactors.totalCount, aliased to users so the existing Go field and output remain unchanged. This applies to both review comments and reviews.

The MCP client-session tests now assert that both query paths request reactors, in addition to checking the per-emoji and total counts. Those assertions failed against the previous query and pass after the change.

Validation: Go 1.27.3 on Windows; focused regression tests, script/lint, script/test (full race suite), and script/generate-docs. Documentation regeneration produces no additional changes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ReactionGroup.users excludes non-user reactors such as bots and mannequins, so both review methods undercount per-emoji reactions and total_count when those actors react. Query reactors.totalCount instead. Aliasing reactors to users preserves the existing Go field and response fixtures.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for checking this. This was addressed in 8c8dfb3: the query now uses users: reactors(first: 1) { totalCount }, preserving the existing response shape while counting bots and mannequins too. Regression assertions cover the generated queries for both review methods. Could you please review the latest commit?

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.

Return reactions on pull request reviews and review comments in pull_request_read

3 participants