Skip to content

Suggested test: copilot/mcp-custom-env-secret #4245

Description

@github-actions

Motivation

Link to the gh-aw PR: github/gh-aw#41801 — fix: prevent double-escape of custom MCP server env/header secrets in generated lock files

Since v0.81.2, custom MCP server env (and HTTP headers) secrets containing ${{ secrets.X }} expressions were double-escaped in generated .lock.yml files, causing the MCP gateway to fail with Configuration is not valid JSON / Bad escaped character in JSON. The fix was merged but no E2E regression test exists.

Proposed test

  • Workflow file: test-copilot-mcp-custom-env-secret.md
  • Trigger: workflow_dispatch
  • Engine: copilot
  • Safe output: add-comment or noop (to confirm the MCP server started successfully)
  • Variant: standard

Minimal test prompt sketch

Define a workflow with a custom MCP server that includes an env: block using a ${{ secrets.SOME_SECRET }} expression (or a non-secret placeholder). On trigger, the agent should call a tool from that custom MCP server and emit a comment or noop confirming success. A failure at MCP gateway startup (due to double-escaped JSON) would cause the workflow to fail, providing a regression signal.

New fixtures or secrets needed

A real secret value is needed in githubnext/gh-aw-test for the MCP server env, OR the test can use a placeholder non-secret env value if the gateway accepts that without authentication. This is the main open question: identify a publicly available MCP server (or use the existing shared/mcp/ definitions) whose startup can be verified with an env variable.

Notes

  • test-copilot-mcp-printEnv.md already tests MCP env variable visibility, but uses a built-in MCP server, not a custom server with env: secrets.
  • This test specifically targets the renderSharedMCPConfig / writeJSONStringMapSectionRaw code path introduced in #41801.
  • If a suitable public MCP server with env configuration is not available, the test could verify only the compiled lock file output (compile-time regression), though runtime verification is preferred.

Generated by 🔍 Suggest New E2E Tests · 57 AIC · ⌖ 7.31 AIC · ⊞ 5.9K ·

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions