Skip to content

fix: restore MCP CLI concept explanation and fix safeoutputs framing#39689

Merged
dsyme merged 7 commits into
mainfrom
fix/mcp-cli-prompt-framing
Jun 16, 2026
Merged

fix: restore MCP CLI concept explanation and fix safeoutputs framing#39689
dsyme merged 7 commits into
mainfrom
fix/mcp-cli-prompt-framing

Conversation

@dsyme

@dsyme dsyme commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two related fixes to the safeoutputs integration:

  1. Path fix (e00e9395b, 71bdb4eca, cec086741): The safe_outputs_mcp_server.cjs entrypoint was hardcoded to ${GITHUB_WORKSPACE}/actions/setup/js/. This is corrected to ${RUNNER_TEMP}/gh-aw/safeoutputs/, where the script is actually deployed at runtime. All MCP config renderers (JSON Copilot, JSON Claude, TOML) and their corresponding unit and integration tests are updated.

  2. Framing fix (b57fdf2f1): Agent prompts and internal comments incorrectly described safeoutputs as an MCP tool interface. The MCP CLI tools prompt is rewritten to clarify that the listed servers are CLI executables invoked with --name value flags or JSON via stdin, not MCP tool endpoints. The safe outputs prompt is updated to instruct agents to use the safeoutputs CLI command. A write-intent warning is also added to the MCP CLI tools prompt.

Breaking change in pkg/workflow/mcp_renderer_builtin.go: any previously generated gateway configs pointing to the old ${GITHUB_WORKSPACE}/actions/setup/js/ path will no longer match the rendered output.


Changed files

File Kind Impact Notes
pkg/workflow/mcp_renderer_builtin.go modified high / breaking Core path change: ${GITHUB_WORKSPACE}/actions/setup/js/${RUNNER_TEMP}/gh-aw/safeoutputs/ for both JSON and TOML renderers
actions/setup/md/mcp_cli_tools_prompt.md modified medium Rewritten to clarify CLI-executable semantics, added --name value and JSON-stdin examples, added write-intent warning
actions/setup/md/safe_outputs_prompt.md modified medium Agents now instructed to use safeoutputs CLI command, not the MCP server tool interface
pkg/workflow/mcp_config_refactor_test.go modified medium Test assertions updated for new ${RUNNER_TEMP}/gh-aw/safeoutputs/ path
pkg/workflow/mcp_renderer_test.go modified medium Test assertions for all three config formats (JSON Copilot, JSON Claude, TOML) updated for new path
pkg/workflow/safe_outputs_mcp_integration_test.go modified medium Integration test assertion updated for new generated workflow YAML path
pkg/workflow/prompts.go modified low Comment updated: "safeoutputs MCP server" → "safeoutputs CLI tool"

Motivation

The safeoutputs script is not present in ${GITHUB_WORKSPACE}/actions/setup/js/ at agent runtime — it is installed under ${RUNNER_TEMP}/gh-aw/safeoutputs/ by the setup action. The mismatch meant the gateway config pointed to a non-existent path, silently breaking safeoutputs for any workflow using the built-in MCP renderer. The framing fix prevents agents from attempting to call safeoutputs as an MCP tool (which would also fail) instead of as a CLI command.


Test coverage

  • Unit tests in mcp_config_refactor_test.go and mcp_renderer_test.go cover all rendered config formats.
  • Integration test in safe_outputs_mcp_integration_test.go validates the path appears correctly in the generated workflow YAML end-to-end.

Checklist

  • Breaking change documented (path change in mcp_renderer_builtin.go)
  • All affected tests updated
  • Prompt/comment language aligned with implementation reality
  • Verify ${RUNNER_TEMP}/gh-aw/safeoutputs/safe_outputs_mcp_server.cjs is reliably present after setup action runs

Generated by PR Description Updater for issue #39689 ·

…39684)

- Restore concept explanation to mcp_cli_tools_prompt.md that was
  stripped by PR #36778: servers are CLI executables on PATH, not MCP
  tools; include usage example and JSON stdin mode
- Fix safe_outputs_prompt.md line 2: 'safeoutputs MCP server tools'
  → 'safeoutputs CLI tool' to match the CLI framing
- Update prompts.go comment to match
Copilot AI review requested due to automatic review settings June 16, 2026 21:56
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores missing agent-facing guidance about MCP CLI “servers” being invoked as shell executables (not via MCP tool interfaces), and fixes contradictory safeoutputs framing in the generated prompts/comments so agents are less likely to misuse the interface.

Changes:

  • Expands mcp_cli_tools_prompt.md to reintroduce a concise CLI mental model, with concrete CLI/JSON-stdin examples and safeoutputs write-intent warnings.
  • Updates safe_outputs_prompt.md wording to consistently describe safeoutputs as a CLI tool rather than an “MCP server”.
  • Adjusts a high-level comment in pkg/workflow/prompts.go to match the updated framing.
Show a summary per file
File Description
pkg/workflow/prompts.go Updates prompt-area comment wording for safe outputs framing.
actions/setup/md/safe_outputs_prompt.md Reframes safeoutputs guidance to explicitly reference the CLI tool.
actions/setup/md/mcp_cli_tools_prompt.md Restores abbreviated concept explanation + usage examples for MCP CLI executables.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Comment thread actions/setup/md/mcp_cli_tools_prompt.md
Comment thread actions/setup/md/mcp_cli_tools_prompt.md Outdated
Comment thread pkg/workflow/prompts.go Outdated
dsyme and others added 5 commits June 16, 2026 23:10
…config

PR #39100 introduced the containerized stdio transport for safeoutputs but
hardcoded ${GITHUB_WORKSPACE}/actions/setup/js/safe_outputs_mcp_server.cjs
as the entrypoint. This path only exists in the gh-aw repo's own workspace.

For consumer repos (e.g. github-automation), GITHUB_WORKSPACE is that repo's
checkout which does not contain actions/setup/js/. The gateway container
gets MODULE_NOT_FOUND, crashes with EOF on initialize, and registers 0 tools.
The agent then spends ~30 minutes trying to discover the tool schema before
failing.

Fix: use ${RUNNER_TEMP}/gh-aw/safeoutputs/safe_outputs_mcp_server.cjs —
setup.sh already copies the file there and that directory is mounted rw.

Recompile all 249 lock files.

Observed in: https://github.com/github/github-automation/actions/runs/27647012218
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

✅ smoke-ci: safeoutputs CLI comment + comment-memory run (27652140271)

Generated by 🧪 Smoke CI for issue #39689 ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants