diff --git a/.github/workflows/daily-performance-summary.lock.yml b/.github/workflows/daily-performance-summary.lock.yml index 37a94f4a97..06fd398039 100644 --- a/.github/workflows/daily-performance-summary.lock.yml +++ b/.github/workflows/daily-performance-summary.lock.yml @@ -906,7 +906,6 @@ jobs: type = "http" url = "http://host.docker.internal:$GH_AW_SAFE_INPUTS_PORT" headers = { Authorization = "Bearer $GH_AW_SAFE_INPUTS_API_KEY" } - env_vars = ["GH_AW_SAFE_INPUTS_PORT", "GH_AW_SAFE_INPUTS_API_KEY", "GH_TOKEN"] [mcp_servers.safeoutputs] command = "node" diff --git a/pkg/workflow/mcp_renderer.go b/pkg/workflow/mcp_renderer.go index 7aaec7816c..fb61bd6c59 100644 --- a/pkg/workflow/mcp_renderer.go +++ b/pkg/workflow/mcp_renderer.go @@ -236,24 +236,13 @@ func (r *MCPConfigRendererUnified) RenderSafeInputsMCP(yaml *strings.Builder, sa // renderSafeInputsTOML generates Safe Inputs MCP configuration in TOML format // Uses HTTP transport exclusively func (r *MCPConfigRendererUnified) renderSafeInputsTOML(yaml *strings.Builder, safeInputs *SafeInputsConfig) { - envVars := getSafeInputsEnvVars(safeInputs) - yaml.WriteString(" \n") yaml.WriteString(" [mcp_servers." + constants.SafeInputsMCPServerID + "]\n") yaml.WriteString(" type = \"http\"\n") yaml.WriteString(" url = \"http://host.docker.internal:$GH_AW_SAFE_INPUTS_PORT\"\n") yaml.WriteString(" headers = { Authorization = \"Bearer $GH_AW_SAFE_INPUTS_API_KEY\" }\n") - - // Add environment variables: server config + tool-specific vars - envVarsWithServerConfig := append([]string{"GH_AW_SAFE_INPUTS_PORT", "GH_AW_SAFE_INPUTS_API_KEY"}, envVars...) - yaml.WriteString(" env_vars = [") - for i, envVar := range envVarsWithServerConfig { - if i > 0 { - yaml.WriteString(", ") - } - yaml.WriteString("\"" + envVar + "\"") - } - yaml.WriteString("]\n") + // Note: env_vars is not supported for HTTP transport in MCP configuration + // Environment variables are passed via the workflow job's env: section instead } // RenderAgenticWorkflowsMCP generates the Agentic Workflows MCP server configuration diff --git a/pkg/workflow/safe_inputs_http_codex_test.go b/pkg/workflow/safe_inputs_http_codex_test.go index 4ac691f718..676c219aaf 100644 --- a/pkg/workflow/safe_inputs_http_codex_test.go +++ b/pkg/workflow/safe_inputs_http_codex_test.go @@ -90,13 +90,10 @@ Test safe-inputs HTTP transport for Codex t.Error("Codex config should not use stdio transport with mcp-server.cjs args, should use HTTP") } - // Verify environment variables are included - if !strings.Contains(codexConfigSection, "GH_AW_SAFE_INPUTS_PORT") { - t.Error("Expected GH_AW_SAFE_INPUTS_PORT env var in config") - } - - if !strings.Contains(codexConfigSection, "GH_AW_SAFE_INPUTS_API_KEY") { - t.Error("Expected GH_AW_SAFE_INPUTS_API_KEY env var in config") + // Verify environment variables are NOT in the MCP config (env_vars not supported for HTTP transport) + // They should be in the job's env section instead + if strings.Contains(codexConfigSection, "env_vars") { + t.Error("HTTP MCP servers should not have env_vars in config (not supported for HTTP transport)") } t.Logf("✓ Codex engine correctly uses HTTP transport for safe-inputs") @@ -161,16 +158,13 @@ Test safe-inputs with secrets yamlStr := string(lockContent) codexConfigSection := extractCodexConfigSection(yamlStr) - // Verify tool-specific env vars are included in HTTP transport config - if !strings.Contains(codexConfigSection, "API_KEY") { - t.Error("Expected API_KEY env var in safe-inputs config") - } - - if !strings.Contains(codexConfigSection, "GH_TOKEN") { - t.Error("Expected GH_TOKEN env var in safe-inputs config") + // Verify tool-specific env vars are NOT in the MCP config (env_vars not supported for HTTP) + // They should be passed via the job's env section instead + if strings.Contains(codexConfigSection, "env_vars") { + t.Error("HTTP MCP servers should not have env_vars in config (not supported for HTTP transport)") } - // Verify env vars are set in Setup MCPs step + // Verify env vars are set in Setup MCPs step (this is the correct location for HTTP transport) if !strings.Contains(yamlStr, "API_KEY: ${{ secrets.API_KEY }}") { t.Error("Expected API_KEY secret in Setup MCPs env section") } @@ -179,5 +173,5 @@ Test safe-inputs with secrets t.Error("Expected GH_TOKEN in Setup MCPs env section") } - t.Logf("✓ Codex engine correctly passes secrets through HTTP transport") + t.Logf("✓ Codex engine correctly passes secrets through HTTP transport (via job env, not MCP config)") }