Repository navigation
fix: prioritize current failures in workflow health checks - #70552
Conversation
Compare workflow source blob SHAs with the pushed branch even when lock metadata is unchanged. Stop superseded branch/event history, exclude stale failures, and retain current failures in other scopes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Collect explicit agentic workflow failures before successful-run evidence, preserve bounded failure samples at API limits, and prioritize recently failing workflows for chronological follow-up. Expose failure-pass completion and retain source-revision filtering. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Commit pushed:
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
🏗️ Design Decision Gate — ADR RequiredThis PR adds 767 new lines under 📄 Draft ADR committed: Inferred decision:
📋 What to do next
Once the ADR is linked in the PR body, this gate will re-run and check that the implementation matches the decision. ❓ Why ADRs MatterADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors, including your future self, can see the reasoning behind it. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
ADRs are stored in
|
There was a problem hiding this comment.
Review
Found one medium-severity API-budget risk: the repository-wide failure-first scan can exhaust collection time on unrelated failures before registered AW workflows are sampled. An inline comment explains the impact and a bounded/early-terminating scan is needed. Static review only; tests were not run.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · 3.65 AIC · ⌖ 0.544 AIC · ⊞ 1.6K
Comment /review to run again
|
One or more custom setup steps configured for this repository failed during this Copilot code review run: Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review. Note You can configure setup steps for Copilot code review separately from Copilot cloud agent with a |
There was a problem hiding this comment.
🟡 Changes recommended
Revision handling and cross-scope sampling can misclassify health evidence and investigation targets.
5 open issues
What changed in this PR
Updates gh aw health to prioritize actionable failures within its API budget and compare runs against pushed workflow sources.
Changes:
- Collect failures before chronological evidence, with prioritization and deduplication.
- Track source revisions and exclude superseded failures.
- Document collection limits and expand regression coverage.
| File | Description |
|---|---|
| pkg/cli/health_time_window_test.go | Adapts time-window tests to failure-first collection. |
| pkg/cli/health_source_revisions_test.go | Tests source changes and lookup failures. |
| pkg/cli/health_sampling.go | Integrates failure-first sampling and source boundaries. |
| pkg/cli/health_sampling_test.go | Updates sampling fixtures and request expectations. |
| pkg/cli/health_revisions.go | Adds source-aware revision cohorts and reporting. |
| pkg/cli/health_revision_metadata.go | Resolves and compares source blob SHAs. |
| pkg/cli/health_pagination_test.go | Updates pagination fixtures and request counts. |
| pkg/cli/health_no_jobs_test.go | Adapts job-presence tests. |
| pkg/cli/health_failures_first.go | Implements failure collection, prioritization, and deduplication. |
| pkg/cli/health_failures_first_test.go | Tests ordering, limits, pagination, and merging. |
| pkg/cli/health_command.go | Updates help and awaiting-evidence messaging. |
| pkg/cli/health_collection.go | Tracks source revisions and failure-pass completion. |
| docs/src/content/docs/setup/cli.md | Documents collection and revision semantics. |
| .github/aw/analyzing-runs.md | Updates health-report interpretation guidance. |
Review effort: Max
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /codebase-design (pr-triage recommended /diagnosing-bugs + /tdd). Overall this is a well-tested bug fix — commenting with a few targeted suggestions rather than blocking.
📋 Key Themes & Highlights
Key Themes
- Precedence fix undertested in isolation:
calculateCurrentWorkflowHealth'sfailures_observedpriority rule (health_revisions.go:199) is the actual bug fix in this PR, but is only exercised indirectly through a broader source-boundary scenario test. A dedicated table test over cohort-order permutations would lock in the fix. - Scope-capping ordering subtlety: in
collectHealthFailures, the run that proves a source change happened is appended torunsbefore the scope is capped — worth double-checking that stale evidence isn't counted towardfailures_observed. - Parameter/iteration-order mismatch:
mergeHealthRunSamples(failures, runs)iteratesrunsbeforefailuresinternally, inverting the apparent precedence from the signature — a readability/maintainability risk. - Doubled API cost per revision lookup is well documented in the PR description and covered by an updated test, but not called out in code comments at the call site.
Positive Highlights
- ✅ Strong new test coverage:
health_failures_first_test.goandhealth_source_revisions_test.gocover pagination, budget exhaustion, dedup, and scope isolation scenarios thoroughly. - ✅ Documentation (
analyzing-runs.md,cli.md) was updated consistently with the behavior change. - ✅ The source-SHA comparison mechanism (
healthSourceChanged/healthContentRevisionKey) is a clean, well-isolated addition that composes naturally with the existing revision-cohort model.
Note: investigation was bounded per the review budget; the four inline comments above represent the highest-impact findings from tracing the new control flow in health_failures_first.go, health_revisions.go, and health_revision_metadata.go against their test suites.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 241.4 AIC · ⌖ 15.3 AIC · ⊞ 10.1K
Comment /matt to run again
Inventory list-only failure signals before verifying one representative per scope. Preserve approximate candidates separately from confirmed current-revision evidence, scope named queries, and reuse committed local workflow trees and blobs with batched API fallback. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: 5585873
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Keep unresolved source lookups in current unknown evidence instead of borrowing branch source identity. Pin recovery, stale-boundary exclusion, and status precedence with direct regressions, and review the health collection ADR. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Acknowledged the Ponytail no-action notification. This comment contains no actionable change request; the concrete review findings are being handled separately. |
|
Acknowledged the Test Quality Sentinel no-action notification. No change is required by this notification; focused health regression coverage was validated independently. |
|
Acknowledged the skills-review completion notification. It contains no actionable feedback requiring another code change. |
|
Accepted the ADR follow-up: the generated draft has been reviewed and updated to match budgeted failure discovery, representative verification, and local Git reuse. The ADR remains Proposed pending maintainer acceptance. |
|
Acknowledged the code-quality review completion notification. It contains no actionable findings; specific inline comments have been evaluated separately. |
|
Accepted the ADR gate feedback: reviewed and completed the rationale, alternatives, consequences, and decision status without inventing approvals. The updated ADR is linked in the PR body and remains Proposed for maintainer acceptance. |
|
Investigated the review setup failure: run 39458171343 failed while installing gopls because sum.golang.org returned an HTTP/2 INTERNAL_ERROR during dependency verification. This is an external transport failure rather than a demonstrated setup defect in this PR, so I declined a speculative configuration change and did not rerun CI. |


Summary
Health checks were spending their API budget on successful workflows, repeatedly reading unchanged files, and investigating failures superseded by pushed workflow changes. This makes
gh aw healtha budgeted early-warning scan: discover potential issues cheaply, verify representative evidence, and reuse source objects.failureconclusions from run-list payloads before job or revision lookups. Preserve approximate per-workflow signals incollection.potential_issues, explicitly separated from confirmed current-revision clusters. Verify one job-backed representative per branch/event, then fill chronological samples, prioritizing recently failing workflows and deduplicating runs. Named checks query only their selected workflow.Validation
make buildmake fmtgo test ./pkg/cli -run '^TestHealth' -count=1make agent-report-progresspassed for the combined review batch, including formatting, scoped lint, impacted tests, and workflow drift checks, using session-isolatedTMPDIRandGOLANGCI_LINT_CACHEand modern Bash onPATH.Regression coverage includes pushed sources with unchanged locks, other branches, budget exhaustion before verification, list-only signal retention, scoped queries, pagination, deduplication, chronological metrics, local/remote repository identity, dirty-file exclusion, missing-object fallback, and snapshot/blob reuse.
Request-count fixtures verify that 150 failures across 50 workflows are inventoried with two listing requests and no enrichment, and that two workflows across two commits share three directory snapshots and one lock-blob request.
Observed behavior
Live checks use the same run-creation window, October 19-20, 2026, 13:42:01 UTC. Before the latest reuse optimization, failure-first collection surfaced 97 failed runs instead of 60 and 46 clusters instead of 36 at the same 1,000-request budget, but overall coverage remained partial.
With local-first reuse, a targeted Daily A/B Testing Advisor check completed in about 4.5 seconds with 9 counted API requests, 4 local revision reads, and zero remote file/revision lookups. A full-fleet comparison was interrupted by a GitHub Jobs API HTTP 502, so no new fleet-wide performance claim is made. Network timings are observational, not controlled benchmarks.
ADR: ADR-70552: Failure-First, Source-Aware Workflow Health Collection
Review follow-up
Merged the latest main and verified bounded failure inventory, named-workflow scoping, branch-sensitive cache checks, chronological coverage of failure-discovered scopes, and sample precedence. Corrected the remaining unknown-source edge case so unavailable immutable sources retain current unknown failure evidence instead of borrowing branch identity. Added direct status-precedence, stale-boundary, and distinct-source recovery regressions.
The ADR is reviewed and remains Proposed pending maintainer acceptance. The prior review setup failure was an external sum.golang.org HTTP/2 transport error, not a demonstrated setup configuration defect; no CI was triggered.