Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,7 @@ For negotiated supported protocol versions `2026-07-28` or newer, the consolidat
- `owner`: Repository owner (string, required)
- `pullNumber`: Pull request number (number, required)
- `repo`: Repository name (string, required)
- `resolutionReason`: Optional reason for resolving a Copilot code review thread: addressed, wont-fix, or invalid. (string, optional)
- `threadId`: The node ID of the review thread (e.g., PRRT_kwDOxxx). Required for resolve_thread and unresolve_thread methods. Get thread IDs from pull_request_read with method get_review_comments. (string, optional)

- **search_pull_requests** - Search pull requests
Expand Down
15 changes: 1 addition & 14 deletions docs/feature-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ as output formatting) won't appear here.

- **resolve_review_thread** - Resolve Review Thread
- **OAuth Challenge Scopes**: `repo`
- `resolutionReason`: Optional reason for resolving a Copilot code review thread: addressed, wont-fix, or invalid. (string, optional)
- `threadID`: The node ID of the review thread to resolve (e.g., PRRT_kwDOxxx) (string, required)

- **submit_pending_pull_request_review** - Submit Pending Pull Request Review
Expand Down Expand Up @@ -629,18 +630,4 @@ as output formatting) won't appear here.
- `perPage`: Results per page for pagination (min 0, max 100). Zero is forwarded for the GitHub API default. (number, optional)
- `repo`: The name of the repository (string, required)

### `thread_resolution_reason`

- **pull_request_review_write** - Write operations (create, submit, delete) on pull request reviews
- **OAuth Challenge Scopes**: `repo`
- `body`: Review comment text (string, optional)
- `commitID`: SHA of commit to review (string, optional)
- `event`: Review action to perform. (string, optional)
- `method`: The write operation to perform on pull request review. (string, required)
- `owner`: Repository owner (string, required)
- `pullNumber`: Pull request number (number, required)
- `repo`: Repository name (string, required)
- `resolutionReason`: Optional reason for resolving a Copilot code review thread: addressed, wont-fix, or invalid. (string, optional)
- `threadId`: The node ID of the review thread (e.g., PRRT_kwDOxxx). Required for resolve_thread and unresolve_thread methods. Get thread IDs from pull_request_read with method get_review_comments. (string, optional)

<!-- END AUTOMATED FEATURE FLAG TOOLS -->
9 changes: 9 additions & 0 deletions pkg/github/__toolsnaps__/pull_request_review_write.snap
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
"description": "Repository name",
"type": "string"
},
"resolutionReason": {
"description": "Optional reason for resolving a Copilot code review thread: addressed, wont-fix, or invalid.",
"enum": [
"addressed",
"wont-fix",
"invalid"
],
"type": "string"
},
"threadId": {
"description": "The node ID of the review thread (e.g., PRRT_kwDOxxx). Required for resolve_thread and unresolve_thread methods. Get thread IDs from pull_request_read with method get_review_comments.",
"type": "string"
Expand Down

This file was deleted.

9 changes: 9 additions & 0 deletions pkg/github/__toolsnaps__/resolve_review_thread.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
],
"inputSchema": {
"properties": {
"resolutionReason": {
"description": "Optional reason for resolving a Copilot code review thread: addressed, wont-fix, or invalid.",
"enum": [
"addressed",
"wont-fix",
"invalid"
],
"type": "string"
},
"threadID": {
"description": "The node ID of the review thread to resolve (e.g., PRRT_kwDOxxx)",
"type": "string"
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions pkg/github/consolidated_pull_request_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ func normalizePullRequestReviewWriteArguments(raw json.RawMessage) (json.RawMess
"method": params.Method, "owner": params.Owner, "repo": params.Repo, "pullNumber": params.PullNumber,
}
// Empty optional strings are equivalent to omitted ones for the handler,
// but would fail the schema's enum for event.
// but would fail the schema's enums for event and resolutionReason.
for key, value := range map[string]string{"body": params.Body, "event": params.Event, "threadId": params.ThreadID} {
if value != "" {
canonical[key] = value
Expand All @@ -607,7 +607,7 @@ func normalizePullRequestReviewWriteArguments(raw json.RawMessage) (json.RawMess
if params.CommitID != nil {
canonical["commitID"] = *params.CommitID
}
if params.ResolutionReason != nil {
if params.ResolutionReason != nil && *params.ResolutionReason != "" {
canonical["resolutionReason"] = *params.ResolutionReason
}
for key := range args {
Expand Down
4 changes: 0 additions & 4 deletions pkg/github/feature_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ const FeatureFlagAgentAutomations = "agent_automations"
// opt-in.
const FeatureFlagDuplicateDetection = "duplicate_detection"

// FeatureFlagThreadResolutionReason exposes resolution reasons for Copilot review threads.
const FeatureFlagThreadResolutionReason = "thread_resolution_reason"

// FeatureFlagSkillsExtension replaces server instructions with MCP-served skills.
const FeatureFlagSkillsExtension = "skills"

Expand All @@ -64,7 +61,6 @@ var AllowedFeatureFlags = []string{
FeatureFlagIssueArtifacts,
FeatureFlagAgentAutomations,
FeatureFlagDuplicateDetection,
FeatureFlagThreadResolutionReason,
FeatureFlagSkillsExtension,
}

Expand Down
20 changes: 2 additions & 18 deletions pkg/github/feature_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ func TestResolveFeatureFlags(t *testing.T) {
insidersMode: false,
expectedFlags: []string{FeatureFlagIssuesGranular},
},
{
name: "thread resolution reason can be directly enabled",
enabledFeatures: []string{FeatureFlagThreadResolutionReason},
expectedFlags: []string{FeatureFlagThreadResolutionReason},
},
{
name: "agent automations can be directly enabled",
enabledFeatures: []string{FeatureFlagAgentAutomations},
Expand Down Expand Up @@ -253,36 +248,25 @@ func TestThreadResolutionReasonToolVariants(t *testing.T) {
toolName string
hasReason bool
}{
{
name: "consolidated flag off",
toolName: "pull_request_review_write",
},
{
name: "consolidated flag on",
flags: []inventory.FeatureFlag{FeatureFlagThreadResolutionReason},
toolName: "pull_request_review_write",
hasReason: true,
},
{
name: "granular flag off",
flags: []inventory.FeatureFlag{inventory.FeatureFlag(FeatureFlagPullRequestsGranular)},
toolName: "resolve_review_thread",
},
{
name: "granular flag on",
flags: []inventory.FeatureFlag{inventory.FeatureFlag(FeatureFlagPullRequestsGranular), FeatureFlagThreadResolutionReason},
flags: []inventory.FeatureFlag{inventory.FeatureFlag(FeatureFlagPullRequestsGranular)},
toolName: "resolve_review_thread",
hasReason: true,
},
{
name: "consolidated flag on GHES",
flags: []inventory.FeatureFlag{FeatureFlagThreadResolutionReason},
host: utils.HostTypeGHES,
toolName: "pull_request_review_write",
},
{
name: "granular flag on GHES",
flags: []inventory.FeatureFlag{inventory.FeatureFlag(FeatureFlagPullRequestsGranular), FeatureFlagThreadResolutionReason},
flags: []inventory.FeatureFlag{inventory.FeatureFlag(FeatureFlagPullRequestsGranular)},
host: utils.HostTypeGHES,
toolName: "resolve_review_thread",
},
Expand Down
6 changes: 5 additions & 1 deletion pkg/github/granular_pull_request_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ func normalizeGranularPullRequestFields(args map[string]any, kind string) error
return err
}
if kind == "resolve_reason" {
_, _, err := OptionalParamOK[string](args, "resolutionReason")
reason, _, err := OptionalParamOK[string](args, "resolutionReason")
if reason == "" {
// An empty reason means none and would fail the schema's enum.
delete(args, "resolutionReason")
}
return err
}
delete(args, "resolutionReason")
Expand Down
22 changes: 11 additions & 11 deletions pkg/github/granular_tools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
transportpkg "github.com/github/github-mcp-server/v2/pkg/http/transport"
"github.com/github/github-mcp-server/v2/pkg/inventory"
"github.com/github/github-mcp-server/v2/pkg/translations"
"github.com/github/github-mcp-server/v2/pkg/utils"
gogithub "github.com/google/go-github/v92/github"
"github.com/shurcooL/githubv4"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -1711,18 +1712,17 @@ func TestGranularAddPullRequestReviewComment(t *testing.T) {

func TestGranularResolveReviewThread(t *testing.T) {
tests := []struct {
name string
withResolutionReason bool
resolutionReason *string
expectedReason *string
name string
ghes bool
resolutionReason *string
expectedReason *string
}{
{
name: "enabled variant forwards resolution reason",
withResolutionReason: true,
resolutionReason: new("addressed"),
expectedReason: new("addressed"),
name: "enabled variant forwards resolution reason",
resolutionReason: new("addressed"),
expectedReason: new("ADDRESSED"),
},
{name: "default variant omits resolution reason", resolutionReason: new("addressed")},
{name: "GHES omits resolution reason", ghes: true, resolutionReason: new("addressed")},
{name: "without resolution reason"},
}

Expand Down Expand Up @@ -1753,8 +1753,8 @@ func TestGranularResolveReviewThread(t *testing.T) {
gqlClient := githubv4.NewClient(mockedClient)
deps := BaseDeps{GQLClient: gqlClient}
serverTool := GranularResolveReviewThread(translations.NullTranslationHelper)
if tc.withResolutionReason {
serverTool = GranularResolveReviewThreadWithResolutionReason(translations.NullTranslationHelper)
if tc.ghes {
serverTool = GranularResolveReviewThread(translations.NullTranslationHelper, WithHost(utils.HostTypeGHES))
}
handler := serverTool.Handler(deps)

Expand Down
Loading
Loading