From e088fd9679fb8622649357c1c239ab664a272226 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 13:08:16 +0000 Subject: [PATCH 1/2] Initial plan From 31652d7fcaced8434e83a3bf56a4ede75da01514 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 13:30:15 +0000 Subject: [PATCH 2/2] Replace hardcoded MCP server version strings with constants in test files Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/workflow/codex_engine_test.go | 4 ++-- pkg/workflow/copilot_engine_test.go | 4 ++-- pkg/workflow/copilot_github_mcp_test.go | 8 +++++--- pkg/workflow/github_remote_mode_test.go | 3 ++- pkg/workflow/mcp_config_test.go | 6 ++++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/pkg/workflow/codex_engine_test.go b/pkg/workflow/codex_engine_test.go index 21b85d3d6d..b31fb31959 100644 --- a/pkg/workflow/codex_engine_test.go +++ b/pkg/workflow/codex_engine_test.go @@ -308,7 +308,7 @@ func TestCodexEngineRenderMCPConfig(t *testing.T) { "user_agent = \"test-workflow\"", "startup_timeout_sec = 120", "tool_timeout_sec = 60", - "container = \"ghcr.io/github/github-mcp-server:v0.31.0\"", + fmt.Sprintf("container = \"ghcr.io/github/github-mcp-server:%s\"", constants.DefaultGitHubMCPServerVersion), "env = { \"GITHUB_PERSONAL_ACCESS_TOKEN\" = \"$GH_AW_GITHUB_TOKEN\", \"GITHUB_READ_ONLY\" = \"1\", \"GITHUB_TOOLSETS\" = \"context,repos,issues,pull_requests\" }", "env_vars = [\"GITHUB_PERSONAL_ACCESS_TOKEN\", \"GITHUB_READ_ONLY\", \"GITHUB_TOOLSETS\"]", "GH_AW_MCP_CONFIG_EOF", @@ -318,7 +318,7 @@ func TestCodexEngineRenderMCPConfig(t *testing.T) { "{", "\"mcpServers\": {", "\"github\": {", - "\"container\": \"ghcr.io/github/github-mcp-server:v0.31.0\",", + fmt.Sprintf("\"container\": \"ghcr.io/github/github-mcp-server:%s\",", constants.DefaultGitHubMCPServerVersion), "\"env\": {", "\"GITHUB_LOCKDOWN_MODE\": \"$GITHUB_MCP_LOCKDOWN\",", "\"GITHUB_PERSONAL_ACCESS_TOKEN\": \"$GITHUB_MCP_SERVER_TOKEN\",", diff --git a/pkg/workflow/copilot_engine_test.go b/pkg/workflow/copilot_engine_test.go index cd453f8a2c..638366d9c5 100644 --- a/pkg/workflow/copilot_engine_test.go +++ b/pkg/workflow/copilot_engine_test.go @@ -722,7 +722,7 @@ func TestCopilotEngineRenderGitHubMCPConfig(t *testing.T) { expectedStrs: []string{ `"github": {`, `"type": "stdio",`, - `"container": "ghcr.io/github/github-mcp-server:v0.31.0"`, + `"container": "ghcr.io/github/github-mcp-server:` + string(constants.DefaultGitHubMCPServerVersion) + `"`, `"env": {`, `"GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}"`, `},`, @@ -752,7 +752,7 @@ func TestCopilotEngineRenderGitHubMCPConfig(t *testing.T) { expectedStrs: []string{ `"github": {`, `"type": "stdio",`, - `"container": "ghcr.io/github/github-mcp-server:v0.31.0"`, + `"container": "ghcr.io/github/github-mcp-server:` + string(constants.DefaultGitHubMCPServerVersion) + `"`, `"env": {`, `}`, }, diff --git a/pkg/workflow/copilot_github_mcp_test.go b/pkg/workflow/copilot_github_mcp_test.go index edd9466144..9d30225f62 100644 --- a/pkg/workflow/copilot_github_mcp_test.go +++ b/pkg/workflow/copilot_github_mcp_test.go @@ -5,6 +5,8 @@ package workflow import ( "strings" "testing" + + "github.com/github/gh-aw/pkg/constants" ) func TestRenderGitHubCopilotMCPConfig_AllowedTools(t *testing.T) { @@ -24,7 +26,7 @@ func TestRenderGitHubCopilotMCPConfig_AllowedTools(t *testing.T) { expectedContent: []string{ `"github": {`, `"type": "stdio"`, - `"container": "ghcr.io/github/github-mcp-server:v0.31.0"`, + `"container": "ghcr.io/github/github-mcp-server:` + string(constants.DefaultGitHubMCPServerVersion) + `"`, `"env": {`, `"GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}"`, }, @@ -37,7 +39,7 @@ func TestRenderGitHubCopilotMCPConfig_AllowedTools(t *testing.T) { expectedContent: []string{ `"github": {`, `"type": "stdio"`, - `"container": "ghcr.io/github/github-mcp-server:v0.31.0"`, + `"container": "ghcr.io/github/github-mcp-server:` + string(constants.DefaultGitHubMCPServerVersion) + `"`, `"env": {`, }, unexpectedContent: []string{}, @@ -51,7 +53,7 @@ func TestRenderGitHubCopilotMCPConfig_AllowedTools(t *testing.T) { expectedContent: []string{ `"github": {`, `"type": "stdio"`, - `"container": "ghcr.io/github/github-mcp-server:v0.31.0"`, + `"container": "ghcr.io/github/github-mcp-server:` + string(constants.DefaultGitHubMCPServerVersion) + `"`, `"env": {`, }, unexpectedContent: []string{}, diff --git a/pkg/workflow/github_remote_mode_test.go b/pkg/workflow/github_remote_mode_test.go index 74ffb1469a..00805e1966 100644 --- a/pkg/workflow/github_remote_mode_test.go +++ b/pkg/workflow/github_remote_mode_test.go @@ -8,6 +8,7 @@ import ( "strings" "testing" + "github.com/github/gh-aw/pkg/constants" "github.com/github/gh-aw/pkg/stringutil" "github.com/github/gh-aw/pkg/testutil" @@ -317,7 +318,7 @@ This is a test workflow for GitHub remote mode configuration. t.Errorf("Expected container field but didn't find it in:\n%s", lockContent) } } - if !strings.Contains(lockContent, `ghcr.io/github/github-mcp-server:v0.31.0`) { + if !strings.Contains(lockContent, "ghcr.io/github/github-mcp-server:"+string(constants.DefaultGitHubMCPServerVersion)) { t.Errorf("Expected Docker image but didn't find it in:\n%s", lockContent) } // Should NOT contain HTTP type diff --git a/pkg/workflow/mcp_config_test.go b/pkg/workflow/mcp_config_test.go index 05eaefa43a..9b6cc1bf65 100644 --- a/pkg/workflow/mcp_config_test.go +++ b/pkg/workflow/mcp_config_test.go @@ -3,11 +3,13 @@ package workflow import ( + "fmt" "os" "path/filepath" "strings" "testing" + "github.com/github/gh-aw/pkg/constants" "github.com/github/gh-aw/pkg/stringutil" "github.com/github/gh-aw/pkg/testutil" @@ -38,7 +40,7 @@ tools: // With Docker MCP always enabled, default is docker (not services) expectedType: "docker", expectedCommand: "docker", - expectedDockerImage: "ghcr.io/github/github-mcp-server:v0.31.0", + expectedDockerImage: fmt.Sprintf("ghcr.io/github/github-mcp-server:%s", constants.DefaultGitHubMCPServerVersion), }, } @@ -173,7 +175,7 @@ func TestGenerateGitHubMCPConfig(t *testing.T) { switch tt.expectedType { case "docker": - if !strings.Contains(result, `"container": "ghcr.io/github/github-mcp-server:v0.31.0"`) { + if !strings.Contains(result, fmt.Sprintf(`"container": "ghcr.io/github/github-mcp-server:%s"`, constants.DefaultGitHubMCPServerVersion)) { t.Errorf("Expected container field with GitHub MCP image but got:\n%s", result) } if strings.Contains(result, `"type": "http"`) {