Copilot-generated PR review code suggestions ("Suggest" changesets) are not returned by pull_request_read or any API
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- github, go
- Lĩnh vực
- api, backend-api-design
Hướng nghiên cứu
Bắt đầu từ entry point pull_request_read get_review_comments và tái hiện trường hợp thiếu dữ liệu với zai-org/GLM-OCR#131. So sánh các review comment được trả về với các đề xuất của Copilot hiển thị trong giao diện web và các kết quả REST/GraphQL được mô tả ở đây. Được xem là hoàn tất khi các changeset của đề xuất được cung cấp thông qua phản hồi MCP, tùy thuộc vào việc có sẵn một bề mặt API GitHub.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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:
- Prose commentary — a text description of the issue found (e.g., "Consider adding pydantic validation...")
- 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: https://github.com/zai-org/GLM-OCR/pull/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
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:
- The MCP server is the primary interface AI agents use to interact with GitHub
- 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
- 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 scopesgist,read:org,repo,workflow - Also tested with community
@modelcontextprotocol/server-githubvia npx
Reference PR used for testing: https://github.com/zai-org/GLM-OCR/pull/131 (9 Copilot review comments, all with "Suggest" changesets visible in web UI, none returned via API)
- Ngôn ngữ chính
- Go
- Star
- 33.1k
- Fork
- 5k
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 25
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/github-mcp-server
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
github/github-mcp-server#3235 ·
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
github/github-mcp-server#3042 · 2 bình luận ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/github-mcp-server#3032 · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
github/github-mcp-server#2803 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
github/github-mcp-server#2740 ·
Tất cả issue của github/github-mcp-server
Issue tương tự
-
textual definition
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
geneontology/go-ontology#32653 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
-
needs design
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Priority/High ready-for-agent Severity/Major Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100