Skip to content

Add known-issue-history skill for analyzing Known Build Error failure rates - #10

Merged
danmoseley merged 20 commits into
dotnet:mainfrom
danmoseley:known-issue-history
Mar 25, 2026
Merged

danmoseley merged 20 commits into
dotnet:mainfrom
danmoseley:known-issue-history

Conversation

@danmoseley

@danmoseley danmoseley commented Mar 22, 2026 •

Copy link
Copy Markdown

Add known-issue-history skill

Note

This PR description was AI/Copilot-generated.

Summary

Adds a new known-issue-history skill to the dotnet-dnceng plugin that reconstructs basic failure timelines for "Known Build Error" issues without needing Kusto access.

Problem

The build-analysis bot maintains rolling hit count tables (24h/7d/1mo) in Known Build Error issue bodies, but there's no way to see historical failure rates or answer "when did this test last fail?" The rolling windows hide the full history.

Solution

A PowerShell script that queries the GitHub GraphQL userContentEdits API to mine the edit history of these issues. Each time the build-analysis bot edits the hit counts, it creates a snapshot. By tracking when the 24-hour count transitions from 0 to a positive value, the script detects individual failure events and groups them into failure periods.

Features

  • Single issue analysis (-IssueNumber 100088) — full failure timeline with period grouping, peak counts, days since last failure
  • List active mode (-ListActive) — scans all open Known Build Error issues and ranks by recent activity
  • Date filtering (-Since 2025-01-01) — focus on recent history
  • JSON output (-Json) — structured [KNOWN_ISSUE_HISTORY] block for agent consumption
  • Cross-repo — works for any dotnet repo with Known Build Error issues (runtime, aspnetcore, sdk, etc.)

Example output

======================================================================
KNOWN ISSUE FAILURE HISTORY
======================================================================
Issue:      #100088 - System.Net.Tests.HttpListenerRequestTests fail with SocketException
Edits:      35 total (28 with hit counts)

Total failure events:  6
Failure periods:       4
Last failure:          2025-11-06
Days since last:       135

FAILURE PERIODS
#    Start                   End                     Peak 24h   Peak 1mo
1    2024-03-21              2024-04-20                    1          1
2    2025-02-14              2025-03-15                    2          3
3    2025-10-07              2025-11-06                    1          1
4    2025-11-06              2025-12-06                    1          1

Files

  • plugins/dotnet-dnceng/skills/known-issue-history/SKILL.md — skill metadata and documentation
  • plugins/dotnet-dnceng/skills/known-issue-history/scripts/Get-KnownIssueHistory.ps1 — analysis script
  • plugins/dotnet-dnceng/skills/known-issue-history/references/known-issue-history.md — reference doc
  • .github/CODEOWNERS — added ownership entry

… rates

New skill that reconstructs failure timelines for Known Build Error issues
by querying the GitHub GraphQL userContentEdits API. The build-analysis bot
periodically edits issue bodies with rolling hit count tables (24h/7d/1mo)
-- this skill mines the edit history to detect individual failure events
and group them into failure periods.

Features:
- Single issue analysis with failure timeline and period grouping
- -ListActive mode to scan all open Known Build Error issues and rank by
  recent activity
- -Since filter for date-range queries
- -Json output for structured consumption by agents
- Pagination support for issues with many edits

Works across all dotnet repos that use Known Build Error issues
(runtime, aspnetcore, sdk, roslyn, etc).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@danmoseley
danmoseley requested a review from lewing as a code owner March 22, 2026 05:48
Copilot AI review requested due to automatic review settings March 22, 2026 05:48
@danmoseley
danmoseley requested a review from ViktorHofer as a code owner March 22, 2026 05:48

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

Adds a new known-issue-history skill to the dotnet-dnceng plugin to reconstruct historical “Known Build Error” failure timelines by mining GitHub issue body edit history via GraphQL userContentEdits.

Changes:

  • Introduces Get-KnownIssueHistory.ps1 to analyze a single issue or scan active known issues and optionally emit a JSON summary block.
  • Adds skill documentation (SKILL.md) and a deeper reference doc describing detection logic, interpretation, and limitations.
  • Updates CODEOWNERS to assign ownership for the new skill folder.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
plugins/dotnet-dnceng/skills/known-issue-history/scripts/Get-KnownIssueHistory.ps1 New PowerShell implementation that queries userContentEdits and attempts to parse hit-count history into events/periods.
plugins/dotnet-dnceng/skills/known-issue-history/references/known-issue-history.md Reference documentation explaining the approach and how to interpret results.
plugins/dotnet-dnceng/skills/known-issue-history/SKILL.md Skill metadata + usage documentation for the agent/skill catalog.
.github/CODEOWNERS Adds code ownership entry for the new skill directory.

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

@danmoseley

Copy link
Copy Markdown
Author

@lewing general issue but I think we should put a little stub skill in repos like runtime to find this? I nearly put it in there but I knew that would be wrong..

danmoseley and others added 2 commits March 21, 2026 23:57
…CODEOWNERS

- Increase labels(first: 10) to first: 100 to avoid missing label on issues with many labels
- Add AssumeUniversal to -Since date parsing for deterministic UTC filtering
- Warn when -MaxIssues exceeds GitHub API per_page limit of 100
- Add @lewing as second CODEOWNER (CI requires 2+ individuals)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 22, 2026 05:58

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

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


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

@danmoseley

danmoseley commented Mar 22, 2026 •

Copy link
Copy Markdown
Author

this I think is a repo configuration thing for branch in forks @lewing?

gh: Resource not accessible by integration (HTTP 403)
{"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/issues/comments#create-an-issue-comment","status":"403"}

danmoseley and others added 2 commits March 22, 2026 00:01
Addresses validate-structure warning about missing sequenced procedures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add sort=updated&direction=desc to ListActive API call so recently-active issues are fetched first
- Use Write-Host for JSON output to keep all output on same stream

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 22, 2026 06:03
@danmoseley

Copy link
Copy Markdown
Author

The "right" way to do this I guess is to hook something up to query the Build analysis Kusto. But that seems a potential pit of wiring and infra and perms when this simple trick works well enough for now.

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

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


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

@danmoseley

Copy link
Copy Markdown
Author

Ugh it made another PR

…k, throw on errors

- Add [ValidateRange(1,100)] to -MaxIssues parameter
- Use regex validation in Split-Repository to reject unexpected characters
- Add explicit gh auth status check before API calls
- Use throw instead of Write-Error (consistent with ErrorActionPreference=Stop)
- Remove dead MaxIssues cap code (now handled by ValidateRange)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


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

- Add explicit Get-Command gh check before gh auth status for a clearer
  error when the CLI is missing
- Switch SKILL.md description to folded YAML scalar style for readability

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@danmoseley
danmoseley requested a review from Copilot March 22, 2026 18:32

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


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

- Check for GraphQL errors array before accessing data (avoids misleading
  'Issue not found' when the real error is permissions/repo not found)
- Cap ListActive pagination to 5 pages (500 edits) per issue to avoid
  thousands of API calls when scanning many issues

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


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

@danmoseley

Copy link
Copy Markdown
Author

@matouskozak look OK can we merge? I'm using it already -- but out of the PR...

danmoseley and others added 2 commits March 23, 2026 21:06
Copilot AI review requested due to automatic review settings March 24, 2026 03:07
When -Since is specified, Format-Timeline now labels failure event and
period counts with '(since ...)' and shows all-time totals separately.
Build-JsonSummary includes both filtered and total counts, plus the
sinceFilter value, so JSON consumers know when data is filtered.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


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

danmoseley and others added 2 commits March 23, 2026 21:13
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary and failure period tables now show clean yyyy-MM-dd dates
instead of raw timestamps. Detailed timeline keeps full timestamps.
ListActive now skips items with a pull_request field to avoid querying
PRs that happen to have the Known Build Error label.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 24, 2026 03:16

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

## Key Parameters

| Parameter | Description |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure if we care too much about this as a scenario, but the case where someone amends the tracking blob will throw this off quite a bit.

@@ -0,0 +1,77 @@
# Known Issue History Analysis

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there something this doc is trying to add that the main skill file doesn't already hint at?

@matouskozak matouskozak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I would try to reduce the duplicate information between the two .md files before merging.


### Interpreting Output

**Failure periods** show clusters of failures. A test with many short periods is intermittently flaky. A test with one long period had a sustained regression.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is going to be mostly true for main where pipelines run every day. However, on servicing branches, we sometimes have KBE issues that only hit once a week as the frequency of pipeline runs is much lower.

That said, I don't think this will cause too much trouble and it is probably better to keep it simple this way.

Comment on lines +99 to +114
### Failure Periods

Consecutive failure events are grouped into periods. A period starts when 24h goes from 0→N and ends when all counts return to 0.

- **Many short periods** → intermittently flaky test
- **One long period** → sustained regression
- **Peak 24h count** → severity indicator (1 = occasional, higher = frequent across builds)

### Triage Guidelines

| Days Since Last Failure | Status | Action |
|------------------------|--------|--------|
| 0-7 | Actively failing | Needs investigation |
| 7-30 | Recently active | Monitor |
| 30-90 | Dormant | Consider closing |
| 90+ | Likely fixed | Recommend closing |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is duplicated in known-issue-history.md

There is actually quite a few sections which are duplicated.

@danmoseley

Copy link
Copy Markdown
Author

@copilot address feedback

Copilot AI review requested due to automatic review settings March 25, 2026 19:45
@danmoseley
danmoseley merged commit 8d30e12 into dotnet:main Mar 25, 2026
@danmoseley
danmoseley deleted the known-issue-history branch March 25, 2026 19:45

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


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

}
}
elseif ($inFailure -and $entry.Event -ne 'all_clear') {
# Non-failure update within a period — track peak counts as they decay

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

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

This inline comment says "track peak counts as they decay", but the code only updates PeakHit1mo when the value increases (i.e., it tracks a peak, not decay). Please update the comment to match the behavior, or adjust the logic if you intended to capture something other than the maximum.

Suggested change
# Non-failure update within a period — track peak counts as they decay
# Non-failure update within a period — maintain peak 1-month hit count

Copilot uses AI. Check for mistakes.
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.

4 participants