Skip to content

Flake history: learn which failure causes a rerun does not cure (Fixes #8437) - #8438

Merged
squid-shepherd[bot] merged 1 commit into
mainfrom
fix/flake-by-cause
Nov 13, 2026
Merged

squid-shepherd[bot] merged 1 commit into
mainfrom
fix/flake-by-cause

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Fixes #8437.

What

The shepherd reruns the first failure of any check the flake history learned is flaky. The list is per check, so a repeatable test failure in a flaky check was rerun on every push: PR #8169 was rerun seven times for one failing test and failed again each time.

  • flake_history: each first-attempt cause is now tallied by outcome (passed on rerun, failed again). A cause whose reruns failed again at least twice and passed under half the time is reported as the job's own (real_causes). learned() still returns the set of job names, now carrying those causes.
  • ci_digest: a learned-flaky check's first failure stays real when its log names failing tests and test_failure is such a cause for that check. Everything else is rerun once, as before.
  • Days already cached have no outcomes per cause and count toward the per-check list as before, so the new rule takes effect as new days are read. No new API calls.

Class

The class is "a learned list keyed too coarsely": the flaky list is keyed by check, while what a rerun cures is a cause within a check. Siblings checked:

Where Same gap?
ci_shepherd.py (box shepherd) uses the same learned() and ci_digest.digest, so it gets the fix
shepherd_gh.py (Actions shepherd) same; no change needed
the infra rerun rule (INFRA_RERUNS) not the same gap: infra is judged from the log, not learned
churn's CI cost per launch same kind of gap (one price for every kind of PR); fixed separately in promoter-bot PR 118

Check

  • pr_gates.py --only lint affected: 2/2 pass (18 test files reach the 4 changed files).
  • New tests: the tally by outcome, the two thresholds, old cache rows, and the digest keeping a named test failure real only when test_failure is that check's own cause.

Files

4 hand-written: tests/tools/flake_history.py, tests/tools/ci_digest.py and their two test files.

🤖 Generated with Claude Code

…#8437)

The learned-flaky list is per check, so once ground-truth was learned flaky from timeouts and pull failures, a
repeatable test failure in it earned a rerun on every push: PR #8169 was rerun seven times for one failing test.

flake_history now tallies each first-attempt cause by outcome. A cause whose reruns failed again at least twice and
passed under half the time is the job's own. ci_digest keeps a learned-flaky check's failure real when its log names
failing tests and test_failure is such a cause for that check. Cached days without outcomes count as before.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 13, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 13, 2026 21:43
@squid-shepherd
squid-shepherd Bot merged commit 470c7c2 into main Nov 13, 2026
38 checks passed
@squid-shepherd
squid-shepherd Bot deleted the fix/flake-by-cause branch November 13, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flake history: learn which failure causes a rerun does not cure, so a repeatable test failure is not rerun

1 participant