Skip to content

fix(health): ignore unexecuted workflow runs - #69225

Merged
pelikhan merged 5 commits into
mainfrom
pelikhan-agentic-workflow-health
Oct 16, 2026
Merged

pelikhan merged 5 commits into
mainfrom
pelikhan-agentic-workflow-health

Conversation

@pelikhan

@pelikhan pelikhan commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Runs that never execute should not reduce workflow health or create pending revision evidence. GitHub can mark expired approval requests as failure, so filtering only action_required is insufficient.

This change excludes skipped and action_required runs. Waiting and failed runs are excluded only after an attempt-specific Jobs API lookup confirms no jobs. Job-backed waiting runs remain pending revision evidence. Successful job-presence results, including empty results, are cached by run ID and attempt within the collection. Jobs API errors and malformed responses are surfaced and never cached as zero jobs.

Sampling continues backward past ignored runs without the unrelated fixed 20-page cap. At GitHub's 1,000-result search ceiling, health narrows the upper timestamp boundary and restarts pagination, overlapping the boundary second and deduplicating run IDs. Explicit start/end bounds and API quotas remain enforced. Saturated or unavailable timestamps that prevent safe advancement produce an explicitly partial report, never a healthy verdict based on truncated evidence.

The job-presence probe requests only one job, uses the existing quota guard, and avoids revision lookups for ignored runs. CLI help and reference documentation describe the behavior.

Regression coverage verifies more than 20 ignored pages, search-window rollover across 1,000 results, timestamp overlap and deduplication, reuse of empty and nonempty job probes across overlap, distinct attempts and collections, preservation of job-backed waiting revision evidence, conservative direct calculations without API evidence, explicit date bounds, saturation/missing timestamps, request-budget exhaustion, executed failures and caller-owned data, enterprise-host lookups, malformed/unavailable responses and uncached errors.

ADR: ADR-69225: Ignore Unexecuted Workflow Runs in Health Sampling

Validation: local CLI build, targeted health/time-window/pagination regressions, impacted Go tests, and the change-scoped formatting/lint/schema/workflow-drift gate passed. An earlier targeted AI Moderator recheck over the original 24-hour window produced zero failures and no failure clusters; its revision remained unknown, so this was not a healthy verdict. No workflows were dispatched.

pelikhan and others added 2 commits October 15, 2026 21:01
Exclude waiting runs and non-dispatched conclusions from health metrics and revision evidence while preserving pagination to executed runs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Probe the sampled run attempt through the budgeted Jobs API and omit failures with no jobs from metrics, revisions, and failure clusters. Preserve executed failures, paginate to older evidence, and surface unavailable or malformed job responses.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan changed the title fix(health): ignore runs awaiting approval fix(health): ignore unexecuted workflow runs Oct 16, 2026
Continue bounded health sampling beyond the fixed page cap and roll over GitHub's 1,000-result search windows without skipping tied timestamps. Keep explicit time bounds and API budgets, and report incomplete boundary coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 16, 2026 05:24
Copilot AI max review requested due to automatic review settings October 16, 2026 05:24
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · haiku45 · 4.77 AIC · ⌖ 9.63 AIC · ◇ 1.72 AIC · ⊞ 9.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #69225

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

Assert numbered pages keep the search window stable until rollover, while preserving coverage that filtered batches do not hide older dispatched runs.

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

@github-actions github-actions Bot 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.

L7: yagni: 12-line pagination helper in a separate file with one caller. Inline the boundary check in sampleHealthWorkflow.

net: -8 lines possible.

Generated by ✂️ Ponytail Reviewer for #69225 · codex · gpt56 · 8.59 AIC · ⌖ 5.44 AIC · ⊞ 14.6K
Comment /ponytail to run again

Comment thread pkg/cli/health_pagination.go
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (477 new lines in pkg/) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/69225-ignore-unexecuted-runs-in-health-sampling.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete the missing sections — add context the AI couldn't infer (notably the Deciders line, marked [TODO: verify]), refine the decision rationale, and list the real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-69225: Ignore Unexecuted Workflow Runs in Health Sampling

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

🔍 Evidence used
  • No implementation label; enforcement triggered by code volume: 477 additions in business-logic directories (threshold 100), 10 files changed, no .design-gate.yml override.
  • No ADR link or ADR section found in the PR body; no fixes #N linked issue; no docs/adr/69225-*.md existed on the branch before this run.
  • Decision inferred from pkg/cli/health_metrics.go (isIgnoredHealthRun), pkg/cli/health_sampling.go (healthRunHasJobs, unbounded page loop), pkg/cli/health_pagination.go (advanceHealthRunWindow, 1,000-result window roll), pkg/cli/health_revisions.go, and the CLI/docs text updates.
❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · opus50 · 51.5 AIC · ⌖ 51.5 AIC · ⊞ 1.9K · ◷
Comment /review to run again

@github-actions github-actions Bot 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.

Review verdict

I found two actionable issues in the new health sampling path: the rollover logic re-probes duplicate failed runs, and the new waiting filter looks broader than the approval-only case this patch is trying to exclude.

Themes
  • Boundary-overlap pagination now intentionally duplicates a timestamp window, but the jobs probe runs before dedupe, so redundant calls can burn the request budget and force partial reports.
  • waiting is being treated as equivalent to a never-dispatched run, which can hide real pending current-revision evidence if that status appears outside the approval-only shape.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 52 AIC · ⌖ 5.94 AIC · ⊞ 21.7K
Comment /review to run again

Comment thread pkg/cli/health_sampling.go
Comment thread pkg/cli/health_metrics.go Outdated
Confirm waiting attempts have no jobs before excluding them, cache successful job-presence results per run and attempt across overlap, and document bounded evidence sampling in ADR-69225.

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

Copy link
Copy Markdown
Collaborator Author

Replying to #69225 (comment):

No code change for this status-only comment. The two substantive sampling findings from the completed review are fixed in e573435 and answered in their respective threads.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Replying to #69225 (comment):

Agreed that reported_no_action does not establish test quality or completed validation, so no implementation change is inferred from this status. Focused health regressions and impacted Go tests passed, and the final formatting/lint/schema/workflow-drift gate passed after correcting the help function size.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Replying to #69225 (comment):

No implementation change is requested by this completion notice. The helper-inlining suggestion was evaluated and declined: the named boundary helper keeps the sampling loop readable and within repository function-size limits.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Replying to #69225 (comment):

No code change for this review-in-progress notification because it contains no actionable finding. The substantive findings supplied in this batch have been addressed separately.

@github-actions github-actions Bot 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.

Skills-Based Review ð�§

Applied /diagnosing-bugs, /grill-with-docs, and /tdd — observations only, no blocking issues.

� Key Themes & Highlights

Key Themes

  • Redundant Jobs API calls at window boundaries: healthRunHasJobs runs before run de-duplication in sampleHealthWorkflow, so a failing run re-fetched across the 1s-overlapping search-window boundary gets checked twice before the duplicate is dropped. Minor API budget waste, not correctness-breaking.
  • Doc duplication: The new paragraph on excluded run types (waiting/action_required/skipped/no-job failures) and the pre-existing paragraph on 'runs that never dispatched a job' now both describe overlapping behavior with slightly different scope, inviting drift.
  • Test gap: healthRunHasJobs's Attempt == 0 fallback path (endpoint without /attempts/N) has no direct test.

Positive Highlights

  • âœ� Thorough regression coverage: pagination rollover at the 1,000-result boundary, timestamp-tie dedup, request-budget exhaustion, malformed/missing Jobs API responses, and caller-data immutability are all explicitly tested.
  • âœ� isIgnoredHealthRun is applied consistently across metrics, revisions, and sampling, avoiding a half-filtered state.
  • âœ� errHealthAPIBudget and partial-report semantics are preserved and extended correctly to the new Jobs API probe.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 139.1 AIC · ⌖ 15.1 AIC · ⊞ 11.7K
Comment /matt to run again

Comment thread pkg/cli/health_sampling.go
Comment thread pkg/cli/health_sampling.go Outdated
Comment thread pkg/cli/health_sampling.go
@pelikhan

Copy link
Copy Markdown
Collaborator Author

Replying to #69225 (comment):

No separate implementation change is needed for this gate-completion notification. The subsequent ADR requirement is addressed with ADR-69225 and a link in the PR body.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Replying to #69225 (comment):

Accepted: added and linked ADR-69225, documenting context, decision, alternatives, consequences, attempt-scoped caching, and evidence-based waiting-run handling. The claimed draft was absent locally and on the branch, so this is a new Proposed ADR; maintainer approval and deciders are explicitly not asserted.

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.

🟡 Changes recommended

Unresolved health-classification, collection-coverage, and regression-test issues prevent approval.

1 open finding
What changed in this PR

Updates gh aw health to exclude unexecuted runs and continue sampling for usable workflow evidence.

Changes:

  • Filters approval-waiting, skipped, and confirmed zero-job failed runs.
  • Adds search-window rollover with quota and partial-report safeguards.
  • Extends regression coverage, CLI help, and reference documentation.
File Description
pkg/​cli/​health_sampling.go Filters runs, probes jobs, and extends pagination.
pkg/​cli/​health_sampling_test.go Tests filtering and request counts.
pkg/​cli/​health_revisions.go Excludes ignored runs from revision evidence.
pkg/​cli/​health_revisions_test.go Tests exclusions and input preservation.
pkg/​cli/​health_pagination.go Adds timestamp-based search-window rollover.
pkg/​cli/​health_pagination_test.go Covers rollover, boundaries, and request limits.
pkg/​cli/​health_no_jobs_test.go Covers job probes and insufficient evidence.
pkg/​cli/​health_metrics.go Filters ignored runs without modifying caller data.
pkg/​cli/​health_command.go Documents exclusions in CLI help.
docs/​src/​content/​docs/​setup/​cli.md Explains filtering and sampling behavior.

🧠 Review effort: Max


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/cli/health_sampling.go Outdated
@pelikhan
pelikhan merged commit aa629a8 into main Oct 16, 2026
79 checks passed
@pelikhan
pelikhan deleted the pelikhan-agentic-workflow-health branch October 16, 2026 05:50
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.92.3

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.

2 participants