-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Export GraphQLFeaturesTransport and WithGraphQLFeatures for remote server support #1809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: SamMorrowDrums <[email protected]>
Co-authored-by: SamMorrowDrums <[email protected]>
pkg/github/issues.go
Outdated
| // 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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Co-authored-by: SamMorrowDrums <[email protected]>
pkg/github/transport.go
Outdated
| // 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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Vysakh131101
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𝐈𝐒_𝐌𝐄_𝐔𝐍𝐍𝐈_𝗠𝗗_𝗕𝗢𝗧
Co-authored-by: SamMorrowDrums <[email protected]>
Summary
Remote server's HTTP transport doesn't read
GraphQL-Featuresfrom context, causingassign_copilot_to_issueto 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_supportfeature flag must be sent viaGraphQL-Featuresheader for Copilot assignment API. Remote server needs library support to implement this correctly and write tests.What changed
GraphQLFeaturesTransporttopkg/github/transport.goas reusable, exported typetransport.gofor better code organizationWithGraphQLFeaturesfunction to allow remote server to set feature flags in test contextsGetGraphQLFeaturesfunction to allow custom transports to read feature flags from contextDefaultTransport→bearerAuthTransport→GraphQLFeaturesTransportbearerAuthTransportMCP impact
assign_copilot_to_issuebehavior unchangedSecurity / limits
Tool renaming
Lint & tests
./script/lint./script/testDocs
Usage for remote server
Wrap GraphQL HTTP client with the exported transport:
In tests, use
WithGraphQLFeaturesto simulate feature flag contexts:Transport automatically reads feature flags from context via
GetGraphQLFeaturesand addsGraphQL-Featuresheader when present.Original prompt
assign_copilot_to_issuefails with GraphQL schema error:agentAssignmentfield not defined onUpdateIssueInput#1805💡 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.