From 2f00b51d6df89ebcf3b83299cb37b08a8ab29d58 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 19:27:09 +0000 Subject: [PATCH 1/3] Initial plan From 725c28b076bed7475495372d13928c3dc801fdb8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 19:45:04 +0000 Subject: [PATCH 2/3] feat: inject agentic-workflows MCP guide as builtin system prompt (#1234) - Add actions/setup/md/agentic_workflows_guide.md with MCP usage guidance - Add agenticWorkflowsGuideFile constant in prompt_constants.go - Add hasAgenticWorkflowsTool helper in prompts.go - Inject guide in collectPromptSections when agentic-workflows tool is configured - Update smoke-copilot golden file - Add tests for inclusion/exclusion of the guide - Recompile all 173 lock files Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../agent-performance-analyzer.lock.yml | 1 + .../workflows/agent-persona-explorer.lock.yml | 1 + .github/workflows/audit-workflows.lock.yml | 1 + .github/workflows/cloclo.lock.yml | 1 + .../workflows/daily-cli-tools-tester.lock.yml | 1 + .../workflows/daily-firewall-report.lock.yml | 1 + .../daily-observability-report.lock.yml | 1 + .../daily-rendering-scripts-verifier.lock.yml | 1 + .../daily-safe-output-optimizer.lock.yml | 1 + .github/workflows/deep-report.lock.yml | 1 + .github/workflows/dev-hawk.lock.yml | 1 + .../example-workflow-analyzer.lock.yml | 1 + .github/workflows/mcp-inspector.lock.yml | 1 + .github/workflows/metrics-collector.lock.yml | 1 + .github/workflows/portfolio-analyst.lock.yml | 1 + .../prompt-clustering-analysis.lock.yml | 1 + .github/workflows/python-data-charts.lock.yml | 1 + .github/workflows/q.lock.yml | 1 + .github/workflows/safe-output-health.lock.yml | 1 + .github/workflows/security-review.lock.yml | 1 + .github/workflows/smoke-claude.lock.yml | 1 + .github/workflows/smoke-copilot-arm.lock.yml | 1 + .github/workflows/smoke-copilot.lock.yml | 1 + .../workflows/static-analysis-report.lock.yml | 1 + .../workflows/workflow-normalizer.lock.yml | 1 + actions/setup/md/agentic_workflows_guide.md | 27 +++++ pkg/workflow/prompt_constants.go | 1 + pkg/workflow/prompts.go | 15 +++ pkg/workflow/prompts_test.go | 98 +++++++++++++++++++ .../smoke-copilot.golden | 1 + pkg/workflow/unified_prompt_step.go | 21 ++-- 31 files changed, 182 insertions(+), 6 deletions(-) create mode 100644 actions/setup/md/agentic_workflows_guide.md diff --git a/.github/workflows/agent-performance-analyzer.lock.yml b/.github/workflows/agent-performance-analyzer.lock.yml index 2a819181f40..39e474e4dfc 100644 --- a/.github/workflows/agent-performance-analyzer.lock.yml +++ b/.github/workflows/agent-performance-analyzer.lock.yml @@ -130,6 +130,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/repo_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/agent-persona-explorer.lock.yml b/.github/workflows/agent-persona-explorer.lock.yml index ccee4995d51..e4a6947e8bc 100644 --- a/.github/workflows/agent-persona-explorer.lock.yml +++ b/.github/workflows/agent-persona-explorer.lock.yml @@ -135,6 +135,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/audit-workflows.lock.yml b/.github/workflows/audit-workflows.lock.yml index cb4fbbe3ccb..03f9b6cceb1 100644 --- a/.github/workflows/audit-workflows.lock.yml +++ b/.github/workflows/audit-workflows.lock.yml @@ -136,6 +136,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/repo_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" diff --git a/.github/workflows/cloclo.lock.yml b/.github/workflows/cloclo.lock.yml index 05ad6bbc540..c02f0dca5f3 100644 --- a/.github/workflows/cloclo.lock.yml +++ b/.github/workflows/cloclo.lock.yml @@ -224,6 +224,7 @@ jobs: cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" cat "/opt/gh-aw/prompts/playwright_prompt.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/daily-cli-tools-tester.lock.yml b/.github/workflows/daily-cli-tools-tester.lock.yml index 71c0be5ccd5..7e9b5a7c98f 100644 --- a/.github/workflows/daily-cli-tools-tester.lock.yml +++ b/.github/workflows/daily-cli-tools-tester.lock.yml @@ -133,6 +133,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/daily-firewall-report.lock.yml b/.github/workflows/daily-firewall-report.lock.yml index 67a49718c7a..20fe2263059 100644 --- a/.github/workflows/daily-firewall-report.lock.yml +++ b/.github/workflows/daily-firewall-report.lock.yml @@ -134,6 +134,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/daily-observability-report.lock.yml b/.github/workflows/daily-observability-report.lock.yml index a3eafb8d47f..3a1389a1f3d 100644 --- a/.github/workflows/daily-observability-report.lock.yml +++ b/.github/workflows/daily-observability-report.lock.yml @@ -136,6 +136,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/daily-rendering-scripts-verifier.lock.yml b/.github/workflows/daily-rendering-scripts-verifier.lock.yml index dcf483d3b6f..d99693f6f3e 100644 --- a/.github/workflows/daily-rendering-scripts-verifier.lock.yml +++ b/.github/workflows/daily-rendering-scripts-verifier.lock.yml @@ -137,6 +137,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/daily-safe-output-optimizer.lock.yml b/.github/workflows/daily-safe-output-optimizer.lock.yml index 393c8b4b68b..8f909032359 100644 --- a/.github/workflows/daily-safe-output-optimizer.lock.yml +++ b/.github/workflows/daily-safe-output-optimizer.lock.yml @@ -138,6 +138,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/deep-report.lock.yml b/.github/workflows/deep-report.lock.yml index f4b6f88ca58..f6d493350b8 100644 --- a/.github/workflows/deep-report.lock.yml +++ b/.github/workflows/deep-report.lock.yml @@ -136,6 +136,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/repo_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" diff --git a/.github/workflows/dev-hawk.lock.yml b/.github/workflows/dev-hawk.lock.yml index 527ea46e769..441583ebfe2 100644 --- a/.github/workflows/dev-hawk.lock.yml +++ b/.github/workflows/dev-hawk.lock.yml @@ -139,6 +139,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/example-workflow-analyzer.lock.yml b/.github/workflows/example-workflow-analyzer.lock.yml index e4770ddae6e..06fd8d33e1e 100644 --- a/.github/workflows/example-workflow-analyzer.lock.yml +++ b/.github/workflows/example-workflow-analyzer.lock.yml @@ -133,6 +133,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/mcp-inspector.lock.yml b/.github/workflows/mcp-inspector.lock.yml index 7075c7aa195..6d3ddf1ba20 100644 --- a/.github/workflows/mcp-inspector.lock.yml +++ b/.github/workflows/mcp-inspector.lock.yml @@ -148,6 +148,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/metrics-collector.lock.yml b/.github/workflows/metrics-collector.lock.yml index c4bc42d4328..e4811d63d7c 100644 --- a/.github/workflows/metrics-collector.lock.yml +++ b/.github/workflows/metrics-collector.lock.yml @@ -131,6 +131,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/repo_memory_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/portfolio-analyst.lock.yml b/.github/workflows/portfolio-analyst.lock.yml index 31cec5bea8f..58b41ade189 100644 --- a/.github/workflows/portfolio-analyst.lock.yml +++ b/.github/workflows/portfolio-analyst.lock.yml @@ -135,6 +135,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/prompt-clustering-analysis.lock.yml b/.github/workflows/prompt-clustering-analysis.lock.yml index aa0092a8693..ee1ab4afc26 100644 --- a/.github/workflows/prompt-clustering-analysis.lock.yml +++ b/.github/workflows/prompt-clustering-analysis.lock.yml @@ -138,6 +138,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/python-data-charts.lock.yml b/.github/workflows/python-data-charts.lock.yml index 3fd36377316..3b610210fa7 100644 --- a/.github/workflows/python-data-charts.lock.yml +++ b/.github/workflows/python-data-charts.lock.yml @@ -132,6 +132,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/q.lock.yml b/.github/workflows/q.lock.yml index e221c0d5a43..eb5db271190 100644 --- a/.github/workflows/q.lock.yml +++ b/.github/workflows/q.lock.yml @@ -220,6 +220,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/safe-output-health.lock.yml b/.github/workflows/safe-output-health.lock.yml index 35f9f527066..5e540c01cc3 100644 --- a/.github/workflows/safe-output-health.lock.yml +++ b/.github/workflows/safe-output-health.lock.yml @@ -134,6 +134,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/security-review.lock.yml b/.github/workflows/security-review.lock.yml index 90b9598183b..bc2236dfa72 100644 --- a/.github/workflows/security-review.lock.yml +++ b/.github/workflows/security-review.lock.yml @@ -169,6 +169,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/smoke-claude.lock.yml b/.github/workflows/smoke-claude.lock.yml index 9cd37d1b53f..2485a023088 100644 --- a/.github/workflows/smoke-claude.lock.yml +++ b/.github/workflows/smoke-claude.lock.yml @@ -194,6 +194,7 @@ jobs: cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" cat "/opt/gh-aw/prompts/playwright_prompt.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/smoke-copilot-arm.lock.yml b/.github/workflows/smoke-copilot-arm.lock.yml index 33d6697868d..1f43189cb26 100644 --- a/.github/workflows/smoke-copilot-arm.lock.yml +++ b/.github/workflows/smoke-copilot-arm.lock.yml @@ -186,6 +186,7 @@ jobs: cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" cat "/opt/gh-aw/prompts/playwright_prompt.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/smoke-copilot.lock.yml b/.github/workflows/smoke-copilot.lock.yml index 2fd336ceb0f..5ef82290c48 100644 --- a/.github/workflows/smoke-copilot.lock.yml +++ b/.github/workflows/smoke-copilot.lock.yml @@ -189,6 +189,7 @@ jobs: cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" cat "/opt/gh-aw/prompts/playwright_prompt.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/static-analysis-report.lock.yml b/.github/workflows/static-analysis-report.lock.yml index e61c3fa151e..eff471b9282 100644 --- a/.github/workflows/static-analysis-report.lock.yml +++ b/.github/workflows/static-analysis-report.lock.yml @@ -133,6 +133,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/cache_memory_prompt.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/.github/workflows/workflow-normalizer.lock.yml b/.github/workflows/workflow-normalizer.lock.yml index 98679ab54ee..7a96d3b03bc 100644 --- a/.github/workflows/workflow-normalizer.lock.yml +++ b/.github/workflows/workflow-normalizer.lock.yml @@ -133,6 +133,7 @@ jobs: cat "/opt/gh-aw/prompts/xpia.md" cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' diff --git a/actions/setup/md/agentic_workflows_guide.md b/actions/setup/md/agentic_workflows_guide.md new file mode 100644 index 00000000000..1ca9c389b54 --- /dev/null +++ b/actions/setup/md/agentic_workflows_guide.md @@ -0,0 +1,27 @@ + +## Using the agentic-workflows MCP Server + +**⚠️ CRITICAL**: The `status`, `logs`, `audit`, `list`, and `compile` operations are MCP server tools, +NOT shell commands. Do NOT run `gh aw` directly — it is not authenticated in this context. +Do not attempt to download or build the `gh aw` extension. If the MCP server fails, give up. +Call all operations as MCP tools with JSON parameters. + +- Run the `status` tool to verify configuration and list all workflows +- Use the `logs` tool to download run logs (saves to `/tmp/gh-aw/aw-mcp/logs/`) +- Use the `audit` tool with a `run_id` to investigate specific runs +- Use the `list` tool to enumerate workflows in the repository + +### Tool Parameters + +#### `status` — Verify MCP server configuration and list workflows + +#### `logs` — Download workflow run logs +- `workflow_name`: filter to a specific workflow (leave empty for all) +- `count`: number of runs (default 30, max 5000) +- `start_date`: relative date, e.g. `-1d`, `-7d`, `-30d` +- `engine`: filter by AI engine (`copilot`, `claude`, `codex`) +- Logs are saved to `/tmp/gh-aw/aw-mcp/logs/` + +#### `audit` — Inspect a specific run +- `run_id`: GitHub Actions run ID (numeric) + diff --git a/pkg/workflow/prompt_constants.go b/pkg/workflow/prompt_constants.go index 2f9d9c39be4..6c26bf782ec 100644 --- a/pkg/workflow/prompt_constants.go +++ b/pkg/workflow/prompt_constants.go @@ -18,6 +18,7 @@ const ( safeOutputsCreatePRFile = "safe_outputs_create_pull_request.md" safeOutputsPushToBranchFile = "safe_outputs_push_to_pr_branch.md" safeOutputsAutoCreateIssueFile = "safe_outputs_auto_create_issue.md" + agenticWorkflowsGuideFile = "agentic_workflows_guide.md" ) // GitHub context prompt is kept embedded because it contains GitHub Actions expressions diff --git a/pkg/workflow/prompts.go b/pkg/workflow/prompts.go index 82e3732f7d0..00b9e7b132c 100644 --- a/pkg/workflow/prompts.go +++ b/pkg/workflow/prompts.go @@ -29,6 +29,21 @@ func hasPlaywrightTool(parsedTools *Tools) bool { return hasPlaywright } +// ============================================================================ +// Tool Prompts - Agentic Workflows +// ============================================================================ + +// hasAgenticWorkflowsTool checks if the agentic workflows tool is enabled in the tools configuration +func hasAgenticWorkflowsTool(parsedTools *Tools) bool { + if parsedTools == nil { + log.Print("Checking for agentic-workflows tool: no parsed tools provided") + return false + } + hasAgenticWorkflows := parsedTools.AgenticWorkflows != nil + log.Printf("Agentic-workflows tool enabled: %v", hasAgenticWorkflows) + return hasAgenticWorkflows +} + // ============================================================================ // PR Context Prompts // ============================================================================ diff --git a/pkg/workflow/prompts_test.go b/pkg/workflow/prompts_test.go index f560c671d4f..4b439b85e3d 100644 --- a/pkg/workflow/prompts_test.go +++ b/pkg/workflow/prompts_test.go @@ -750,3 +750,101 @@ This is a test workflow without contents read permission. t.Logf("Successfully verified PR context instructions are NOT included without contents permission") } + +// ============================================================================ +// Agentic Workflows Guide Prompt Tests +// ============================================================================ + +func TestAgenticWorkflowsGuideIncludedWhenEnabled(t *testing.T) { + tmpDir, err := os.MkdirTemp("", "gh-aw-agentic-guide-test-*") + if err != nil { + t.Fatalf("Failed to create temp dir: %v", err) + } + defer os.RemoveAll(tmpDir) + + testFile := filepath.Join(tmpDir, "test-workflow.md") + testContent := `--- +on: schedule daily +engine: claude +tools: + agentic-workflows: +permissions: + actions: read +--- + +# Test Workflow with Agentic Workflows + +This workflow uses the agentic-workflows MCP server. +` + + if err := os.WriteFile(testFile, []byte(testContent), 0644); err != nil { + t.Fatalf("Failed to create test workflow: %v", err) + } + + compiler := NewCompiler() + if err := compiler.CompileWorkflow(testFile); err != nil { + t.Fatalf("Failed to compile workflow: %v", err) + } + + lockFile := stringutil.MarkdownToLockFile(testFile) + lockContent, err := os.ReadFile(lockFile) + if err != nil { + t.Fatalf("Failed to read generated lock file: %v", err) + } + + lockStr := string(lockContent) + + if !strings.Contains(lockStr, "- name: Create prompt with built-in context") { + t.Error("Expected 'Create prompt with built-in context' step in generated workflow") + } + + if !strings.Contains(lockStr, "cat \"/opt/gh-aw/prompts/agentic_workflows_guide.md\"") { + t.Error("Expected cat command for agentic_workflows_guide.md in generated workflow") + } + + t.Logf("Successfully verified agentic-workflows guide is included when agentic-workflows tool is enabled") +} + +func TestAgenticWorkflowsGuideNotIncludedWhenDisabled(t *testing.T) { + tmpDir, err := os.MkdirTemp("", "gh-aw-no-agentic-guide-test-*") + if err != nil { + t.Fatalf("Failed to create temp dir: %v", err) + } + defer os.RemoveAll(tmpDir) + + testFile := filepath.Join(tmpDir, "test-workflow.md") + testContent := `--- +on: push +engine: codex +tools: + github: +--- + +# Test Workflow without Agentic Workflows + +This workflow does not use the agentic-workflows MCP server. +` + + if err := os.WriteFile(testFile, []byte(testContent), 0644); err != nil { + t.Fatalf("Failed to create test workflow: %v", err) + } + + compiler := NewCompiler() + if err := compiler.CompileWorkflow(testFile); err != nil { + t.Fatalf("Failed to compile workflow: %v", err) + } + + lockFile := stringutil.MarkdownToLockFile(testFile) + lockContent, err := os.ReadFile(lockFile) + if err != nil { + t.Fatalf("Failed to read generated lock file: %v", err) + } + + lockStr := string(lockContent) + + if strings.Contains(lockStr, "agentic_workflows_guide.md") { + t.Error("Did not expect 'agentic_workflows_guide.md' reference in workflow without agentic-workflows tool") + } + + t.Logf("Successfully verified agentic-workflows guide is NOT included when agentic-workflows tool is disabled") +} diff --git a/pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/smoke-copilot.golden b/pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/smoke-copilot.golden index 8dc75d25853..fc2df538892 100644 --- a/pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/smoke-copilot.golden +++ b/pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/smoke-copilot.golden @@ -125,6 +125,7 @@ jobs: cat "/opt/gh-aw/prompts/temp_folder_prompt.md" cat "/opt/gh-aw/prompts/markdown.md" cat "/opt/gh-aw/prompts/playwright_prompt.md" + cat "/opt/gh-aw/prompts/agentic_workflows_guide.md" cat << 'GH_AW_PROMPT_EOF' The following GitHub context information is available for this workflow: diff --git a/pkg/workflow/unified_prompt_step.go b/pkg/workflow/unified_prompt_step.go index d045c046345..5626859e3ed 100644 --- a/pkg/workflow/unified_prompt_step.go +++ b/pkg/workflow/unified_prompt_step.go @@ -255,7 +255,16 @@ func (c *Compiler) collectPromptSections(data *WorkflowData) []PromptSection { }) } - // 4. Trial mode note (if in trial mode) + // 4. Agentic Workflows MCP guide (if agentic-workflows tool is enabled) + if hasAgenticWorkflowsTool(data.ParsedTools) { + unifiedPromptLog.Print("Adding agentic-workflows guide section") + sections = append(sections, PromptSection{ + Content: agenticWorkflowsGuideFile, + IsFile: true, + }) + } + + // 5. Trial mode note (if in trial mode) if c.trialMode { unifiedPromptLog.Print("Adding trial mode section") trialContent := fmt.Sprintf("## Note\nThis workflow is running in directory $GITHUB_WORKSPACE, but that directory actually contains the contents of the repository '%s'.", c.trialLogicalRepoSlug) @@ -265,7 +274,7 @@ func (c *Compiler) collectPromptSections(data *WorkflowData) []PromptSection { }) } - // 5. Cache memory instructions (if enabled) + // 6. Cache memory instructions (if enabled) if data.CacheMemoryConfig != nil && len(data.CacheMemoryConfig.Caches) > 0 { unifiedPromptLog.Printf("Adding cache memory section: caches=%d", len(data.CacheMemoryConfig.Caches)) section := buildCacheMemoryPromptSection(data.CacheMemoryConfig) @@ -274,7 +283,7 @@ func (c *Compiler) collectPromptSections(data *WorkflowData) []PromptSection { } } - // 6. Repo memory instructions (if enabled) + // 7. Repo memory instructions (if enabled) if data.RepoMemoryConfig != nil && len(data.RepoMemoryConfig.Memories) > 0 { unifiedPromptLog.Printf("Adding repo memory section: memories=%d", len(data.RepoMemoryConfig.Memories)) section := buildRepoMemoryPromptSection(data.RepoMemoryConfig) @@ -283,7 +292,7 @@ func (c *Compiler) collectPromptSections(data *WorkflowData) []PromptSection { } } - // 7. Safe outputs instructions (if enabled) + // 8. Safe outputs instructions (if enabled) if HasSafeOutputsEnabled(data.SafeOutputs) { unifiedPromptLog.Print("Adding safe outputs section") // Static intro from file (gh CLI warning, temporary ID rules, noop note) @@ -294,7 +303,7 @@ func (c *Compiler) collectPromptSections(data *WorkflowData) []PromptSection { // Per-tool sections: opening tag + tools list (inline), tool instruction files, closing tag sections = append(sections, buildSafeOutputsSections(data.SafeOutputs)...) } - // 8. GitHub context (if GitHub tool is enabled) + // 9. GitHub context (if GitHub tool is enabled) if hasGitHubTool(data.ParsedTools) { unifiedPromptLog.Print("Adding GitHub context section") @@ -333,7 +342,7 @@ func (c *Compiler) collectPromptSections(data *WorkflowData) []PromptSection { } } - // 9. PR context (if comment-related triggers and checkout is needed) + // 10. PR context (if comment-related triggers and checkout is needed) hasCommentTriggers := c.hasCommentRelatedTriggers(data) needsCheckout := c.shouldAddCheckoutStep(data) permParser := NewPermissionsParser(data.Permissions) From f5cd1008729020a0badd89643bf08ebfb9a10fe3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 21:04:03 +0000 Subject: [PATCH 3/3] fix: correct agentic_workflows_guide.md tool docs (no list tool, fix logs/audit params) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/md/agentic_workflows_guide.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/actions/setup/md/agentic_workflows_guide.md b/actions/setup/md/agentic_workflows_guide.md index 1ca9c389b54..d573b55854e 100644 --- a/actions/setup/md/agentic_workflows_guide.md +++ b/actions/setup/md/agentic_workflows_guide.md @@ -1,15 +1,14 @@ ## Using the agentic-workflows MCP Server -**⚠️ CRITICAL**: The `status`, `logs`, `audit`, `list`, and `compile` operations are MCP server tools, +**⚠️ CRITICAL**: The `status`, `logs`, `audit`, and `compile` operations are MCP server tools, NOT shell commands. Do NOT run `gh aw` directly — it is not authenticated in this context. Do not attempt to download or build the `gh aw` extension. If the MCP server fails, give up. Call all operations as MCP tools with JSON parameters. - Run the `status` tool to verify configuration and list all workflows - Use the `logs` tool to download run logs (saves to `/tmp/gh-aw/aw-mcp/logs/`) -- Use the `audit` tool with a `run_id` to investigate specific runs -- Use the `list` tool to enumerate workflows in the repository +- Use the `audit` tool with a run ID or URL to investigate specific runs ### Tool Parameters @@ -17,11 +16,15 @@ Call all operations as MCP tools with JSON parameters. #### `logs` — Download workflow run logs - `workflow_name`: filter to a specific workflow (leave empty for all) -- `count`: number of runs (default 30, max 5000) -- `start_date`: relative date, e.g. `-1d`, `-7d`, `-30d` +- `count`: number of runs (default: 100) +- `start_date`: filter runs after this date (YYYY-MM-DD or relative like `-1d`, `-7d`, `-30d`) +- `end_date`: filter runs before this date - `engine`: filter by AI engine (`copilot`, `claude`, `codex`) +- `branch`: filter by branch name +- `firewall` / `no_firewall`: filter by firewall status +- `after_run_id` / `before_run_id`: paginate by run database ID - Logs are saved to `/tmp/gh-aw/aw-mcp/logs/` #### `audit` — Inspect a specific run -- `run_id`: GitHub Actions run ID (numeric) +- `run_id_or_url`: numeric run ID, run URL, job URL, or job URL with step anchor