From 94bc5c3214af9d937ebc8f8beabd2e8ed1db7b6b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 13:00:08 +0000 Subject: [PATCH 1/2] Initial plan From 27313fdc8f91936ddf36949c6d230d784af362cd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 13:08:14 +0000 Subject: [PATCH 2/2] Export WithGraphQLFeatures function for remote server usage - Renamed withGraphQLFeatures to WithGraphQLFeatures to export it - This allows the remote server to add GraphQL feature flags to context - Added comprehensive tests for GraphQL features context functions - All tests pass and linter reports no issues Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com> --- pkg/github/issues.go | 6 +++--- pkg/github/issues_test.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/pkg/github/issues.go b/pkg/github/issues.go index 63174c9e9..d6af14abb 100644 --- a/pkg/github/issues.go +++ b/pkg/github/issues.go @@ -1789,7 +1789,7 @@ func AssignCopilotToIssue(t translations.TranslationHelperFunc) inventory.Server // Add the GraphQL-Features header for the agent assignment API // The header will be read by the HTTP transport if it's configured to do so - ctxWithFeatures := withGraphQLFeatures(ctx, "issues_copilot_assignment_api_support") + ctxWithFeatures := WithGraphQLFeatures(ctx, "issues_copilot_assignment_api_support") if err := client.Mutate( ctxWithFeatures, @@ -1917,8 +1917,8 @@ func AssignCodingAgentPrompt(t translations.TranslationHelperFunc) inventory.Ser // graphQLFeaturesKey is a context key for GraphQL feature flags type graphQLFeaturesKey struct{} -// withGraphQLFeatures adds GraphQL feature flags to the context -func withGraphQLFeatures(ctx context.Context, features ...string) context.Context { +// WithGraphQLFeatures adds GraphQL feature flags to the context +func WithGraphQLFeatures(ctx context.Context, features ...string) context.Context { return context.WithValue(ctx, graphQLFeaturesKey{}, features) } diff --git a/pkg/github/issues_test.go b/pkg/github/issues_test.go index 21e78874a..bf88a0ad7 100644 --- a/pkg/github/issues_test.go +++ b/pkg/github/issues_test.go @@ -3723,3 +3723,31 @@ func Test_ListIssueTypes(t *testing.T) { }) } } + +// TestGraphQLFeatures tests the exported GraphQL features context functions +func TestGraphQLFeatures(t *testing.T) { + ctx := context.Background() + + // Test that GetGraphQLFeatures returns nil when no features are set + features := GetGraphQLFeatures(ctx) + require.Nil(t, features) + + // Test WithGraphQLFeatures adds features to context + ctxWithFeatures := WithGraphQLFeatures(ctx, "feature1", "feature2") + features = GetGraphQLFeatures(ctxWithFeatures) + require.NotNil(t, features) + require.Len(t, features, 2) + assert.Equal(t, "feature1", features[0]) + assert.Equal(t, "feature2", features[1]) + + // Test that the original context is not modified + features = GetGraphQLFeatures(ctx) + require.Nil(t, features) + + // Test WithGraphQLFeatures with single feature + ctxWithOneFeature := WithGraphQLFeatures(ctx, "issues_copilot_assignment_api_support") + features = GetGraphQLFeatures(ctxWithOneFeature) + require.NotNil(t, features) + require.Len(t, features, 1) + assert.Equal(t, "issues_copilot_assignment_api_support", features[0]) +}