From 023b0ce7511c6244e9d9e2dab595822f84f3b34d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 24 Jan 2026 12:43:37 +0000 Subject: [PATCH 1/4] Initial plan From 6a78c1d970080efa2b8b51d7279ff80145a5d56d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 24 Jan 2026 12:48:17 +0000 Subject: [PATCH 2/4] Initial plan for adding codemod to delete old agent files Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/cli/templates/create-agentic-workflow.md | 2 +- pkg/cli/templates/create-shared-agentic-workflow.md | 2 +- pkg/cli/templates/github-agentic-workflows.md | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/cli/templates/create-agentic-workflow.md b/pkg/cli/templates/create-agentic-workflow.md index 161444b155..1b31386fde 100644 --- a/pkg/cli/templates/create-agentic-workflow.md +++ b/pkg/cli/templates/create-agentic-workflow.md @@ -181,7 +181,7 @@ DO NOT ask all these questions at once; instead, engage in a back-and-forth conv - 📋 **DO NOT include other fields with good defaults** - Let the compiler use sensible defaults unless customization is needed. - Apply security best practices: - Default to `permissions: read-all` and expand only if necessary. - - Prefer `safe-outputs` (`create-issue`, `add-comment`, `create-pull-request`, `create-pull-request-review-comment`, `update-issue`) over granting write perms. + - Prefer `safe-outputs` (`create-issue`, `add-comment`, `create-pull-request`, `create-pull-request-review-comment`, `update-issue`, `dispatch-workflow`) over granting write perms. - For custom write operations to external services (email, Slack, webhooks), use `safe-outputs.jobs:` to create custom safe output jobs. - Constrain `network:` to the minimum required ecosystems/domains. - Use sanitized expressions (`${{ needs.activation.outputs.text }}`) instead of raw event text. diff --git a/pkg/cli/templates/create-shared-agentic-workflow.md b/pkg/cli/templates/create-shared-agentic-workflow.md index 76e0675728..577bc3660c 100644 --- a/pkg/cli/templates/create-shared-agentic-workflow.md +++ b/pkg/cli/templates/create-shared-agentic-workflow.md @@ -34,7 +34,7 @@ You are a conversational chat agent that interacts with the user to design secur **Move Write Operations to Safe Outputs** - Never grant direct write permissions in shared components - Use `safe-outputs:` configuration for all write operations -- Common safe outputs: `create-issue`, `add-comment`, `create-pull-request`, `update-issue` +- Common safe outputs: `create-issue`, `add-comment`, `create-pull-request`, `update-issue`, `dispatch-workflow` - Let consuming workflows decide which safe outputs to enable **Process Agent Output in Safe Jobs** diff --git a/pkg/cli/templates/github-agentic-workflows.md b/pkg/cli/templates/github-agentic-workflows.md index 0724608609..f350e65b03 100644 --- a/pkg/cli/templates/github-agentic-workflows.md +++ b/pkg/cli/templates/github-agentic-workflows.md @@ -568,6 +568,14 @@ The YAML frontmatter supports these fields: target-repo: "owner/repo" # Optional: cross-repository ``` Publishes workflow artifacts to an orphaned git branch for persistent storage. Default allowed extensions include common non-executable types. Maximum file size is 50MB (51200 KB). + - `dispatch-workflow:` - Trigger other workflows with inputs + ```yaml + safe-outputs: + dispatch-workflow: + workflows: [workflow-name] # Required: list of workflow names to allow + max: 3 # Optional: max dispatches (default: 1, max: 3) + ``` + Triggers other agentic workflows in the same repository using workflow_dispatch. Agent output includes `workflow_name` (without .md extension) and optional `inputs` (key-value pairs). Not supported for cross-repository operations. - `create-code-scanning-alert:` - Generate SARIF security advisories ```yaml safe-outputs: From d61b5bb174eeb0bdf7ff2c0b3b4bfc0dadb603b5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 24 Jan 2026 12:57:33 +0000 Subject: [PATCH 3/4] Add codemod to delete old agent files from .github/agents/ Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/cli/copilot-agents.go | 3 +++ pkg/cli/copilot_agents_test.go | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/pkg/cli/copilot-agents.go b/pkg/cli/copilot-agents.go index 9fb5f66a85..80ebd3799b 100644 --- a/pkg/cli/copilot-agents.go +++ b/pkg/cli/copilot-agents.go @@ -305,6 +305,9 @@ func deleteOldAgentFiles(verbose bool) error { "create-agentic-workflow.agent.md", "debug-agentic-workflow.agent.md", "create-shared-agentic-workflow.agent.md", + "create-agentic-workflow.md", + "setup-agentic-workflows.md", + "update-agentic-workflows.md", } // Also delete the dangling singular form file from .github/aw/ diff --git a/pkg/cli/copilot_agents_test.go b/pkg/cli/copilot_agents_test.go index adf9e0f435..ad21ca15be 100644 --- a/pkg/cli/copilot_agents_test.go +++ b/pkg/cli/copilot_agents_test.go @@ -249,6 +249,40 @@ func TestDeleteOldAgentFiles(t *testing.T) { ".github/aw/upgrade-agentic-workflow.md", }, }, + { + name: "deletes old non-.agent.md files from .github/agents", + filesToCreate: []string{ + ".github/agents/create-agentic-workflow.md", + ".github/agents/setup-agentic-workflows.md", + ".github/agents/update-agentic-workflows.md", + }, + expectedDeleted: []string{ + ".github/agents/create-agentic-workflow.md", + ".github/agents/setup-agentic-workflows.md", + ".github/agents/update-agentic-workflows.md", + }, + }, + { + name: "deletes all old agent files together", + filesToCreate: []string{ + ".github/agents/create-agentic-workflow.agent.md", + ".github/agents/debug-agentic-workflow.agent.md", + ".github/agents/create-shared-agentic-workflow.agent.md", + ".github/agents/create-agentic-workflow.md", + ".github/agents/setup-agentic-workflows.md", + ".github/agents/update-agentic-workflows.md", + ".github/aw/upgrade-agentic-workflow.md", + }, + expectedDeleted: []string{ + ".github/agents/create-agentic-workflow.agent.md", + ".github/agents/debug-agentic-workflow.agent.md", + ".github/agents/create-shared-agentic-workflow.agent.md", + ".github/agents/create-agentic-workflow.md", + ".github/agents/setup-agentic-workflows.md", + ".github/agents/update-agentic-workflows.md", + ".github/aw/upgrade-agentic-workflow.md", + }, + }, { name: "handles no files to delete", filesToCreate: []string{}, From 5be30ebdca9c4925a2650b09a90373f004824516 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 24 Jan 2026 13:21:26 +0000 Subject: [PATCH 4/4] Add upgrade-agentic-workflows.md to deletion list Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/cli/copilot-agents.go | 1 + pkg/cli/copilot_agents_test.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pkg/cli/copilot-agents.go b/pkg/cli/copilot-agents.go index 80ebd3799b..98cab016e1 100644 --- a/pkg/cli/copilot-agents.go +++ b/pkg/cli/copilot-agents.go @@ -308,6 +308,7 @@ func deleteOldAgentFiles(verbose bool) error { "create-agentic-workflow.md", "setup-agentic-workflows.md", "update-agentic-workflows.md", + "upgrade-agentic-workflows.md", } // Also delete the dangling singular form file from .github/aw/ diff --git a/pkg/cli/copilot_agents_test.go b/pkg/cli/copilot_agents_test.go index ad21ca15be..32bf3e45d4 100644 --- a/pkg/cli/copilot_agents_test.go +++ b/pkg/cli/copilot_agents_test.go @@ -255,11 +255,13 @@ func TestDeleteOldAgentFiles(t *testing.T) { ".github/agents/create-agentic-workflow.md", ".github/agents/setup-agentic-workflows.md", ".github/agents/update-agentic-workflows.md", + ".github/agents/upgrade-agentic-workflows.md", }, expectedDeleted: []string{ ".github/agents/create-agentic-workflow.md", ".github/agents/setup-agentic-workflows.md", ".github/agents/update-agentic-workflows.md", + ".github/agents/upgrade-agentic-workflows.md", }, }, { @@ -271,6 +273,7 @@ func TestDeleteOldAgentFiles(t *testing.T) { ".github/agents/create-agentic-workflow.md", ".github/agents/setup-agentic-workflows.md", ".github/agents/update-agentic-workflows.md", + ".github/agents/upgrade-agentic-workflows.md", ".github/aw/upgrade-agentic-workflow.md", }, expectedDeleted: []string{ @@ -280,6 +283,7 @@ func TestDeleteOldAgentFiles(t *testing.T) { ".github/agents/create-agentic-workflow.md", ".github/agents/setup-agentic-workflows.md", ".github/agents/update-agentic-workflows.md", + ".github/agents/upgrade-agentic-workflows.md", ".github/aw/upgrade-agentic-workflow.md", }, },