Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

Summary

Remote server's HTTP transport doesn't read GraphQL-Features from context, causing assign_copilot_to_issue to fail with schema validation errors. This PR extracts and exports a reusable transport and helper functions for both local and remote servers.

Why

The issues_copilot_assignment_api_support feature flag must be sent via GraphQL-Features header for Copilot assignment API. Remote server needs library support to implement this correctly and write tests.

What changed

  • Extracted GraphQLFeaturesTransport to pkg/github/transport.go as reusable, exported type
  • Moved all GraphQL features-related functions to transport.go for better code organization
  • Exported WithGraphQLFeatures function to allow remote server to set feature flags in test contexts
  • Exported GetGraphQLFeatures function to allow custom transports to read feature flags from context
  • Refactored local server to layer transports: DefaultTransportbearerAuthTransportGraphQLFeaturesTransport
  • Removed duplicate GraphQL-Features logic from bearerAuthTransport
  • Enhanced documentation for all exported functions with usage examples

MCP impact

  • No tool or API changes — Internal refactoring only; assign_copilot_to_issue behavior unchanged

Security / limits

  • No security or limits impact — Transport reads existing context values, no new data exposure

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Updated (README / docs / examples) — Added usage examples in transport.go godoc

Usage for remote server

Wrap GraphQL HTTP client with the exported transport:

httpClient := &http.Client{
    Transport: &github.GraphQLFeaturesTransport{
        Transport: yourAuthTransport,
    },
}
gqlClient := githubv4.NewClient(httpClient)

In tests, use WithGraphQLFeatures to simulate feature flag contexts:

ctx := github.WithGraphQLFeatures(context.Background(), "issues_copilot_assignment_api_support")

Transport automatically reads feature flags from context via GetGraphQLFeatures and adds GraphQL-Features header when present.

Original prompt

This section details on the original issue you should resolve

<issue_title>assign_copilot_to_issue fails with GraphQL schema error: agentAssignment field not defined on UpdateIssueInput</issue_title>
<issue_description>### Describe the bug

The assign_copilot_to_issue tool fails with a GraphQL schema validation error when attempting to assign Copilot to an issue. The error indicates that the agentAssignment field is not defined on the UpdateIssueInput type.

Affected version

Using the MCP server integrated with VS Code Copilot (remote MCP).

Steps to reproduce the behavior

  1. Enable the GitHub MCP server in VS Code
  2. Create an issue in a repository that has Copilot coding agent enabled
  3. Attempt to assign Copilot to the issue using the assign_copilot_to_issue tool with valid owner, repo, and issue_number parameters

Expected vs actual behavior

Expected: Copilot should be assigned to the issue.

Actual: The tool returns an error:

failed to update issue with agent assignment: Variable $input of type UpdateIssueInput! was provided invalid value for agentAssignment (Field is not defined on UpdateIssueInput)

Logs

ERROR while calling tool: MPC 0: failed to update issue with agent assignment: Variable $input of type UpdateIssueInput! was provided invalid value for agentAssignment (Field is not defined on UpdateIssueInput)

Created with GitHub Copilot. This issue was written with AI assistance.</issue_description>

Comments on the Issue (you are @copilot in this section)

@SamMorrowDrums https://github.com//pull/1779 This is the code that introduced it, and this is the documentation: https://github.blog/changelog/2025-12-03-assign-issues-to-copilot-using-the-api/ are you perhaps opted out of some behaviour that would prevent this explicitly? @SamMorrowDrums I can reporoduce though `Error: MPC 0: failed to update issue with agent assignment: Variable $input of type UpdateIssueInput! was provided invalid value for agentAssignment (Field is not defined on UpdateIssueInput)`

So I need to investigate.</comment_new>
<comment_new>@TylerDixon
👋 @C-Ross Did this happen to be from a personal, non-staff account?</comment_new>
<comment_new>@C-Ross
@TylerDixon No, this is my primary staff enabled account (frankly I don't have any others). I was actively using the same account to interact with GitHub repos and used the same account to successfully assign copilot from the UI.</comment_new>
<comment_new>@SamMorrowDrums
We confirmed that this is isolated to the remote server, due to a minor difference in the GraphQL http roundtripper that means the required feature flag is not being set on the remote server only. A fix is ready and will be deployed once reviewed.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix GraphQL schema error in assign_copilot_to_issue Export GraphQLFeaturesTransport for remote server GraphQL-Features header support Jan 14, 2026
Copilot AI requested a review from SamMorrowDrums January 14, 2026 11:36
// to read feature flags and add them as the "GraphQL-Features" header.
//
// For most use cases, use GraphQLFeaturesTransport instead of calling this directly.
func GetGraphQLFeatures(ctx context.Context) []string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot should we move all this GetGraphQLFeatures etc. to the transport file? It makes more sense there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Moved graphQLFeaturesKey, withGraphQLFeatures, and GetGraphQLFeatures to transport.go where they logically belong with GraphQLFeaturesTransport. Commit: 7333546

// withGraphQLFeatures adds GraphQL feature flags to the context.
// The flags are read by GraphQLFeaturesTransport and sent as the GraphQL-Features header.
// This is used internally by tool handlers that require experimental GitHub API features.
func withGraphQLFeatures(ctx context.Context, features ...string) context.Context {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot export this please, so the remote server can use in tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exported! Renamed withGraphQLFeatures to WithGraphQLFeatures and updated all references. Remote server can now use it in tests to simulate feature flag contexts. Commit: 27ee7e4

Copy link

@Vysakh131101 Vysakh131101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

𝐈𝐒_𝐌𝐄_𝐔𝐍𝐍𝐈_𝗠𝗗_𝗕𝗢𝗧

Copilot AI changed the title Export GraphQLFeaturesTransport for remote server GraphQL-Features header support Export GraphQLFeaturesTransport and WithGraphQLFeatures for remote server support Jan 14, 2026
Copilot AI requested a review from SamMorrowDrums January 14, 2026 12:56
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.

assign_copilot_to_issue fails with GraphQL schema error: agentAssignment field not defined on UpdateIssueInput

3 participants