Create validated KBEs for new test quarantines - #69039
Draft
PureWeen wants to merge 5 commits into
Draft
Conversation
PureWeen
commented
Sep 4, 2026
PureWeen
left a comment
Member
Author
There was a problem hiding this comment.
Three high-confidence correctness/reliability issues survived independent review and cross-checking. The action pin, generated lock consistency, temporary-ID wiring, staged handler contract, and output escaping did not produce actionable findings.
PureWeen
force-pushed
the
pureween-assess-quarantine-fix-workflow
branch
from
September 4, 2026 10:00
529157d to
387bb03
Compare
Quarantine issues recorded the agent's prose description of a failure rather than the failure itself. That text is not matchable, and the Azure DevOps build it came from ages out of public retention, so within a few weeks the issue is the only surviving record of the failure and it no longer contains the actual error. Anyone picking the test up later has nothing precise to work from. The collector already fetched errorMessage and stackTrace per test to build the agent prompt, so the data was always present; only the paraphrasing destroyed it. It now derives an Arcade Known Issue payload from that same text and the agent pastes it verbatim instead of describing it. The signature is a literal substring of the real errorMessage. Volatile fragments (ports, GUIDs, timings, addresses, paths, counters) are located and the longest contiguous stable run between them is taken; fragments are never stitched together, because Arcade matches with String.Contains and a stitched string would never match anything. When no trustworthy signature can be derived the payload is omitted and the reason recorded, rather than emitting one that would match half the repository. ExcludeConsoleLog is set because one xunit console log is shared by every test in a Helix work item, so including it attributes unrelated failures to the issue. The section uses the "### Known Issue Error Message" heading to avoid colliding with the template's human-readable "## Error Message" prose. The "Known Build Error" label is deliberately not applied. A Known Build Error means a failure still blocks other people's builds, and a quarantined test no longer blocks anything. Registering these is a separate human decision; this change only prepares a valid payload. The marker embeds a sha256 prefix of the ErrorMessage so any consumer can detect paraphrasing or truncation without access to the originating run. This detects mangling, not forgery, and the tests demonstrate that boundary. Tests extract the derivation from the workflow between sentinel comments and execute it, so they exercise the shipped code rather than a copy. They include an independent reproduction of the signature a human hand-wrote for the real Known Build Error on dotnet#68708. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5905c51-843f-4d8c-9852-cbbcf77d7723
Generate quarantine issues through a deterministic safe-output handler that validates runtime-style matchers against captured test evidence and gates Build Insights enrollment. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5905c51-843f-4d8c-9852-cbbcf77d7723
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5905c51-843f-4d8c-9852-cbbcf77d7723
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5905c51-843f-4d8c-9852-cbbcf77d7723
Track assembly-level quarantine removals across project history, fail closed on ambiguous source associations, and cover renamed or inherited test layouts. Enforce a single custom issue call and use deterministic exact-title issue reuse. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5905c51-843f-4d8c-9852-cbbcf77d7723
PureWeen
force-pushed
the
pureween-assess-quarantine-fix-workflow
branch
from
September 4, 2026 15:56
ef562ab to
48b6a87
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This is ready for workflow-safety review. The implementation is complete, but automatic Known Build Error enrollment is still off until we do a separately approved post-merge canary.
What this unlocks
The test-quarantine workflow already collects the exact failing test, build, test result, error, and stack trace. This PR keeps that evidence and uses it to safely produce the full quarantine handoff for one eligible new flaky test:
The useful part here is that we are not trusting the agent to decide whether a test is eligible or to render the final issue. The repository proves eligibility, the agent proposes a narrowly scoped matcher, and repository code validates everything again before anything is written.
You can see it working
I ran the complete live path in my public fork with synthetic failure data. The input is intentionally fake and clearly labeled, but the issue, comment, PR, temporary-ID resolution, threat detection, and safe-output processing are real:
That run created exactly one issue, one comment, and one draft PR.
aw_synthdemoresolved to issue55in the comment target, PR body, and committed[QuarantinedTest("https://github.com/PureWeen/aspnetcore/issues/55")]attribute. The PR targets this feature branch and changes onlyAdaptiveCapacityDictionaryTests.cs.No ASP.NET Core test actually failed for this demo. No upstream state was changed, no
Known Build Errorlabel was applied, and the rollout variable remains disabled.How the safety boundary works
The agent cannot choose the repository, issue title, final body, labels, build identity, eligibility result, or final JSON. It can only choose one collector-approved test and propose a matcher copied from the supplied failure evidence.
The collector requires an exact individual test, exact source resolution, at least two distinct post-cutoff failing builds, no consistent regression, no current method/type/inherited/assembly quarantine, no applicable quarantine-removal history, and an exact evidence build/run/result match. Missing or ambiguous evidence fails closed.
Important hardening from review
The review work found a few places where the first version was not conservative enough. The final branch now:
Repository commit
71e388eab781698fa8e4e8afa5f3df464788f4c1, which removed an assembly quarantine from a separate ProjectTemplates fixture file, is the representative real history case used to verify the collector.Rollout is deliberately separate
Every new issue receives
test-failure. It receivesKnown Build Erroronly when every validation succeeds andTEST_QUARANTINE_ENABLE_KBEis exactlytrue.This PR does not create or enable that variable. So merging this code does not enroll anything in the shared DNCENG Known Build Errors project. The first real enrollment remains a small, explicitly approved post-merge canary that we can turn off immediately.
The fork demonstration proves our repository and GitHub write path. It does not claim to prove DNCENG project enrollment or matching of a real Build Insights occurrence.
Validation
Production head:
48b6a87a99b363e681e0fb171421da301744863bDetailed eligibility and matcher rules
Deterministic Case A gates
The collector requires:
DerivedType.BaseMethod;is_consistent_regression == falsefor Source A;previous_filenamefor renames.The cutoff includes first-parent
origin/mainchanges to every declaring/runner file, quarantine-removal history, and trusted prior suppression/attempt history. An unrelated same-file edit can defer a valid candidate, but stale evidence cannot activate a KBE.Matcher rules
The local
create-kbeskill followsdotnet/runtimematcher conventions and prefers:The handler rejects bare test names, stack frames, exception types, generic assertion/timeout/crash/infrastructure text, cross-test matches, unsafe regex constructs, and oversized bounds.
A verified issue ends with exactly one Build Insights block:
{ "ErrorMessage": "...", "ErrorPattern": "", "BuildRetry": false, "ExcludeConsoleLog": true }Exactly one matcher field is populated. If eligibility, evidence identity, duplicate status, or matcher specificity cannot be proven, the handler creates the ordinary
test-failureissue without KBE JSON or KBE labeling.Operational boundaries
.lock.ymlchanges remain compiler-owned under the repository-pinned gh-aw v0.88.2.