Skip to content

[WIP] Restore main safe output prompt using safe output tools#4730

Merged
pelikhan merged 3 commits into
mainfrom
copilot/bring-back-safe-output-prompt
Nov 25, 2025
Merged

[WIP] Restore main safe output prompt using safe output tools#4730
pelikhan merged 3 commits into
mainfrom
copilot/bring-back-safe-output-prompt

Conversation

Copilot AI commented Nov 25, 2025

Copy link
Copy Markdown
Contributor
  • Understand the problem: agents try to use gh CLI instead of safe output MCP tools
  • Create safe_outputs_prompt.md with instructions about using safeoutputs MCP server
  • Embed the prompt in sh.go
  • Create safe_outputs_prompt.go with the generateSafeOutputsPromptStep function
  • Add call to generateSafeOutputsPromptStep in compiler_yaml.go when safe-outputs are configured
  • Create tests for the safe outputs prompt step
  • Run unit tests and fix test failure (prompt format causing false positive in job detection)
  • Run agent-finish to validate all workflows compile correctly
  • Request code review
  • Run security scan (CodeQL)
  • Remove available-tools list from prompt (tools are discoverable via MCP)
Original prompt

Bring back the main safe output prompt of the merged PR #4719

the agent should use safe output tools instead of trying to use gh. gh auth = false ==> gh ... ==> error.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot continue work

…f gh CLI

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Nov 25, 2025

Copy link
Copy Markdown
Contributor Author

@copilot continue work

Added a safe outputs prompt that instructs agents to use the safeoutputs MCP server tools instead of gh CLI (which is not authenticated). The prompt is injected when safe-outputs are configured in the workflow. See commit 9a54ffc.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Comment thread pkg/workflow/sh/safe_outputs_prompt.md Outdated
Comment on lines +12 to +36
<available-tools>
The safeoutputs MCP server provides these tools:
- create_issue - Create GitHub issues
- create_discussion - Create GitHub discussions
- add_comment - Add comments to issues, PRs, or discussions
- create_pull_request - Create pull requests
- create_pull_request_review_comment - Add review comments on PR code
- add_labels - Add labels to issues or PRs
- add_reviewer - Add reviewers to pull requests
- update_issue - Update issue status, title, or body
- close_issue - Close issues with a comment
- close_discussion - Close discussions with a comment
- close_pull_request - Close PRs without merging
- push_to_pull_request_branch - Push changes to PR branches
- assign_milestone - Assign issues to milestones
- assign_to_agent - Assign GitHub Copilot agent to issues
- create_agent_task - Create GitHub Copilot agent tasks
- create_code_scanning_alert - Create code scanning alerts
- upload_asset - Publish files as URL-addressable assets
- update_release - Update release descriptions
- noop - Log completion messages for transparency
- missing_tool - Report missing tools or functionality
</available-tools>

<reminder>Use these MCP tools instead of gh CLI commands for all GitHub API operations.</reminder>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot remove part of the prompt

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the <available-tools> list and <reminder> from the prompt. Tools are discoverable via MCP server. See commit bc67554.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review November 25, 2025 14:01
Copilot AI review requested due to automatic review settings November 25, 2025 14:01

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

This PR restores the main safe output prompt functionality that instructs AI agents to use safe output MCP tools instead of attempting to use the unauthenticated GitHub CLI. The change addresses an issue where agents were trying to use gh CLI commands for GitHub API operations, which fail because gh is not authenticated in the workflow environment.

Key Changes

  • Added a new prompt file (safe_outputs_prompt.md) with instructions about using safeoutputs MCP server
  • Integrated the prompt generation into the compiler workflow when safe-outputs are configured
  • Created comprehensive tests to validate the prompt generation behavior

Reviewed changes

Copilot reviewed 81 out of 81 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/workflow/sh/safe_outputs_prompt.md New prompt template instructing agents to use safeoutputs MCP server instead of gh CLI
pkg/workflow/sh.go Embedded the safe outputs prompt text using go:embed directive
pkg/workflow/safe_outputs_prompt.go New function to generate safe outputs prompt step using the helper pattern
pkg/workflow/safe_outputs_prompt_test.go Tests validating prompt generation when enabled/disabled and XML structure
pkg/workflow/compiler_yaml.go Integrated safe outputs prompt step into workflow compilation process
.github/workflows/*.lock.yml Regenerated lock files showing the prompt step in compiled workflows

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

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@pelikhan pelikhan merged commit 5d6c423 into main Nov 25, 2025
61 checks passed
@pelikhan pelikhan deleted the copilot/bring-back-safe-output-prompt branch November 25, 2025 14:30
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.

3 participants