Skip to content

Commit 4fc4830

Browse files
ViveliDuChCopilot
andauthored
Extend PR failure scan for servicing and infrastructure KBEs (#138158)
## Summary - support exact PR check-run deep links without mixing workflow attempts - add optional runtime versus dnceng KBE routing and a create-dnceng-kbe skill - add servicing branch and conditional VMR propagation analysis - preserve the existing create-kbe, pr-failure-scan, scheduled scanner, and fixer responsibilities ## Motivation PR-targeted failure triage currently focuses on the latest PR head and the dotnet/runtime KBE destination. This leaves several gaps: - a user cannot reliably analyze a specific historical check run without risking evidence from a newer rerun on the same commit - servicing failures may already be tracked or fixed on main while the applicable fix has not reached the release branch or VMR - Build Analysis offers runtime and infrastructure issue destinations, but pr-failure-scan currently supports only the dotnet/runtime KBE destination - infrastructure drafts should follow the authoritative dotnet/dnceng issue form instead of reusing runtime-specific KBE formatting These changes extend the existing KBE flow rather than replacing it: - preserve the existing runtime lookup, drafting, publication, and workflow contracts - add exact check-run analysis - add branch-aware servicing and VMR propagation checks - add optional dnceng lookup, drafting, and explicitly authorized publication - retain dry-run and review-only safety boundaries ## Compatibility - create-kbe keeps its existing description, use cases, publication rules, and runtime KBE flow - pr-failure-scan continues to use the shared KBE instructions directly - ci-failure-fix.md remains unchanged and continues to consume the existing runtime KBE body sections - ci-failure-scan.md adds only an explicit runtime-only scope statement; its compiled lock is regenerated with gh-aw v1.0.1 - shared KBE instructions add optional destination routing and dnceng lookup while retaining the existing runtime lookup anchors and templates - dnceng publication requires explicit user permission; dry-run and review-only drafts remain local ## Review feedback addressed - screen security-sensitive evidence before dnceng lookup - preserve runtime KBE deduplication before infrastructure routing - define closed dnceng lookup windows and canonicalize duplicate chains - distinguish plain trackers from Build Analysis KBEs - verify fixes against the failing source revision - retain generic 30/90-day barriers while adding a bounded servicing-only historical fix resolver - stop ambiguous, filtered, cyclic, incomplete, or over-budget historical lookups for human review ## Validation - skill-validator check --skills .github/skills --allow-repo-traversal --verbose - Markdownlint on all changed Markdown files - gh-aw compile/validate for ci-failure-scan with v1.0.1 - git diff --check > [!NOTE] > This pull request was prepared with GitHub Copilot assistance. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17757b0e-9837-4682-8c2b-2789d4de4019
1 parent 210a89c commit 4fc4830

7 files changed

Lines changed: 497 additions & 19 deletions

File tree

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
name: create-dnceng-kbe
3+
description: >
4+
Draft or publish a caller-requested dotnet/dnceng Known Build Error outcome.
5+
The caller chooses the action; the skill reuses supplied lookup evidence or
6+
completes missing dnceng lookup context without changing that action.
7+
---
8+
9+
# Draft a dotnet/dnceng Infrastructure Known Build Error
10+
11+
Use this skill after a caller has completed dnceng ownership and duplicate
12+
triage and explicitly selected a draft or publication action.
13+
14+
This skill executes the selected action. It does not decide whether a dnceng KBE
15+
is warranted or whether the result should be draft-only or live.
16+
17+
## Authoritative guidance
18+
19+
Read the current versions of these sources before drafting:
20+
21+
1. [dnceng Known Build Error form](https://github.com/dotnet/dnceng/blob/main/.github/ISSUE_TEMPLATE/known-build-error.yml)
22+
2. [Arcade Known Issues guidance](https://github.com/dotnet/arcade/blob/main/Documentation/Build%20Analysis/KnownIssues.md)
23+
3. [Arcade Known Issue JSON steps](https://github.com/dotnet/arcade/blob/main/Documentation/Build%20Analysis/KnownIssueJsonStepByStep.md)
24+
4. [dnceng issue tracking guidance](https://github.com/dotnet/dnceng/blob/main/Documentation/TeamProcess/DevGuide/IssueTrackingGuidance.md)
25+
26+
Do not copy or recreate the dnceng issue template in this repository. Load its
27+
current field order, labels, default content, and validation requirements. If
28+
the authoritative form or guidance cannot be read, stop and report the blocked
29+
draft instead of inventing a substitute. Record the resolved repository commit
30+
SHA for each external source in the local draft so the artifact is reproducible.
31+
32+
## Input contract
33+
34+
The caller supplies:
35+
36+
- one concrete candidate already classified for a dnceng draft,
37+
- a stable candidate ID, failure name or family, and build leg,
38+
- the originating repository and PR,
39+
- the failing build, leg, pipeline, queue, logs, and stable signature evidence,
40+
- the Build Analysis infrastructure issue link when available,
41+
- the requested action:
42+
`draft-review`, `draft-new-dnceng`, `draft-recurrence-dnceng`,
43+
`publish-new-dnceng`, or `publish-recurrence-dnceng`,
44+
- dnceng duplicate-search and recurrence evidence when available,
45+
- lookup mode: `reuse-supplied` or `complete-if-needed`,
46+
- why repository ownership was rejected or remains uncertain,
47+
- any missing evidence for a review-only draft,
48+
- for publication actions: `caller=pr-failure-scan`, live mode, the prepared
49+
draft path and fingerprint, explicit user permission to publish to
50+
`dotnet/dnceng`, and the authenticated GitHub account.
51+
52+
Treat query parameters in a Build Analysis link as hints. Verify the destination
53+
repository, issue-form name, labels, build, leg, and PR against the selected
54+
check and authoritative form.
55+
56+
The requested action is mandatory. Reject contradictory action inputs. Do not
57+
select a different action.
58+
59+
## Publication boundary
60+
61+
- Publication is allowed only for `publish-new-dnceng` or
62+
`publish-recurrence-dnceng` requested by a live `pr-failure-scan` run.
63+
- Explicit user permission for publication to `dotnet/dnceng` is mandatory.
64+
Runtime or workflow publication authorization does not transfer.
65+
- `dryrun`, `draft-review`, and caller-selected draft-only outcomes never
66+
publish and never trigger a permission request.
67+
- Reject publication when the prepared draft, fingerprint, authenticated
68+
account, explicit permission, or caller identity is missing.
69+
70+
## Execute the requested action
71+
72+
1. Before using any candidate signature, error text, logs, or other supplied
73+
evidence in an external lookup, stop when the candidate contains potential
74+
security-sensitive material. Do not create any GitHub issue, AzDO work item,
75+
comment, draft, lookup query, or other external artifact.
76+
2. Verify the requested action and apply the requested lookup mode:
77+
- With `reuse-supplied`, require a conclusive dnceng lookup.
78+
- With `complete-if-needed`, reuse conclusive supplied evidence; otherwise
79+
run the dnceng duplicate and recurrence lookup before drafting.
80+
- A direct user request with an explicit action and no lookup context uses
81+
`complete-if-needed`.
82+
The lookup may return an existing issue or block an unsafe duplicate, but it
83+
must not select a different draft action.
84+
3. Load the authoritative external form and guidance. Verify that the requested
85+
action and supplied evidence are compatible with the current form.
86+
4. Write one local Markdown review artifact. Prefer the session
87+
artifact directory; otherwise use a temporary directory outside the runtime
88+
checkout.
89+
5. Render the current dnceng issue-form fields in their authoritative order and
90+
fill them with verified evidence. Use Arcade's current Known Issue guidance
91+
for the JSON signature. Preserve form-owned default content that maintainers
92+
are expected to retain. If a form-owned link is broken, record that fact and
93+
use the verified current guidance for analysis rather than silently
94+
rewriting the external template.
95+
6. Include the proposed title, current form labels, destination repository,
96+
issue-form URL, prefilled Build Analysis link when available, and any
97+
ownership uncertainty requiring maintainer review.
98+
7. Clearly mark `draft-review` as incomplete and non-publishable. Include
99+
recurrence evidence for `draft-recurrence-dnceng`.
100+
8. For `publish-new-dnceng` or `publish-recurrence-dnceng`, verify the matching
101+
prepared draft and fingerprint, perform a final narrow dnceng duplicate
102+
safety check, verify the publication boundary above, append the required AI
103+
disclosure, and publish exactly that draft.
104+
9. Report both a clickable local-file link when supported and the plain
105+
absolute path for drafts. Return the created issue URL for publication.
106+
10. Never change the caller-selected action.
107+
108+
## Outcome contract
109+
110+
```json
111+
{
112+
"status": "created | drafted | existing | blocked | failed",
113+
"requestedAction": "draft-review | draft-new-dnceng | draft-recurrence-dnceng | publish-new-dnceng | publish-recurrence-dnceng",
114+
"lookupMode": "reuse-supplied | complete-if-needed",
115+
"candidateId": "stable caller-provided identifier",
116+
"failure": "failure name or family",
117+
"buildLeg": "failing build leg",
118+
"signature": "concise stable signature summary",
119+
"proposedTitle": "draft title, or empty string",
120+
"issueUrl": "verified existing dotnet/dnceng issue URL, or null",
121+
"draftPath": "absolute local path or null",
122+
"missingEvidence": ["ownership or verification items still required"],
123+
"message": "concise evidence-based result"
124+
}
125+
```

‎.github/skills/create-kbe/SKILL.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ Read and follow these in order:
4747
2. the caller workflow or tool instructions that selected this failure and decided it is in scope
4848
3. any workflow-specific formatting or dry-run requirements for the current caller
4949

50+
When the caller already provides a complete, conclusive result from the shared
51+
lookup, reuse it. Otherwise run the applicable shared lookup before creating or
52+
updating anything. This preserves direct use of the skill while avoiding a
53+
duplicate broad search for callers that already completed it.
54+
55+
The shared instructions may classify the failure as a `dotnet/dnceng`
56+
infrastructure outcome. In that case:
57+
58+
- do not use the runtime KBE body template,
59+
- report an existing dnceng KBE directly when one matched,
60+
- use [`create-dnceng-kbe`](../create-dnceng-kbe/SKILL.md) for a requested local
61+
dnceng draft,
62+
- publish to dnceng only through the explicit-permission path documented by the
63+
caller; runtime publication authorization does not transfer.
64+
5065
## Core rules
5166

5267
- One failure shape = one KBE outcome.

‎.github/skills/pr-failure-scan/SKILL.md‎

Lines changed: 85 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ description: >
44
Analyze a dotnet/runtime PR's CI failures, skip failures already known to
55
Build Analysis, find matching Known Build Errors, and create or draft new
66
KBEs for the remaining failures. Supports dry-run output to local markdown
7-
files instead of creating GitHub issues.
7+
files instead of creating GitHub issues. Also handles exact check-run links,
8+
servicing propagation, and dnceng infrastructure KBE outcomes.
89
---
910

1011
# PR Failure Scan Skill
1112

1213
Use this skill for requests like:
1314

1415
- `/pr-failure-scan <PR URL>`
16+
- `/pr-failure-scan <PR check-run URL>`
1517
- `/pr-failure-scan <PR URL> dryrun`
1618
- `create KBEs for PR <number>`
1719

@@ -35,6 +37,7 @@ Accept one of:
3537

3638
- a PR number,
3739
- a PR URL,
40+
- a deep link to a PR check run with a numeric `check_run_id`,
3841
- text containing a PR reference,
3942
- an optional trailing `dryrun` token.
4043

@@ -45,6 +48,7 @@ Examples:
4548

4649
- `/pr-failure-scan 123456`
4750
- `/pr-failure-scan https://github.com/dotnet/runtime/pull/123456`
51+
- `/pr-failure-scan https://github.com/dotnet/runtime/pull/123456/checks?check_run_id=123456789`
4852
- `/pr-failure-scan https://github.com/dotnet/runtime/pull/123456 dryrun`
4953

5054
## Step 1: Resolve identities and require explicit permission for non-owned PRs
@@ -65,13 +69,24 @@ If the user declines, stop immediately.
6569

6670
## Step 2: Gather PR CI context
6771

68-
Use the latest completed check runs for the PR head SHA.
72+
If the input identifies a specific check run, resolve that exact completed run,
73+
verify that it belongs to the referenced PR, and use its check suite or workflow
74+
attempt and head SHA. Otherwise, use the latest completed check runs for the PR
75+
head SHA.
6976

7077
Collect all of:
7178

72-
1. The `Build Analysis` check run payload from the GitHub REST API.
73-
2. The non-success CI check runs for the PR head SHA.
74-
3. The AzDO build URLs linked from those check runs.
79+
1. The selected check run, when one was supplied.
80+
2. The `Build Analysis` check run payload from the GitHub REST API for the
81+
selected suite or workflow attempt, or for the PR head SHA when no exact
82+
check run was supplied.
83+
3. The non-success CI check runs associated with that same suite or attempt.
84+
4. The AzDO build URLs linked from those check runs.
85+
86+
Do not silently replace a selected historical run with the latest run. When
87+
sibling checks cannot be correlated unambiguously, keep the selected run as an
88+
explicit candidate and report unavailable evidence rather than mixing attempts
89+
that share a SHA.
7590

7691
The local skill has a different candidate-source model than the scheduled
7792
workflow:
@@ -86,8 +101,11 @@ workflow:
86101
Build the candidate list from two sources:
87102

88103
1. **Build Analysis unknowns on analyzed pipelines.**
89-
- Parse the `Build Analysis` check text for `Create issue in this repo` links
90-
and the surrounding failure description.
104+
- Parse the `Build Analysis` check text for both `Create issue in this repo`
105+
and `Create issue against infrastructure team` links and their surrounding
106+
failure descriptions.
107+
- Record the proposed destination, issue form, labels, build, build leg, and
108+
PR encoded in the link as hints; verify them against the selected evidence.
91109
- Each such entry is an in-scope candidate unless you later find an existing
92110
matching KBE.
93111
2. **Failed pipelines explicitly excluded from Build Analysis.**
@@ -112,13 +130,32 @@ For each candidate failure, do the following:
112130
- the relevant build or task log,
113131
- for Helix-submitted legs, the Helix console log or failure details when
114132
accessible.
115-
2. Extract the narrowest signature that fits the shared rules.
116-
3. Run the shared KBE lookup flow from
133+
2. Decide whether the failure is **related**, **unrelated**, or **unclear** with
134+
respect to the current PR:
135+
- **related**: report that the PR must be fixed and stop KBE processing for
136+
this candidate;
137+
- **unrelated**: continue with KBE lookup and handling;
138+
- **unclear**: search for existing tracking, but keep any proposed new issue
139+
as a non-publishable review draft until the relationship is resolved.
140+
3. Extract the narrowest signature and run the existing shared runtime KBE
141+
lookup flow for every unrelated or unclear candidate from
117142
`.github/workflows/shared/create-kbe.instructions.md`.
118-
4. Classify the candidate into exactly one of these buckets:
143+
4. Classify the runtime lookup into exactly one of these buckets:
119144
- **new KBE needed**
120145
- **existing KBE matched but Build Analysis likely missed it**
121146
- **unhandled**
147+
Retain a matching plain tracker as cross-link context rather than treating it
148+
as a KBE substitute.
149+
5. If a verified open runtime KBE matches, report it and stop destination
150+
routing for that candidate unless an explicit migration was requested.
151+
6. When no open runtime KBE matches, use the shared destination-classification
152+
section if runtime ownership is not already established.
153+
7. For a dnceng candidate, preserve the shared dnceng classification and either
154+
report the existing issue, prepare a new/recurrence draft, prepare a
155+
non-publishable review draft, or mark the failure unhandled.
156+
8. When the PR targets `release/<major>.<minor>`, read and follow
157+
[`references/servicing-triage.md`](references/servicing-triage.md) after the
158+
normal runtime lookup and before any live publication.
122159

123160
### PR-specific guidance for excluded or partially-analyzed pipelines
124161

@@ -168,11 +205,11 @@ In particular:
168205

169206
## Step 5: Write draft files and optionally create live issues
170207

171-
### Draft files for all new KBEs
208+
### Draft files for all new runtime KBEs
172209

173-
For every item in the **new KBE needed** bucket, always write a markdown draft
174-
file before deciding whether to create a GitHub issue. This applies to both
175-
`dryrun` and live mode.
210+
For every runtime item in the **new KBE needed** bucket, always write a markdown
211+
draft file before deciding whether to create a GitHub issue. This applies to
212+
both `dryrun` and live mode.
176213

177214
1. Write one markdown file per `new KBE needed` item.
178215
2. Prefer the session artifact directory if it is available. Otherwise, use a
@@ -190,7 +227,9 @@ Each draft file should contain:
190227
These dry-run files are **review artifacts**, not necessarily byte-for-byte live
191228
issue bodies. Keep them easy to compare and edit on disk.
192229

193-
Prefer this layout for dry-run files:
230+
Prefer this layout for runtime dry-run files. Do not use it for dnceng drafts;
231+
those must follow the authoritative dnceng issue form through
232+
[`create-dnceng-kbe`](../create-dnceng-kbe/SKILL.md).
194233

195234
````markdown
196235
# Draft KBE issue
@@ -295,9 +334,27 @@ for example:
295334
> [!NOTE]
296335
> This issue was prepared with GitHub Copilot assistance.
297336
337+
### Infrastructure KBE drafts and publication
338+
339+
For every shared result classified as a new dnceng KBE, dnceng recurrence, or
340+
useful infrastructure review draft, use
341+
[`create-dnceng-kbe`](../create-dnceng-kbe/SKILL.md) to create the local draft.
342+
The runtime draft layout above does not apply to these drafts.
343+
344+
- In `dryrun`, stop after producing local drafts.
345+
- A review draft or any caller-selected draft-only result is never publishable;
346+
do not check for permission and do not ask the user whether to publish it.
347+
- In live mode, a publishable new or recurrence draft may be published only
348+
after the complete batch and servicing analysis are finished and the user
349+
explicitly authorizes publication to `dotnet/dnceng`.
350+
- Agent Merge/runtime publication authorization does not transfer to dnceng.
351+
- Before publication, show the proposed title, labels, complete form body,
352+
authenticated account, affected failures, and local draft path, then run a
353+
final narrow dnceng duplicate check.
354+
298355
## Step 6: Final output format
299356

300-
The final response must contain all four sections below.
357+
The final response must contain all six sections below.
301358

302359
### 1. New issues created or draft files
303360

@@ -324,7 +381,18 @@ For every such failure, provide:
324381
- why it appears to match,
325382
- why Build Analysis likely missed it.
326383

327-
### 4. Failures not handled
384+
### 4. Infrastructure KBE outcomes
385+
386+
List existing dnceng issues, local draft paths, created dnceng issue URLs,
387+
recurrence findings, blocked lookups, and ownership uncertainty.
388+
389+
### 5. Servicing findings
390+
391+
For release-targeted PRs, report tracker reuse, matcher gaps, main/release/VMR
392+
propagation, and any recommended maintainer `/backport` command. Never invoke
393+
the backport workflow.
394+
395+
### 6. Failures not handled
328396

329397
For every unhandled failure, provide:
330398

0 commit comments

Comments
 (0)