fix: convert GraphQL queries to single-line format in resolve-pr-threads#35
fix: convert GraphQL queries to single-line format in resolve-pr-threads#35JacobPEvans merged 3 commits intomainfrom
Conversation
- Convert all GraphQL queries to single-line --raw-field format - Replace GraphQL variables with placeholder substitution - Add REST API pattern for threaded replies - Add critical warnings about single-line format requirements - Add placeholder substitution examples - Align with github-graphql skill patterns from ai-assistant-instructions Fixes recurring errors: - Variable type coercion errors ($prNumber, $number) - Multi-line query encoding issues - reviewThreads field not found errors Changes: - graphql-queries.md: All 3 queries converted to single-line, added REST API reply section - SKILL.md: Updated reply pattern to use REST API, added critical format requirements Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 1f4ea18 in 8 seconds. Click for details.
- Reviewed
258lines of code in2files - Skipped
0files when reviewing. - Skipped posting
0draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
Workflow ID: wflow_zWdWcSagM7p4V6LS
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Summary of ChangesHello @JacobPEvans, 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 recurring GraphQL errors in the Highlights
Changelog
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
The pull request successfully converts GraphQL queries to a single-line format and introduces the use of the REST API for threaded replies, addressing previous issues with multi-line queries and variable handling. The documentation has been updated with critical warnings and clear examples for placeholder substitution. The changes improve the robustness and reliability of the resolve-pr-threads skill.
There was a problem hiding this comment.
Pull request overview
This PR fixes recurring GraphQL errors in the /resolve-pr-threads skill by converting all GraphQL queries from multi-line format with variable declarations to single-line format with placeholder substitution, and replacing the GraphQL mutation for replies with a REST API pattern.
Changes:
- Converted all GraphQL queries to single-line
--raw-fieldformat with placeholder substitution ({OWNER},{REPO},{NUMBER},{THREAD_ID}) - Added REST API pattern for replying to review threads using
gh api repos/{owner}/{repo}/pulls/{number}/comments/{comment_id}/replies - Added critical warnings and comprehensive documentation about single-line format requirements
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| github-workflows/skills/resolve-pr-threads/graphql-queries.md | Converted all 3 GraphQL queries to single-line format; added REST API reply section; added critical warnings and placeholder substitution examples |
| github-workflows/skills/resolve-pr-threads/SKILL.md | Added critical warning section about GraphQL format requirements; updated Step 6 to use REST API for replies with detailed substeps |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Critical fix to prevent "Expected VALUE, actual: RPAREN" errors.
Root cause: GraphQL queries were being executed with empty or unset
variables (e.g., `pullRequest(number: )` instead of `pullRequest(number: 35)`).
Changes:
- Add REQUIRED variable validation before every GraphQL query
- Add clear error messages for missing repo context
- Update all placeholder substitution examples with validation steps
- Add validation to SKILL.md Step 1 (fetch threads)
- Add validation examples to all graphql-queries.md patterns
This prevents agents from wasting tokens on GraphQL parsing errors
by catching missing variables before execution.
Example validation pattern (now required):
```bash
OWNER=$(gh repo view --json owner --jq .owner.login)
REPO=$(gh repo view --json name --jq .name)
NUMBER=$(gh pr view --json number --jq .number)
[[ -z "$OWNER" || -z "$REPO" || -z "$NUMBER" ]] && { echo "Error: Missing repo context"; exit 1; }
```
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed from STRICT (fail if not set) to SMART (infer from context).
Before: Required OWNER/REPO/NUMBER to be set, exited with error if missing
After: Automatically infers from current git/PR context when not provided
Pattern:
```bash
# Smart inference - tries current context first
OWNER=${OWNER:-$(gh repo view --json owner --jq -r '.owner.login' 2>/dev/null)}
REPO=${REPO:-$(gh repo view --json name --jq -r '.name' 2>/dev/null)}
NUMBER=${NUMBER:-$(gh pr view --json number --jq -r '.number' 2>/dev/null)}
# Only error if ALL inference methods fail AND about to execute
[[ -z "$OWNER" || -z "$REPO" || -z "$NUMBER" ]] && { echo "Error: Could not infer context"; exit 1; }
```
Benefits:
- Works without arguments when run from git repo/PR branch
- Still accepts explicit arguments: OWNER=x REPO=y NUMBER=z
- Only errors when truly unable to determine context
- Makes skill smart, not strict
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Summary
--raw-fieldformatai-assistant-instructions/github-graphqlskillProblem
The
/resolve-pr-threadsskill had recurring GraphQL errors:Variable $prNumber of type Int! was provided invalid valueUnknown JSON field: reviewThreadsRoot Cause
Multi-line GraphQL queries with variable declarations (
$owner,$repo,$number) caused:Solution
Converted all queries to match the reference pattern from
ai-assistant-instructions:--raw-field{OWNER},{REPO},{NUMBER}Files Changed
graphql-queries.md: All 3 queries converted to single-line, added REST API reply section, added critical warningsSKILL.md: Updated reply pattern to use REST API, added critical format requirements sectionCritical Changes
graphql-queries.md
Added critical warning section:
Query conversions:
$owner,$repo,$numbervariables → Single-line with{OWNER},{REPO},{NUMBER}placeholders$threadIdvariable → Single-line with{THREAD_ID}placeholderAdded new section:
gh api repos/{OWNER}/{REPO}/pulls/{NUMBER}/comments/{COMMENT_ID}/repliesSKILL.md
Added critical warning section:
Updated Step 6 (Reply to Each Thread):
addPullRequestReviewCommentand stdin (-F body=-)gh api repos/.../pulls/.../comments/.../repliesBenefits:
databaseIdinstead of GraphQL node IDsTest Plan
/resolve-pr-threadson a PR with unresolved threadsVerification
Tested with actual PR data:
🤖 Generated with Claude Code
Important
Convert GraphQL queries to single-line format and add REST API pattern for threaded replies in
resolve-pr-threads.--raw-fieldformat ingraphql-queries.md.{OWNER},{REPO},{NUMBER}.SKILL.md.graphql-queries.mdandSKILL.md.graphql-queries.md.ai-assistant-instructions/github-graphqlskill.This description was created by
for 1f4ea18. You can customize this summary. It will automatically update as commits are pushed.