Skip to content

Take the workflow list from GitHub, not from run history - #2

Merged
tschm merged 1 commit into
mainfrom
fix/ignore-deleted-workflows
Aug 29, 2026
Merged

tschm merged 1 commit into
mainfrom
fix/ignore-deleted-workflows

Conversation

@tschm

@tschm tschm commented Aug 29, 2026

Copy link
Copy Markdown
Member

The bug

Run history outlives the workflow file. Deriving which workflows exist from it reports jobs that are long gone — and if the last run of a vanished workflow failed, the repo is red forever for something nobody can fix.

Jebel-Quant/platform had sat red for 12 weeks on .github/workflows/latex.yml, a workflow deleted in June. GitHub displays orphaned runs under their file path rather than a name, which is why it surfaced with a .yml "name" at all — the tell that it wasn't a real workflow.

Across the fleet this was 1 of 8 red repos. The other 7 are real and unaffected.

A second instance, found while fixing the first

Filtering out deleted workflows exposed the same fault in another guise: a renamed workflow appears under both names, so the old name's last run lingers exactly as the deleted one did. Workflow id 286602591 on that repo produces runs called both Build PDF and Build vision.pdf.

Both stem from treating run history as the source of truth for what exists.

The change

  • /actions/workflows is consulted for the authoritative set. Runs whose workflow is no longer active are skipped. Disabled workflows go too — a switched-off job is not a failing one.
  • Runs are keyed by workflow_id, giving one series per real workflow, labelled with the name the workflow has now. Where two active workflows share a display name, both fall back to their path so labels stay unique — the earlier name-keyed version exported duplicate label sets and Prometheus silently dropped 16 samples per scrape.
  • If the listing can't be read, the filter is skipped entirely, so a transient API error over-reports rather than blanking a repo's CI.

Verification

Run from a clean git archive of the branch, against live GitHub:

before after
workflows tracked 285 175 (the rest were ghosts)
repos red on main 8 7 (all verified genuinely active)
duplicate label sets 8 0
platform 5 "workflows", 1 red Build PDF only, 0 red

Every remaining failure was cross-checked against /actions/workflows and confirmed to be a workflow that still exists.

Costs one extra API call per repo per refresh — measured 4718/5000 remaining.

🤖 Generated with Claude Code

Run history outlives the workflow file, so deriving "which workflows exist"
from it reports jobs that are long gone - and if the last run of a vanished
workflow failed, the repo is red forever for something nobody can fix.

Jebel-Quant/platform had sat red for 12 weeks on `.github/workflows/latex.yml`,
a workflow deleted in June. GitHub displays orphaned runs under their file path
rather than a name, which is why it surfaced with a .yml "name" at all. Across
the fleet this was 1 of 8 red repos; the other 7 were real.

Filtering those out exposed the same fault in a second guise: a *renamed*
workflow appears under both names, so the old name's last run lingers just as
the deleted one did. Workflow id 286602591 on that repo produces runs called
both "Build PDF" and "Build vision.pdf".

Both come from treating run history as the source of truth. So:

- /actions/workflows is consulted for the authoritative set, and runs whose
  workflow is no longer active are skipped. Disabled workflows go too - a
  switched-off job is not a failing one.
- Runs are keyed by workflow_id, giving one series per real workflow, and
  labelled with the name the workflow has *now*. Where two active workflows
  share a display name, both fall back to their path so the metric labels stay
  unique - the earlier name-keyed version exported duplicate label sets and
  Prometheus silently dropped 16 samples per scrape.
- If the listing cannot be read the filter is skipped entirely, so a transient
  API error over-reports rather than blanking a repo's CI.

Costs one extra call per repo per refresh: measured 4718/5000 remaining.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tschm
tschm merged commit 7c03556 into main Aug 29, 2026
1 check passed
@tschm
tschm deleted the fix/ignore-deleted-workflows branch August 30, 2026 09:00
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.

1 participant