Skip to content

fix(review): GraphQL schema error in getThreadIdFromComment#252

Merged
amondnet merged 3 commits into
mainfrom
251-fixreview-graphql-schema-error-in-getthreadidfromcomment-pullrequestreviewthread-field-doesnt-exist
Feb 2, 2026
Merged

fix(review): GraphQL schema error in getThreadIdFromComment#252
amondnet merged 3 commits into
mainfrom
251-fixreview-graphql-schema-error-in-getthreadidfromcomment-pullrequestreviewthread-field-doesnt-exist

Conversation

@amondnet

@amondnet amondnet commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix gh please pr review reply command failing with GraphQL schema error when replying to review comments.

Problem

The getThreadIdFromComment() function in src/lib/github-graphql.ts attempts to query a non-existent pullRequestReviewThread field on the PR query, causing GraphQL schema validation errors.

Error:

❌ Error: GraphQL query failed: gh: Field 'pullRequestReviewThread' doesn't exist on type 'PullRequestReviewComment'

Solution

  • Replace the non-existent field query with PR's reviewThreads connection
  • Query threads to find the one containing the target comment ID
  • Support direct Thread Node ID input as an optimization to skip the lookup
  • Update function signature to accept PR Node ID as required parameter
  • Maintain backward compatibility with Database ID and Node ID comment inputs

Changes

  • Updated getThreadIdFromComment() to query reviewThreads connection
  • Added support for direct Thread Node ID input
  • Enhanced ID detection and conversion logic
  • Maintains backward compatibility with comment ID input
  • Fixes GraphQL schema validation

Test Plan

  • Test gh please pr review reply <comment-id> -b "text" with Database ID
  • Test gh please pr review reply <node-id> -b "text" with Node ID
  • Test gh please pr review reply <thread-node-id> -b "text" with Thread ID
  • Verify all GraphQL queries pass schema validation
  • Run integration tests for review commands

Related Issues

Closes #251

Fix gh please pr review reply command failing with GraphQL schema error when
replying to review comments. The getThreadIdFromComment() function attempted
to query a non-existent pullRequestReviewThread field.

## Changes

- Replace non-existent field query with PR's reviewThreads connection
- Query threads to find the one containing the target comment ID
- Support direct Thread Node ID input as optimization to skip lookup
- Update getThreadIdFromComment() signature to accept PR Node ID
- Maintain backward compatibility with Database ID and Node ID comment inputs

## Related Issues

Closes #251
@vercel

vercel Bot commented Feb 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gh-please Ready Ready Preview, Comment Feb 2, 2026 4:20am

Request Review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @amondnet, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical GraphQL schema validation error that prevented the gh please pr review reply command from functioning correctly. The solution involves a comprehensive refactoring of how review thread IDs are resolved, moving from an incorrect direct field query to a more robust method of querying the PR's review threads and matching comments. Additionally, it introduces an efficient pathway for users to directly provide thread Node IDs, enhancing both reliability and performance of the reply command.

Highlights

  • GraphQL Schema Error Fix: Resolves a GraphQL schema error that occurred when using the gh please pr review reply command, specifically due to querying a non-existent pullRequestReviewThread field.
  • Refactored Thread ID Resolution: The getThreadIdFromComment() function has been updated to query the PR's reviewThreads connection and match comments to find the correct thread ID, aligning with GitHub's recommended approach.
  • Direct Thread ID Input Support: Introduces support for directly providing a Thread Node ID (e.g., PRRT_...) as an input, which optimizes the process by skipping additional API lookups.
  • Backward Compatibility: Maintains backward compatibility for existing Database ID and Comment Node ID inputs, ensuring a smooth transition for users.
  • Updated Function Signature: The getThreadIdFromComment() function now requires the PR Node ID as a parameter to facilitate the new thread resolution logic.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov

codecov Bot commented Feb 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 15.66265% with 70 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/lib/github/review-operations.ts 1.72% 57 Missing ⚠️
src/commands/pr/review/reply.ts 38.09% 13 Missing ⚠️

📢 Thoughts on this report? Let us know!

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces detailed planning documents to address a GraphQL schema error in the review reply functionality. The plan laid out in .please/plans/2026-02-02-fix-review-reply-graphql-error.md is comprehensive, correctly identifying the issue and proposing a solid architectural solution. The approach to query the reviewThreads connection and support direct thread ID inputs is excellent. My review includes one suggestion on the plan to better handle an edge case related to API limits.

Comment thread .please/plans/2026-02-02-fix-review-reply-graphql-error.md
- Replace non-existent `pullRequestReviewThread` field with `reviewThreads` query
- Add prNodeId parameter to `getThreadIdFromComment()` for PR context
- Search through PR's reviewThreads to find thread containing target comment
- Support Thread ID (PRRT_...) direct input for efficiency (no API call)
- Support Comment ID (PRRC_...) and Database ID (number) via reviewThreads lookup
- Add `isThreadNodeId()` and `isCommentNodeId()` utility functions
- Update reply command to display appropriate progress messages by ID type

Fixes #251
Add 100-comment-per-thread limitation to error message
as suggested by @gemini-code-assist[bot]
@sonarqubecloud

sonarqubecloud Bot commented Feb 2, 2026

Copy link
Copy Markdown

@amondnet
amondnet merged commit d730005 into main Feb 2, 2026
6 of 8 checks passed
@amondnet
amondnet deleted the 251-fixreview-graphql-schema-error-in-getthreadidfromcomment-pullrequestreviewthread-field-doesnt-exist branch February 2, 2026 04:31
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.

fix(review): GraphQL schema error in getThreadIdFromComment - pullRequestReviewThread field doesn't exist

1 participant