Repository navigation
[ci-scan-feedback] Allow fixer to read scanner-authored KBE bodies - #133150
Conversation
Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 15 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 15 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
There was a problem hiding this comment.
🟡 Changes recommended
The lock file includes an additional operational change (GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS 0→168) that appears out-of-scope and should be reverted or explicitly justified.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the ci-failure-fix agentic workflow’s GitHub tool guard configuration so that content authored by github-actions[bot] can pass the workflow’s min-integrity: approved filter, enabling the fixer to consume scanner-authored KBE issue bodies.
Changes:
- Add
github-actions[bot]to the workflow’s GitHub MCPtrusted-userslist. - Regenerate the compiled lock workflow to include the corresponding guard environment change.
File summaries
| File | Description |
|---|---|
| .github/workflows/ci-failure-fix.md | Adds trusted-users: ["github-actions[bot]"] to the GitHub tool config. |
| .github/workflows/ci-failure-fix.lock.yml | Updates generated guard config to include the trusted user (and includes an additional env-value change that should be confirmed/reverted). |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
Limit CI fixer reads to runtime KBE items and regenerate the compiled workflow. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The implemented guard change (label-based approval promotion) does not match the PR’s stated intent (trusted user for github-actions[bot]) and expands trust semantics beyond what the description/scope claims.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
Use the Known Build Error label for integrity approval, then deterministically allowlist only scanner-authored issues before the agent runs. Co-authored-by: Copilot App <[email protected]>
Recover scanner-only filtering with paginated metadata enumeration, conditional agent execution, and regression coverage. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved allowlist enforcement, repository-guard, and eval-integrity findings block approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (3)
.github/workflows/ci-failure-fix.md:59
- This newly added job hardcodes
repos/dotnet/runtimebut has no repository guard. The generated lock likewise emitsscanner_kbeswithout anif, while the workflow guidance requires jobs to be restricted to the intended repository/fork context (.github/workflows/README.md:9-19). In a non-fork copy whereactivationruns, this job can still enumerate runtime KBEs and pass them to the agent; add an explicitif: github.repository == 'dotnet/runtime'(or equivalent) and regenerate the lock.
scanner_kbes:
needs: activation
runs-on: ubuntu-latest
.github/workflows/evals/ci-failure-fix.eval.yaml:49
- This eval step reads the selected KBE with
gh issue view, which bypasses the workflow's required integrity-gated GitHub MCP path for bodies/comments (Step 2 explicitly saysNOT gh). The live eval can therefore consume maintainer-authored comments unfiltered and still pass even if the production MCP gate is broken. Use the GitHub MCP issue/comments tools here and reserveghfor the metadata intake/source reads.
2. Read it with `gh issue view <n> --repo dotnet/runtime` to recover the failing test and error signature, and inspect the relevant product or test source it points at, using `gh api` raw content or the failing area path, enough to decide whether a safe, in-bounds fix exists.
.github/workflows/evals/ci-failure-fix.eval.yaml:88
- By broadening the only required tool-call pattern to
gh (api|issue), this eval can satisfy itsacted-on-real-kbeevidence after the agent merely runs the allowlist enumeration; that call does not show that it read or acted on any candidate. The production enumerator runs outside the agent, while the prompt'sgh issue viewis the issue-level evidence, so keep a separate or conditional requirement forgh issuewhen the allowlist is non-empty while still allowing the empty-list noop path.
command: 'gh (api|issue)'
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
The eval grader does not verify intake provenance and can be bypassed with unvalidated issue reads.
Review details
Suppressed comments (1)
.github/workflows/evals/ci-failure-fix.eval.yaml:141
- The grader does not actually establish that the deterministic intake ran. This regex accepts any successful command containing the
repos/dotnet/runtime/issuesprefix (includinggh api repos/dotnet/runtime/issues/<number>), without checking the label, author/type, PR exclusion, pagination, or filter output; the candidate file is separately trusted after only validating positive numbers. An agent could therefore read a human-authored issue throughgh, write its number toout/scanner-kbe-candidates.json, make a matching MCP read, and pass this eval despite bypassing the production intake and its “noghbody reads” rule. Validate the exact intake parameters/output provenance and reject CLI body reads, with a regression test for this bypass.
if name == "bash" and re.search(
r"\bgh api\b[^\n]*\brepos/dotnet/runtime/issues\b",
args.get("command", ""),
):
enumerated = True
- Files reviewed: 5/5 changed files
- Comments generated: 0 new
- Review effort level: Lite
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Two critical workflow and grader-integrity issues remain, along with a comments-filtering issue.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
.github/workflows/evals/ci-failure-fix.eval.yaml:153
- This rejects the entire read whenever the serialized result contains
[Filtered], including a normal comments response with one association-gated comment. The linked issue explicitly requires maintainer comments to remain filtered while the bot-authored body is readable, and the fixer is supposed to skip filtered comments; consequently a valid candidate can fail the live eval solely because an unrelated comment was filtered. Distinguish a filtered body/error from filtered entries within the comments collection, and require the comments call without requiring every comment to be trusted.
if data.get("success") is not True or (
isinstance(result, dict) and result.get("isError") is True
) or "[Filtered]" in json.dumps(result):
continue
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The eval setup is not trusted against PR-controlled code, and unbounded output can exceed GitHub Actions limits.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved findings affect filtered-content handling, issue-state revalidation, candidate validation, and artifact retention.
Review details
Suppressed comments (5)
.github/workflows/ci-failure-fix.md:84
- The candidate artifact is consumed immediately by the dependent agent, but this upload does not set a retention period. With the repository's default artifact retention, a new allowlist is retained for every 12-hour run (including empty-list runs) for much longer than it is useful, causing avoidable artifact/storage accumulation; the other transient artifacts in this workflow use one-day retention. Add
retention-days: 1here and regenerate the lock file.
name: scanner-kbe-candidates
path: ${{ runner.temp }}/scanner-kbe-candidates.json
if-no-files-found: error
.github/workflows/ci-failure-fix.md:192
- This replacement removes the previous explicit rule to skip
[Filtered]MCP content, even though comments remain integrity-gated. Without telling the agent to treat a filtered body as unavailable and to ignore filtered comment entries during deduplication, it can act on incomplete/untrusted content or miss an existing handoff and emit a duplicate artifact. Restore explicit filtered-content handling and add coverage for it.
The deterministic `scanner_kbes` job has prepared `/tmp/gh-aw/agent/scanner-kbe-candidates.json`. It selects remediation candidates: only open `dotnet/runtime` issues whose exact `Known Build Error` label, `[ci-scan]` title prefix, and `github-actions[bot]` author were verified through the GitHub API. Select work only from `.candidates[].number`, in ascending creation order. If the candidate file is missing or invalid, report the error and stop; do not fall back to search for other candidates.
.github/workflows/ci-failure-fix.md:192
- The allowlist is produced in a separate job and can become stale before the agent runs: an issue may be closed after
gh apienumerates it, but this instruction still permits processing it as an open remediation target. Re-read the current issue state through MCP and requirestate == openbefore deduplication/analysis (and cover that handoff race in the deterministic grader).
The deterministic `scanner_kbes` job has prepared `/tmp/gh-aw/agent/scanner-kbe-candidates.json`. It selects remediation candidates: only open `dotnet/runtime` issues whose exact `Known Build Error` label, `[ci-scan]` title prefix, and `github-actions[bot]` author were verified through the GitHub API. Select work only from `.candidates[].number`, in ascending creation order. If the candidate file is missing or invalid, report the error and stop; do not fall back to search for other candidates.
.github/workflows/evals/ci-failure-fix.eval.yaml:168
- This accepts every successful
get_commentscall without checking whether the result is usable. An integrity-gated MCP read that returns only[Filtered]comments can therefore satisfy the eval, even though the fixer cannot inspect comments needed for deduplication and owner-engagement decisions. Reject an all-filtered comments result while still allowing a mixed result containing some filtered entries, and add a regression fixture for that case.
elif args.get("method") == "get_comments":
comments_numbers.add(args["issue_number"])
.github/workflows/evals/ci-failure-fix.eval.yaml:130
- If the candidate artifact contains a non-string
title(for examplenull), this validation raisesAttributeErrorat.startswithinstead of taking the documented invalid-candidate path. Validate the title's type before calling the string method and add a malformed-title regression case so corrupted setup data produces a deterministic grader error.
not item.get("title", "").startswith("[ci-scan] ") or
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
PureWeen
left a comment
There was a problem hiding this comment.
Holistic Review
Motivation: Deterministic scanner-candidate intake addresses the previously missing selection gate.
Approach: The pushed helper, repository-scoped intake job, and artifact transport address my prior missing-gate concern. One setup failure remains in the revised eval.
Summary: Needs Changes at e9ed82cb: the production-intake concern is addressed, but the new eval setup command fails under the configured Linux runner shell.
Detailed Findings
❌ Error — Eval setup uses Bash options under /bin/sh
.github/workflows/evals/ci-failure-fix.eval.yaml:42 starts an environment.commands block with set -euo pipefail. Pinned Vally 0.14 executes these commands using Node exec without a shell override, which selects /bin/sh on Unix. On Ubuntu this is dash, and executing the exact parsed setup command reproduces exit 2: set: Illegal option -o pipefail, before the helper or agent starts.
Use portable set -eu in this outer block (the helper is already explicitly invoked with Bash), or explicitly run the entire block under Bash. Add coverage that executes the actual setup block under the runner shell with fake gh; the existing collector tests invoke Bash and do not catch this mismatch.
This applies when the revised spec is evaluated directly or deployed. Since PR ci-eval preserves the base spec, it is not a claim that the current PR check already encountered this failure.
The separately discussed eval-provenance limitations remain deferred; this follow-up does not claim those are fixed or introduce a new production trust finding. CI status and merge readiness were not evaluated.
Note
This review was generated by GitHub Copilot.
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved trusted-helper handling and an eval fixture mismatch must be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
.github/workflows/evals/test_ci_failure_fix_candidates.py:395
- This fixture does not match the REST shape consumed by
filter-scanner-kbes.sh: the filter requires.state == "open"and.user.login/.user.type, but this fake response omitsstateand supplies projectedauthor/author_typefields instead. The filter therefore produces an empty candidate list, sotest_eval_setup_runs_under_posix_shellfails instead of validating the setup; return a raw issue-shaped object here.
" printf '%s\\n' '[{\"number\":42,\"created_at\":\"2026-01-01T00:00:00Z\","
"\"title\":\"[ci-scan] Test failure\",\"author\":\"github-actions[bot]\","
"\"author_type\":\"Bot\",\"labels\":[\"Known Build Error\"]}]'\n"
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
|
@PureWeen could you please take another look - I think this is ready. I am intentionally not trying to make the entire eval more robust than it already was in this PR (that's a whole other large thing to tackle if we think we really need it). |
…otnet#133150) ## Problem The CI failure scanner files `[ci-scan]` Known Build Error issues for the companion `ci-failure-fix` workflow to investigate. The fixer could not reliably see scanner-authored issue bodies, leaving it unable to analyze those failures or produce fixes and owner handoffs. This is the problem reported in dotnet#132745. The fix scopes issue enumeration to `dotnet/runtime` and the `Known Build Error` label, then deterministically selects issues created by the scanner bot before the agent processes them. The earlier filtering implementation needed additional corrections: - `gh issue list --json author` represents the scanner as `app/github-actions`, not `github-actions[bot]`. Comparing those values rejected every scanner candidate: a read-only check found **0 matches despite 35 eligible issues**. - The gh-aw v0.86.2 pre-agent CLI proxy does not apply approval-label settings, so placing enumeration in that phase does not reliably solve the original intake problem. - The empty-result path referenced a safe-output variable that was not available in that step and did not actually prevent agent startup. ## How the fix works 1. Keep GitHub content reads scoped to `dotnet/runtime` and configure `Known Build Error` as the approval label used to make KBE bodies available. 2. Add a separate deterministic `scanner_kbes` job with `issues: read`. It uses a shared, paginated REST filter scoped by repository, open state, and label. REST exposes the scanner's canonical `github-actions[bot]` identity. 3. Filter each page for actual issues—not pull requests—with the exact label, `[ci-scan] ` title prefix, matching bot login, and `Bot` account type. Preserve issue metadata needed for validation and order candidates oldest first. There is no 1,000-issue cap or recency cutoff that could strand older open KBEs. 4. Start the agent only when the candidate count is greater than zero. Enumeration failures fail the job rather than publishing a partial list; a missing or invalid allowlist must not fall back to broader search. Candidate bodies and comments are read through GitHub MCP. 5. Harden the live eval by preserving and restoring the trusted scanner helper when it is present in the trusted checkout. The deterministic grader validates generated candidate metadata and requires the selected issue's current MCP body read to confirm that it remains open, scanner-authored, correctly titled, and still carries the `Known Build Error` label, along with a successful comments read for the same candidate. 6. Add regression coverage for filtering, metadata, pagination, failure handling, trusted setup, current-state validation, MCP evidence, and invalid candidate lists. ## Explicit non-goal This PR does not redesign the existing eval harness to make the candidate artifact immutable or independently provenance-verifiable. That is a larger eval-harness change and remains out of scope for this focused improvement. The lock file was regenerated with its recorded compiler version, **gh-aw v0.86.2**. The original failure-issue expiry value of `0` is preserved. This does not change the fixer's separate PR/comment deduplication logic. ## Validation - `python3 .github/workflows/evals/test_ci_failure_fix_candidates.py`: **18 tests passed**, covering filtering, metadata, oldest-first ordering, pagination beyond 1,000 issues, empty results, API failure propagation, repository/job conditions, trusted eval setup, current candidate state, and body/comments/decision identity. - `gh aw compile ci-failure-fix --no-check-update`: **1/1 workflow compiled** for the changed source workflow. - `gh aw validate ci-failure-fix --no-check-update`: passed. - `vally lint --eval-spec .github/workflows/evals/ci-failure-fix.eval.yaml --strict`: passed. - ShellCheck 0.11.0 and `bash -n` on the shared filter script: passed. - `git diff --check`: passed. **Actionlint baseline caveat:** Actionlint 1.7.12 reports the same three diagnostics on the prior PR head and this implementation when shellcheck integration is disabled: two unsupported `concurrency.queue` keys and one `github.aw` expression. No new diagnostics were introduced. Its shellcheck integration also reports four pre-existing diagnostics in the generated workflow block. No live GitHub Actions run or full LLM eval was performed. > [!NOTE] > This PR and its description were prepared with GitHub Copilot. --------- Co-authored-by: Copilot App <[email protected]> Co-authored-by: Vitek Karas <[email protected]>
Problem
The CI failure scanner files
[ci-scan]Known Build Error issues for the companionci-failure-fixworkflow to investigate. The fixer could not reliably see scanner-authored issue bodies, leaving it unable to analyze those failures or produce fixes and owner handoffs. This is the problem reported in #132745.The fix scopes issue enumeration to
dotnet/runtimeand theKnown Build Errorlabel, then deterministically selects issues created by the scanner bot before the agent processes them.The earlier filtering implementation needed additional corrections:
gh issue list --json authorrepresents the scanner asapp/github-actions, notgithub-actions[bot]. Comparing those values rejected every scanner candidate: a read-only check found 0 matches despite 35 eligible issues.How the fix works
dotnet/runtimeand configureKnown Build Erroras the approval label used to make KBE bodies available.scanner_kbesjob withissues: read. It uses a shared, paginated REST filter scoped by repository, open state, and label. REST exposes the scanner's canonicalgithub-actions[bot]identity.[ci-scan]title prefix, matching bot login, andBotaccount type. Preserve issue metadata needed for validation and order candidates oldest first. There is no 1,000-issue cap or recency cutoff that could strand older open KBEs.Known Build Errorlabel, along with a successful comments read for the same candidate.Explicit non-goal
This PR does not redesign the existing eval harness to make the candidate artifact immutable or independently provenance-verifiable. That is a larger eval-harness change and remains out of scope for this focused improvement.
The lock file was regenerated with its recorded compiler version, gh-aw v0.86.2. The original failure-issue expiry value of
0is preserved. This does not change the fixer's separate PR/comment deduplication logic.Validation
python3 .github/workflows/evals/test_ci_failure_fix_candidates.py: 18 tests passed, covering filtering, metadata, oldest-first ordering, pagination beyond 1,000 issues, empty results, API failure propagation, repository/job conditions, trusted eval setup, current candidate state, and body/comments/decision identity.gh aw compile ci-failure-fix --no-check-update: 1/1 workflow compiled for the changed source workflow.gh aw validate ci-failure-fix --no-check-update: passed.vally lint --eval-spec .github/workflows/evals/ci-failure-fix.eval.yaml --strict: passed.bash -non the shared filter script: passed.git diff --check: passed.Actionlint baseline caveat: Actionlint 1.7.12 reports the same three diagnostics on the prior PR head and this implementation when shellcheck integration is disabled: two unsupported
concurrency.queuekeys and onegithub.awexpression. No new diagnostics were introduced. Its shellcheck integration also reports four pre-existing diagnostics in the generated workflow block.No live GitHub Actions run or full LLM eval was performed.
Note
This PR and its description were prepared with GitHub Copilot.