Skip to content

Copilot-generated PR review code suggestions ("Suggest" changesets) are not returned by pull_request_read or any API #2235

@VooDisss

Description

@VooDisss

Describe the feature or problem you'd like to solve

When GitHub Copilot reviews a pull request, it generates two distinct types of content per review comment:

  1. Prose commentary — a text description of the issue found (e.g., "Consider adding pydantic validation...")
  2. Suggested code changesets — concrete, committable code diffs rendered with a green "Commit suggestion" / "Add to batch" button in the GitHub web UI

Currently, the pull_request_read tool (method: get_review_comments) and the underlying GitHub REST + GraphQL APIs only return the prose commentary in the comment body field. The suggested code changesets that Copilot generates — the ones visible in the GitHub web UI with the "Commit suggestion" button — are completely absent from all API responses.

This means MCP-connected AI agents cannot:

  • Read Copilot's actual code suggestions to evaluate their correctness
  • Programmatically accept, reject, or modify Copilot's suggested changes
  • Build automated workflows that triage Copilot review suggestions
  • Provide informed assessments of whether a Copilot suggestion should be committed

Exhaustive investigation proving the data is missing

I performed a thorough investigation across every available API surface to confirm this is not a client-side issue. The test PR used: zai-org/GLM-OCR#131 — Copilot generated 9 review comments, each with a visible "Suggest" code changeset in the GitHub web UI.

1. GitHub MCP Server — pull_request_read with get_review_comments

Using the official github/github-mcp-server (Docker, ghcr.io/github/github-mcp-server), I called:

pull_request_read(method="get_review_comments", owner="zai-org", repo="GLM-OCR", pullNumber=131)

Result: All 9 review threads returned with prose-only body fields. Zero suggestion blocks.

2. REST API — GET /repos/{owner}/{repo}/pulls/{pull_number}/comments

gh api repos/zai-org/GLM-OCR/pulls/131/comments --paginate --jq ".[].body"

Result: All 9 comment bodies are plain prose text. No ```suggestion ``` markdown blocks present.

3. GraphQL API — body and bodyHTML fields on PullRequestReviewComment

{
  repository(owner: "zai-org", name: "GLM-OCR") {
    pullRequest(number: 131) {
      reviewThreads(first: 15) {
        nodes {
          comments(first: 5) {
            nodes {
              body
              bodyHTML
              author { login }
            }
          }
        }
      }
    }
  }
}

Result: Both body and bodyHTML contain only prose. Checked every Copilot comment:

{"has_suggestion_in_body": false, "has_suggestion_in_html": false}
// ... repeated for all 9 comments

4. GraphQL — suggestedChanges field

Attempted to query suggestedChanges on PullRequestReviewComment:

suggestedChanges(first: 5) {
  nodes { suggestion, originalStartLine, originalEndLine }
}

Result: Field 'suggestedChanges' doesn't exist on type 'PullRequestReviewComment'

5. Community MCP server (@modelcontextprotocol/server-github)

Also tested with the community npm-based server — identical results: prose only, no suggestion code blocks.

What the GitHub web UI shows vs what the API returns

In the GitHub web UI, each Copilot review comment has two sections:

  • The prose text (e.g., "This test module is collected by default...")
  • A "Suggest" panel with a green-highlighted code diff and "Commit suggestion" / "Add to batch" buttons
Image

Through any API, only the prose text is returned. The suggested code changeset is completely absent. It appears these suggestion diffs are either:

  • Rendered client-side by GitHub's UI JavaScript and never persisted as part of the comment body
  • Stored in a proprietary Copilot-internal data structure not exposed through any public API
  • Attached to the comment via a mechanism that has no corresponding REST/GraphQL field

This is fundamentally different from human-written suggestions, which use ```suggestion ``` markdown syntax embedded directly in the comment body and ARE returned by all APIs.

Proposed solution

Expose Copilot's generated code suggestions through the API so that MCP-connected agents can read them. This could take several forms:

Option A (Preferred): Include suggestion blocks in the comment body

Store Copilot's suggestions as standard ```suggestion ``` markdown in the comment body, identical to how human-written suggestions work. This would require zero API changes — the existing body field would just contain the full content.

Option B: Add a suggestedChanges field to PullRequestReviewComment in GraphQL

type PullRequestReviewComment {
  # ... existing fields ...
  suggestedChanges: SuggestedChangeConnection
}

type SuggestedChange {
  suggestion: String!       # The suggested replacement code
  originalStartLine: Int!   # Start line in the diff
  originalEndLine: Int!     # End line in the diff
  path: String!             # File path
}

Then the MCP server's pull_request_read (method: get_review_comments) could include these in its response.

Option C: Add a REST API field

Add a suggested_changes array to the review comment REST response:

{
  "id": 2951701990,
  "body": "This test module is collected by default...",
  "suggested_changes": [
    {
      "original_start_line": 1,
      "original_end_line": 15,
      "suggestion": "import pytest\n\npytest.importorskip(\n    \"torch\",\n    reason=\"...\",\n)\n..."
    }
  ]
}

Example prompts or workflows (for tools/toolsets only)

1. Evaluate Copilot suggestions before committing

"Fetch all of Copilot's review comments on PR #131 including their suggested code changes, and tell me which ones are safe to commit"

Agent reads review threads with suggestion diffs, analyzes each suggestion against the codebase context, and provides a recommendation per suggestion.

2. Batch-commit safe suggestions

"For each Copilot suggestion on this PR, if it's a pure import guard or test marker change, commit it automatically"

Agent reads suggestions, filters by category, and commits the safe ones via add_comment_to_pending_review or the suggestions API.

3. Generate counter-suggestions

"Read Copilot's suggested changes and propose alternative implementations where you disagree"

Agent reads the actual code diffs Copilot proposed, compares with its own analysis, and replies with alternative ```suggestion ``` blocks.

4. Audit Copilot review quality

"Compare what Copilot suggested vs what the codebase actually needs and rate each suggestion"

Agent needs both the prose rationale AND the concrete code change to evaluate correctness. Currently only the prose is available.

Additional context

Scope of the problem:
This affects ALL Copilot-generated PR reviews. Every time Copilot reviews a PR and generates "Suggest" changesets (which is the majority of Copilot reviews), those changesets are invisible to any API consumer. Only the prose description is accessible.

Note: This issue is upstream of the MCP server — it's fundamentally a GitHub platform/API limitation. The MCP server correctly returns everything the GitHub API provides. However, filing here because:

  1. The MCP server is the primary interface AI agents use to interact with GitHub
  2. The MCP server team has direct access to internal GitHub APIs and could surface this data even if the public REST/GraphQL APIs don't expose it yet
  3. This is a critical gap for the "AI agents reviewing code" workflow that the MCP server is designed to enable

Affected version:

github-mcp-server latest (ghcr.io/github/github-mcp-server:latest)
Docker image digest: sha256:a9dd39eec67f09ded51631c79641dd72acb4945c6391df47824fa2d508b5431b

Environment:

  • Docker 28.5.1 on Windows 11
  • GitHub token: OAuth (gho_***) with scopes gist, read:org, repo, workflow
  • Also tested with community @modelcontextprotocol/server-github via npx

Reference PR used for testing: zai-org/GLM-OCR#131 (9 Copilot review comments, all with "Suggest" changesets visible in web UI, none returned via API)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions