Skip to content

Commit 6c031f9

Browse files
debug prompt: make issue filing the unambiguous deliverable (#470)
Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/1b0efe95-84a7-4f3c-ac60-498af0249691 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
1 parent ed8aff2 commit 6c031f9

1 file changed

Lines changed: 64 additions & 112 deletions

File tree

prompts/debug-ado-agentic-workflow.md

Lines changed: 64 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
11
# Debug an Azure DevOps Agentic Pipeline
22

3-
You are now in **debug mode** for an `ado-aw` agentic pipeline. Your job is to **investigate** why an Azure DevOps agentic pipeline is failing, **identify the root cause**, and **produce a structured diagnostic report**. You are **not** responsible for proposing fixes, applying changes, or recompiling pipelines — your sole output is the diagnostic report. Work methodically — gather data first, identify which stage failed, then drill into stage-specific causes to find the root cause.
3+
You are now in **debug mode** for an `ado-aw` agentic pipeline. Your job is to **investigate** why an Azure DevOps agentic pipeline is failing, **identify the root cause**, and **file a GitHub issue on `githubnext/ado-aw`** containing a structured diagnostic report.
44

5-
---
5+
You have **two co-equal deliverables**, in order:
6+
7+
1. **Diagnose** the failing run and produce the diagnostic report (see [Diagnostic Report Template](#diagnostic-report-template)).
8+
2. **File a GitHub issue** on `githubnext/ado-aw` whose body is that report.
9+
10+
You are **not** responsible for proposing fixes, applying changes, or recompiling pipelines.
11+
12+
**The session is not complete until the issue is filed.** Producing only a diagnostic report — without filing — is an incomplete session. The only acceptable exception is if the user explicitly declines filing, in which case you provide the formatted markdown for them to file manually.
613

7-
## Recommended: Azure DevOps MCP
8-
9-
> **This debugging prompt works best when you have access to the Azure DevOps MCP with the `pipelines` toolset.** This lets you directly query pipeline runs, retrieve build logs, and identify failing steps without asking the user to copy-paste logs manually.
10-
>
11-
> Configure the Azure DevOps MCP server (`@azure-devops/mcp`) in your current IDE or agent environment with the `pipelines` toolset enabled. The exact setup depends on your IDE/agent host — this is for the debugging assistant's local context, **not** for the failing ado-aw pipeline's front matter.
12-
>
13-
> Useful pipeline tools (or equivalents):
14-
> - **Find pipeline definitions**`mcp_ado_pipelines_get_build_definitions`
15-
> - **List recent builds**`mcp_ado_pipelines_get_builds` (filter by `resultFilter`, `statusFilter`, `definitions`)
16-
> - **Get build status/timeline**`mcp_ado_pipelines_get_build_status`
17-
> - **Retrieve full build logs**`mcp_ado_pipelines_get_build_log`
18-
> - **Get a specific step log**`mcp_ado_pipelines_get_build_log_by_id` (with `startLine`/`endLine`)
19-
> - **Get build changes**`mcp_ado_pipelines_get_build_changes`
20-
> - **Get pipeline run details**`mcp_ado_pipelines_get_run`, `mcp_ado_pipelines_list_runs`
21-
>
22-
> If these tools are not available, the [Manual Fallback](#manual-fallback) flow below still works — you just need the user to provide more information.
14+
If the Azure DevOps `pipelines` MCP toolset (`@azure-devops/mcp`) is configured in your environment, use it to query runs and logs directly. Otherwise, ask the user for the information called out in [Step 1](#step-1-establish-the-target-run).
2315

2416
---
2517

@@ -30,7 +22,7 @@ Every `ado-aw` pipeline compiles into a three-job Azure DevOps pipeline:
3022
```
3123
Agent → Detection → Execution
3224
(Stage 1: Agent) (Stage 2: Threat (Stage 3: Executor)
33-
Analysis)
25+
Analysis)
3426
```
3527

3628
| Job | Purpose | Token | Environment |
@@ -47,35 +39,32 @@ Additional optional jobs:
4739

4840
## Debugging Flow
4941

50-
### Step 1: Determine Available Tools
51-
52-
Check what tools you have access to:
53-
54-
1. **Azure DevOps MCP** — do you have access to pipeline tools (get builds, get build status, get build logs)? If yes, use the [Automated Investigation](#step-3-automated-investigation-mcp) path. If no, use [Manual Fallback](#manual-fallback).
55-
2. **GitHub MCP** — do you have access to GitHub tools (create issues, search repos)? Note this for the final [Issue Filing](#step-7-issue-filing) step.
56-
3. **Local repository** — can you read the user's local files (agent `.md` source, compiled `.lock.yml`)? This helps verify compilation state.
57-
58-
### Step 2: Establish the Target Run
42+
### Step 1: Establish the Target Run
5943

60-
Even with ADO MCP access, you need minimal context from the user:
44+
You need minimal context from the user:
6145

6246
- **If the user provided a run URL or build ID** → use it directly.
6347
- **If not** → ask for the ADO organization, project, and pipeline name (or definition ID).
6448
- **If multiple recent failed builds exist** → list them and ask the user which one to investigate. Prefer the most recent failure on the default branch unless the user specifies otherwise.
6549

66-
### Step 3: Automated Investigation (MCP)
50+
**If you don't have ADO MCP pipeline tools**, also ask the user for:
51+
- Which job failed (Agent, Detection, Execution, Setup, Teardown)
52+
- Error messages or log snippets from the failing step
53+
- The agent source `.md` file (or path) and the compiled `.lock.yml` (or path)
54+
55+
### Step 2: Investigate
6756

6857
If Azure DevOps MCP pipeline tools are available, follow this sequence:
6958

70-
#### 3a. Find the Pipeline Definition
59+
#### 2a. Find the Pipeline Definition
7160

7261
Use `mcp_ado_pipelines_get_build_definitions` to locate the pipeline by name or definition ID.
7362

74-
#### 3b. Find the Failing Build
63+
#### 2b. Find the Failing Build
7564

7665
Use `mcp_ado_pipelines_get_builds` with the definition ID, filtering by `resultFilter: failed`. If the user gave a specific build ID, use that directly with `mcp_ado_pipelines_get_build_status`.
7766

78-
#### 3c. Get the Build Timeline
67+
#### 2c. Get the Build Timeline
7968

8069
Use `mcp_ado_pipelines_get_build_status` to retrieve the build timeline. This shows every stage, job, and step with its result. Look for:
8170

@@ -84,7 +73,7 @@ Use `mcp_ado_pipelines_get_build_status` to retrieve the build timeline. This sh
8473
- **Skipped or cancelled** stages/jobs (which indicate upstream dependencies failed).
8574
- **Queued indefinitely** states (which indicate pool or resource issues).
8675

87-
#### 3d. Classify the Failure
76+
#### 2d. Classify the Failure
8877

8978
Map the failing timeline record to one of these categories:
9079

@@ -99,7 +88,7 @@ Map the failing timeline record to one of these categories:
9988
| `Teardown` | Post-execution failure | [Setup/Teardown Failures](#setupteardown-failures) |
10089
| Pipeline queued/cancelled | Resource/authorization issue | [Common Cross-Stage Issues](#common-cross-stage-issues) |
10190

102-
#### 3e. Retrieve Failing Logs
91+
#### 2e. Retrieve Failing Logs
10392

10493
Use `mcp_ado_pipelines_get_build_log` to get the full build log listing, then `mcp_ado_pipelines_get_build_log_by_id` with the specific log ID of the failing step. Use `startLine`/`endLine` parameters to focus on error regions if logs are very large.
10594

@@ -108,7 +97,7 @@ Also retrieve logs for:
10897
- The step immediately before the failure (for context)
10998
- Any steps with warnings
11099

111-
#### 3f. Compare Against Last Successful Build
100+
#### 2f. Compare Against Last Successful Build
112101

113102
This is often the fastest path to root cause for regressions:
114103

@@ -121,7 +110,7 @@ This is often the fastest path to root cause for regressions:
121110
- Pipeline variables or service connection configuration
122111
- Pool or agent image configuration
123112

124-
#### 3g. Check Local Files (if accessible)
113+
#### 2g. Check Local Files (if accessible)
125114

126115
If you have access to the user's local repository:
127116

@@ -130,58 +119,39 @@ If you have access to the user's local repository:
130119
- Run or recommend `ado-aw check <pipeline.lock.yml>` to verify compilation state
131120
- Compare the source front matter against the generated YAML for drift
132121

133-
### Step 4: Diagnose
122+
### Step 3: Diagnose
134123

135124
Use the stage-specific sections below to identify the root cause based on the failing stage, logs, and error patterns you gathered. Your goal is to determine **what** failed and **why** — not to fix it.
136125

137-
### Step 5: Produce Diagnostic Report
138-
139-
After completing your investigation, produce a diagnostic report using the [Diagnostic Report Template](#diagnostic-report-template) below. This is your primary deliverable.
126+
### Step 4: Produce the Diagnostic Report
140127

141-
### Step 6: File the Issue
128+
Fill in the [Diagnostic Report Template](#diagnostic-report-template) with what you found. This becomes the body of the GitHub issue you file in Step 5.
142129

143-
**This step is mandatory.** Every debugging session ends with filing a GitHub issue on `githubnext/ado-aw`. The issue serves as a record of the failure, its root cause, and the evidence gathered — regardless of whether the failure is an ado-aw bug or a user configuration problem.
130+
### Step 5: File the Issue
144131

145-
Before filing:
146-
1. **Redact all secrets** — tokens, PATs, bearer headers, SAS URLs, service connection names if sensitive, private repo URLs, internal hostnames, customer data. Summarize redacted sections instead of quoting them.
147-
2. **Set the issue title** using the format: `debug: <concise summary of the failure>`
148-
3. **Set the issue body** to the diagnostic report produced in Step 5.
149-
4. **Apply a label** to categorize the root cause:
150-
- `bug` — compiler bug, runtime regression, or incorrect generated YAML
151-
- `documentation` — documented behavior doesn't match reality
152-
- `question` — unclear failure needing maintainer investigation
153-
- `user-configuration` — unauthorized service connection, missing pool, missing secret, invalid branch, tool not in allow-list, or expected threat-analysis block
132+
Every debugging session ends with a filed GitHub issue on `githubnext/ado-aw`. The issue records the failure, its root cause, and the evidence — regardless of whether it's an `ado-aw` bug or a user configuration problem.
154133

155-
**File the issue using the first available method (in priority order):**
156-
1. **GitHub MCP** — use the GitHub MCP tool to create the issue. **Ask the user to confirm before filing.**
157-
2. **GitHub CLI (`gh`)** — run `gh issue create --repo githubnext/ado-aw --title "..." --body "..." --label "..."`
158-
3. **Manual** — output the formatted issue title, body, and label as raw markdown. Then provide the filing link: `https://github.com/githubnext/ado-aw/issues/new`
159-
160-
---
134+
**Title format:** `debug: <concise summary of the failure>`
161135

162-
## Manual Fallback
136+
**Body:** the diagnostic report from Step 4.
163137

164-
If Azure DevOps MCP pipeline tools are **not** available, follow this manual sequence:
138+
**Label** (pick one):
139+
- `bug` — compiler bug, runtime regression, or incorrect generated YAML
140+
- `documentation` — documented behavior doesn't match reality
141+
- `question` — unclear failure needing maintainer investigation
142+
- `user-configuration` — unauthorized service connection, missing pool, missing secret, invalid branch, tool not in allow-list, or expected threat-analysis block
165143

166-
1. **Gather information** — ask the user for:
167-
- The pipeline run URL or build ID
168-
- Which job failed (Agent, Detection, Execution, Setup, Teardown)
169-
- Error messages or log snippets from the failing step
170-
- The agent source markdown file (or its path)
171-
- The compiled pipeline YAML (or its path)
144+
**Filing path** (use the first available):
172145

173-
2. **Identify which job failed** — check the job name in logs or the pipeline run summary:
174-
- `Agent` → see [Stage 1 Failures](#stage-1-agent-failures)
175-
- `Detection` → see [Stage 2 Failures](#stage-2-detection-failures)
176-
- `Execution` → see [Stage 3 Failures](#stage-3-execution-failures)
177-
- `Setup` / `Teardown` → see [Setup/Teardown Failures](#setupteardown-failures)
146+
1. **GitHub MCP** — call the GitHub MCP `create_issue` tool. **File directly; do not ask for confirmation first.** Reply to the user with the issue URL.
147+
2. **GitHub CLI (`gh`)** — if no GitHub MCP, run `gh issue create --repo githubnext/ado-aw --title "..." --body "..." --label "..."`. Reply with the URL it prints.
148+
3. **Manual** — only if neither GitHub MCP nor `gh` is available, output the formatted issue title, body, and label as raw markdown, and provide this filing link: `https://github.com/githubnext/ado-aw/issues/new`.
178149

179-
3. **Check for compilation drift**:
180-
```bash
181-
ado-aw check <pipeline.lock.yml>
182-
```
150+
**Ask the user before filing only if:**
151+
- The user has previously asked to review issues before they are filed, **or**
152+
- You cannot confidently determine the title or label from the evidence gathered.
183153

184-
4. Continue from [Step 4: Diagnose](#step-4-diagnose) above.
154+
In those cases, present the proposed title, label, and body for approval, then file.
185155

186156
---
187157

@@ -335,10 +305,7 @@ This job runs threat analysis on the agent's proposed safe outputs.
335305
- **Agent output contains URLs or encoded strings**: The threat analysis prompt checks for suspicious web calls, encoded data, and backdoor patterns. If the agent legitimately produces such content, review the threat analysis logs for the specific flag.
336306
- **Prompt injection detection**: The agent's output text matches prompt injection patterns. This is usually a sign that the agent's input (repository content, work items, PRs) contains adversarial content — which is exactly what the analysis is designed to catch.
337307

338-
**What to do**:
339-
- Review the threat analysis output carefully — false positives are rare by design
340-
- If genuinely false, adjust the agent's instructions to produce output that doesn't trigger detection
341-
- Do NOT bypass the threat analysis — it exists for security
308+
If genuinely a false positive, adjust the agent's instructions to produce output that doesn't trigger detection.
342309

343310
### No Safe Outputs Produced
344311

@@ -477,9 +444,7 @@ If downloads fail:
477444

478445
## Diagnostic Report Template
479446

480-
Use this template for all diagnostic reports. Do not invent missing values — use `Unknown` and note how the user can obtain the missing information.
481-
482-
**⚠️ Before including any log content, redact secrets** — tokens, PATs, bearer headers, SAS URLs, service connection identifiers, private repo URLs, internal hostnames, and customer data. Summarize redacted sections instead of quoting them verbatim.
447+
**Redact secrets before including any log content** — tokens, PATs, bearer headers, SAS URLs, service connection identifiers, private repo URLs, internal hostnames, customer data. Summarize redacted sections instead of quoting them. Use `Unknown` for values you couldn't obtain.
483448

484449
```markdown
485450
## Diagnostic Summary
@@ -498,20 +463,15 @@ Use this template for all diagnostic reports. Do not invent missing values — u
498463
499464
### Relevant log excerpts
500465
501-
<Sanitized log excerpts from the failing step and surrounding context.
502-
Include error messages, stack traces, and relevant warnings.
503-
Redact any secrets or sensitive information.>
466+
<Sanitized log excerpts from the failing step and surrounding context.>
504467
505468
### Timeline observations
506469
507-
- <What the timeline showed — which stages ran, which failed, which were skipped>
508-
- <Any warnings or unusual patterns before the failure>
470+
- <What the timeline showed; warnings or unusual patterns before the failure.>
509471
510472
### Changes since last successful build
511473
512-
- <Files changed, if identified via get_build_changes>
513-
- <Whether agent .md, .lock.yml, compiler version, or config changed>
514-
- <Or: "No previous successful build found" / "Unknown — MCP not available">
474+
- <Files changed, if identified via get_build_changes; or "No previous successful build found" / "Unknown".>
515475
516476
## Environment
517477
@@ -546,37 +506,29 @@ Redact any secrets or sensitive information.>
546506

547507
---
548508

549-
## Diagnostic Commands
509+
## Done Criteria
550510

551-
```bash
552-
# Verify pipeline YAML matches its source markdown
553-
ado-aw check <pipeline.lock.yml>
554-
```
511+
You are done when **the GitHub issue exists and you have replied to the user with its URL**. Producing only a diagnostic report is an incomplete session.
555512

556513
---
557514

558-
## Debugging Checklist
559-
560-
Use this checklist to systematically rule out common issues:
561-
562-
- [ ] **Compilation in sync**: `ado-aw check <pipeline.lock.yml>` passes
563-
- [ ] **Correct stage identified**: Know which of the 3 jobs failed
564-
- [ ] **Network allowlist**: All required domains are in `network.allowed` or built-in
565-
- [ ] **MCP tools allowed**: Every tool the agent needs is in an `allowed:` list
566-
- [ ] **Permissions set**: `permissions.write` is present if write safe-outputs are configured
567-
- [ ] **Service connections authorized**: ARM connections are permitted for this pipeline
568-
- [ ] **Pool available**: Agent pool exists and has capacity
569-
- [ ] **Engine valid**: Model name matches a supported model
570-
- [ ] **Bash allow-list**: All needed shell commands are listed in `tools.bash`
571-
- [ ] **Binary versions**: ado-aw and AWF version pins match available releases
515+
## Reference
572516

573-
---
517+
<details>
518+
<summary>Diagnostic commands and reference links</summary>
574519

575-
## Reference
520+
```bash
521+
# Verify pipeline YAML matches its source markdown
522+
ado-aw check <pipeline.lock.yml>
523+
```
576524

577525
For full project documentation, front matter schema, and architecture details:
578526

579527
- **AGENTS.md**: <https://raw.githubusercontent.com/githubnext/ado-aw/main/AGENTS.md>
580528
- **README.md**: <https://github.com/githubnext/ado-aw/blob/main/README.md>
581529
- **AWF (Agentic Workflow Firewall)**: <https://github.com/github/gh-aw-firewall>
582530
- **MCP Gateway (MCPG)**: <https://github.com/github/gh-aw-mcpg>
531+
532+
Useful Azure DevOps MCP tools (when available): `mcp_ado_pipelines_get_build_definitions`, `mcp_ado_pipelines_get_builds`, `mcp_ado_pipelines_get_build_status`, `mcp_ado_pipelines_get_build_log`, `mcp_ado_pipelines_get_build_log_by_id`, `mcp_ado_pipelines_get_build_changes`, `mcp_ado_pipelines_get_run`, `mcp_ado_pipelines_list_runs`.
533+
534+
</details>

0 commit comments

Comments
 (0)