Skip to content

A recorded replay's chance of red follows the candidates pushed near each build - #30

Merged
jeremy merged 35 commits into
mainfrom
replay-local-chance
Nov 27, 2026
Merged

jeremy merged 35 commits into
mainfrom
replay-local-chance

Conversation

@jeremy

@jeremy jeremy commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Builds that fail for no pull request's reason come in bunches. The replay spread them evenly: every candidate and check had the day's share of such failures as its chance of red, at any hour. So on a day with a bad hour, the replay landed through the hour and failed builds at random the rest of the day.

This gives a simulated candidate the red share the records show around its own time. It follows the red-trunk replay, which is on main, and changes only the simulated half of the row. Probes are untouched.

The rule

  • The sample: every candidate in the records the window reads, the four hours before it and the hour after included, that was answered, holds no head the replay holds broken, and is not a build of a red trunk a fix ends. Read as a failure and never green, it is red; read green, it is green. A candidate that never answered is left out, and so are recorded checks and probes, as the day's share leaves them.
  • The chance: a simulated candidate or check pushed at t with a drawn build time d takes the red share among the sample's candidates pushed within d of t. With none there, it takes the day's share, as before.
  • No smoothing, no minimum count, no setting: the build's own time is the width.
  • A flake is in play, for the check on ejections, where the day's share is above zero, or once a build in that seed has taken a chance above zero from the sample.

The rule and what it should do were written down before it ran.

What the records hold

In nine days of windows hey-native-apps has 23 red candidates with no culprit among 532 answered, and hey2 has 2 among 223. For each such candidate, the red share among the others pushed within 40 minutes of it, against the same for a green one:

Window (hey-native-apps) Red, of answered Around a red one Around a green one
19 Nov 6 of 47 0.50 0.04
24 Nov 3 of 62 0.22 0.04
25 Nov 4 of 67 0.54 0.03
26 Nov 5 of 55 0.25 0.06
18, 21, 23 Nov 5 of 164 0.00 0.00 to 0.05

19 Nov is the one window the stack still has outside 20%. Nothing landed live from 06:31 to 11:59. Simulated over live, landings, median, p90, builds per landing:

Landings Median p90 Builds per landing Landed 10:17 to 11:17 (live 0) Landed 09:47 to 11:47 (live 0)
Main −1.7% +13.2% −37.3% −9.3% 8.6 14.9
This branch −1.7% +13.2% −16.9% +0.1% 0.0 9.2

The other 17 windows and both whole days of 26 Nov: all inside with and without it. Nine rows are identical. The rest, largest move of any figure, in points:

Row Largest move Which
hey-native-apps, whole 26 Nov 7.3 builds per landing +0.5% → +7.8%; landings +8.1% → +4.5%
hey2, 18 Nov 6.0 builds per landing +14.7% → +8.7%
hey-native-apps, 25 Nov 5.9 p90 −2.8% → +3.1%
hey-native-apps, 23 Nov 4.6 p90 +9.7% → +5.1%
hey-native-apps, 24 Nov 4.0 p90 +10.3% → +6.3%
five others under 3 no evidence either way

Limits

  • Shaped on four days (19, 24, 25 and 26 Nov), and 19 Nov is the day it was aimed at. The records hold no day it has not seen.
  • A small sample. Twenty-three red candidates in nine days on one queue; a share read from two or three builds is 0, a half or 1. hey2 has two, so it gains nothing there.
  • It still lands 9 pull requests from 09:47 to 11:47 on 19 Nov where live landed none, 6.0 from 06:47 to 09:47, and lets go about twenty minutes before live did. The p90 is 17% under, inside the bar and not at it.
  • Probes still never fail by chance. On 19 Nov 9 of 14 probes holding no breaker failed from 10:00 to 12:00. Giving probes the same rule was tried with this one: it takes 19 Nov's p90 to 9% over, and takes 24 Nov's from 6% over to 13% over, with 11 pull requests waiting when that window opens where live had 5. It is a separate change, not here.
  • The first run of the trial was wrong: it counted a candidate that never answered as a failure. That was corrected once, before any figure here; the tests hold the difference.
  • A red trunk no fix ends keeps its candidates in the sample, as it keeps them in the day's share.

Checked

  • All 20 rows (18 windows and both queues' whole 26 Nov) at this head equal, to the digit, the rows of the scratch trial the rule was measured with; no row has a broken invariant.
  • Both replay checks on the build of this head: both pass. Every window within, every perturbation fails as it should.
  • Each part of the rule has a test that failed first under a one-line change to the code it holds: the ends of the reach included; the build's drawn time, not its nominal one; a candidate with none near takes the day's share; a check reads the same sample; a probe's chance stays zero; left out of the sample are a candidate never answered, an errored one, a check, a probe, one holding a head held broken, and a build of a red trunk a fix ends; kept in are a candidate of a red trunk no fix ends and one answered in the four hours before; a flake in play only once a build drew above zero, whether or not it then failed; one recorded day end to end whose simulated half differs because a red candidate is near, and is unchanged with that candidate green.
  • A recorded day with no red candidate gives the simulated half it gave before, pinned by a row test.
  • The live half of the row and its fields are unchanged.

After two outside reads

Findings per read: 6 on the first commit (four Medium, one Low, one on the tests), then 2 on the second (both Low).

Taken: the window that decided when a flake is in play is gone, for a mark the seed sets when a build draws above zero from the sample; that removes its nominal lead-in, its excluded ends and a false broken invariant for a long build. Three tests: the drawn time, the end-to-end day, the new mark.

Taken from the second read, in the third commit: the mark is read whatever else the shape holds (it was skipped for a scripted shape, which no replay of records is), and a test holds the mark across a later build that draws zero. The read found no ordering in which a failure drawn from the sample reaches the check on ejections with no flake in play, and no leak of the mark between seeds. The four rows that move most were run again at the third commit and are equal; both replay checks pass on its build.

Not changed, with reasons:

  • An errored build is drawn before a red one, so where every candidate near is red, a build fails red with one minus the day's errored share. That order is the base's, and an errored build is its own recorded outcome.
  • The day's share and the sample class two candidates differently: one read failed and later green (red in the day's share, green in the sample), and an errored or unpushed one (in the day's denominator, out of the sample). Deriving the day's share from the sample gave the same counts on all 20 rows; two existing tests pin the errored candidate in the denominator, so the day's share keeps its own count.
  • The build kept for a commit is its first sighting at its longest chain. Counted on the records: no answered candidate lost a push time that way; 1,166 sampled candidates carry more than one status time, and every one kept its earliest, the push.
  • A red trunk a fix ended before the replay opens is out of the sample though nothing plays it. Those failures have a known cause that ended; a build after the fix should not fail on them. None in the records.
  • A check and a candidate on one commit could lend each other a verdict. No commit in the records was seen as two kinds.

For main, on trial

It lands before the day's rows are made, so the posted comparison is its first score. No build holding it has read that day's records, and its code was fixed before any of them was opened. The decision to land it the same day was made after main's own build had been read on the first hours of that day, which were outside 20% on one queue; if that queue's comparison comes inside, it is reported with that beside it, not as a clean count.

It is reverted before the next day's rows if, on either queue, the posted comparison has outside 20% a figure that the build of main without it has inside on the same day. It is kept once a queue with three or more red candidates with no culprit has the posted row inside on all four figures where main without it is outside, or further out by more than three points.

The nightly path was run with it, on copies of the records, before it landed.

A head is also guilty when, over the records read, no whole build that
held it at that head passed, no landing of it was confirmed, two or more
failed whole builds held it with no ejected culprit among their members,
and it then left the queue at that head: its head moved, its label came
off or it was gone. Probes count for neither side. The ejection rule
stays; the two are a union, each head judged against the ejected heads
alone. The red candidates of such a head leave the unblamed count, so
they no longer become a chance of red for every build of the day.

On hey2 on 26 Nov #2671's three red candidates were never ejected and
read as a 13% chance of red.
A tree a guilty head breaks takes one of that head's recorded failing
times, pushed to answered, from the failed whole builds that held it,
the shortest drawn where the tree holds more than one. Those times leave
the shared sample. A guilty head with no timed failure keeps drawing from
the shared sample, and probes keep theirs. Perturbations scale these
times.
A whole build read red on a base whose trunk the record reads red is no
evidence against its members. The record reads the trunk red as the
planner does: a red candidate's blame round in which the build of that
base alone was read red and never green, and nothing was read green. A
passing build of any kind that holds a head clears it, probes included,
and a build once read green has passed whatever a later record reads for
it. Builds of the trunk alone are kept in the replay's reading of the
records, which dropped them before.

The guilt fixtures are now the planner's own days, recorded pass by pass
against the simulated CI.
Where the record's queue never ejected a head that broke the build, the
replay's queue may eject it first, and the record's next head for that
pull request then arrived with no label to queue it. The replay now
labels it again at that head, with the record's queueing time. A pull
request the record ejected comes back only with its own label, as
before.
A whole build that takes a guilty head's failing time no longer draws from
the shared sample first, so every other build's shared draws are main's.
With no failing times recorded the lookup returns at once. One draw picks
each held head's time, and the shortest stands.

Two guilty heads in the same recorded build are still both given that
build's time, and a failing time is still push to answered.
No record exercises the red-trunk clause. In the planner's form it
cleared no head across the eighteen windows from 18 to 26 November, and
the red trunk on hey-native-apps from 15:18 to 16:50 on 26 November
clears nobody either: every member of its red candidates stayed queued
and landed. A rule no record exercises cannot be scored against live.
The replay's reading of the records no longer keeps builds of the trunk
alone, which only that clause read.

It comes back with a head the rule convicts whose failures all sit in a
round the planner read as a red trunk.

The test of a head's failing times now gives each of its three failed
builds a time the shared sample does not hold, so a shared draw cannot
pass for one. A head that moves without being held guilty is labelled
once, which the red-trunk day used to show.
A wait figure through the window's own simulate comes from them, eight
builds of a head with three recorded times take more than one, the
shorter of two heads' times wins with it on either number, and the
come-back label carries the record's queueing time.
The come-back label read only the heads the rule holds guilty. A head
the record ejected, labelled again at that head and ejected again by
the replay's queue, stayed out when its author pushed a new head while
the record still queued it. It now comes back with every guilty head;
where the replay had not ejected it, the label changes nothing.
A planner-made day of eight pull requests that break nothing, with
builds of different times, gives the simulated and over-live halves of
its row exactly as main gave them, so a build with no guilty head
taking one draw more from the shared sample shows.
A build read green already passes every member it holds, and a head
that passed is never guilty, so the clause decided nothing.

The guard that a record queued the head stays, and now has a test: a
head in two red builds that no loaded record queued was otherwise held
guilty, its failures taken out of the shared sample and its candidates
counted as blamed.
unejected_guilty_heads in the simulated half is how many heads the
replay holds to have broken the build and left without an ejection, so a
reader of the row can see a conviction and question it. It is a count
over the window's records, the same on every seed.
A red trunk: the records do hold a head that left while the trunk
failed, and the rule holds it guilty on those builds, so the sentence
saying no record holds one goes. A head with one failed build, even one
that failed alone. And a head it cannot tell from what it failed
beside, unless the record ejected the other.
The records a window loads reach back before it opens, so a head held
guilty on an earlier day was counted on every day after. The count now
takes only the heads the window plays as guilty.
The verdict read each member's guilt by pull request number when the
build answered, so a build pushed with a guilty head whose pull request
moved to a clean head while it ran was read green. A tree's guilt is now
that of the heads it was pushed with, as its failing time already was:
the build pushed with the breaking head fails whatever its pull request
holds by the time it answers.

This changes what the replay did with a culprit the record ejected: its
builds still running when the record moved it to its next head were read
green, and are now read red. On the 18 windows only red builds, red
candidates and their pull requests move, on four of hey-native-apps'
days; landings, waits and builds per landing do not.
A recorded replay opened at the window's start, from the last record at or
before it, with no running builds: a candidate building at the start was
built again from nothing, so the day's first arrivals waited a build longer
than they did live, and a red candidate at the start was replayed late. The
open alone moved a figure by up to 17 points: hey2's wait p90 on 25 Nov
went from 1.7% over live to 15.0% under it.

The replay now opens a constant four hours before the window, from the last
record at or before then, or from the first record where none is. Time zero
stays at the window's start and the lead-in runs before it, so a window
with no record before its start replays as before. The simulator counts its
scores again from zero, so landings with their waits, labelled spans and
queue-added minutes, builds and probes, red builds and candidates, and
ejections count only from the window's start, each by when it happened;
waiting_at_open is what waits at zero, and acts counts the acts from zero.
withdrawn and departures_after_an_unconfirmed_plan count from the window's
start as before.

The record's hold is kept only on a head held at the replay's opening
record, the one hold the replay did not see begin. A hold that begins in
the lead-in is answered by git like one that begins in the window, so the
unattributed holds are those of the heads held at the replay's opening.

A pull request ejected in error now has never, not zero, for no return, as
a return time before zero is a real one.

With a 72-hour lead-in the 13 windows that were run sit within 2.2 points
of the 4-hour rows on every figure.

The count of unejected guilty heads takes in the lead-in: a head the replay plays as
guilty before the window still shapes the queue the window opens on.
A replay that broke an invariant in the lead-in left its loop before the
window opened, so the row took that seed's lead-in landings, waits,
builds, last landing and the pull requests waiting at the break. Such a
seed now gives the row its invariant failure and nothing else; the
recorded acts the row counts are the window's, as before.

The simulated landings an hour is left 0 where every seed's last landing
is at the window's start, rather than divided by zero.
A guilty head's failing times came from the window's answered builds
alone, so a head the replay plays as guilty only in the lead-in had none,
and its lead-in builds drew from the shared sample. Its failing times are
now those of its failed whole builds answered from the replay's opening
record on, kept as the window's are, less those first read after an
unrecorded stretch.

The shared sample, the probe time and every rate stay the window's, and
a lead-in build of a head that is not guilty gives nothing to any of
them.
The red build before a replacement is shorter than the green ones; the
opening record is the later of two before the cutoff, with the opening
pull request's clocks as recorded; landings at the open are at zero and
later; three ready clocks differ from their label's; an earlier landing's
values, a lead-in probe and an empty window count nothing; a candidate
pushed before zero and red after it is a red candidate, not a whole
build; the population at the open changes at zero; a withdrawal seen at
zero is pinned as it counts today; the return after a wrong ejection
comes from a real one; the lead-in guilty head fails in its own time;
and the pair holds clear before zero or are answered by git there.
* origin/main:
  The row says what became of a long wait's first candidate (#24)
  The backlog counts a slot as the engine does (#23)
* replay-guilt:
  The row says what became of a long wait's first candidate (#24)
  The backlog counts a slot as the engine does (#23)
The row's live half gained the first-candidate fields on main. The pin
is the live half main's own build prints for the same records, so the
test still shows the replay leaves it alone.
* replay-guilt:
  The pinned live half carries the first-candidate fields
The landings at the window's start give their wait samples, beside a
later one that waits longer, and both wait percentiles of the row; the
three own ready clocks give a row whose two percentiles differ, live and
simulated; a window with no landing counts no wait, labelled span or
queue-added sample; and the return after a wrong ejection runs through
Run's opening tick with every build holding the pull request red, out
just before its return time and back at the first tick from it.
Two red probes of the bare trunk on T, with no build on T pushed between
them read green, make the trunk red from the record that made T the trunk
to the push of the first build on T read green after the first probe. The
replay plays that span as an episode from where it opens; the span's red
builds, read on T where they were first read red, count neither towards
the chance of red nor against a head's guilt. The row counts the spans it
plays.
…again

A pull request wrongly ejected at -13m is out at -5m, due back at -3m,
queued again at that tick, and queued when the window opens, with the
verdicts forced as in the in-window case beside it.
The first build on T read green after the first red probe ends the span.
Where it is a candidate holding pull requests that go first in the record
that pushes it, they are the fix: a tree is red unless it holds one, and
the span ends when the replay's own queue lands it, with no fix of the
simulator's own queued. Any other such build ends the span at its push
record, on the acts' clock, a recorded replay's trees going by their push.
A span whose fix landed before the replay opens plays no episode. The row
counts the fixed spans each seed leaves red.
…firm them

A build read green counts on the base it was pushed on as well as the
one it is read on, so a green pushed on T between two red probes clears
them however the records later rebase it. A span starts no earlier than
the push of the last green build on T before its probes. A fix lands
where the trunk's next observation confirms the landing, at the record
that planned it; a refused one leaves the span running. A fix-ended
span's builds are the red ones on T that hold none of its fixes, pushed
before the fix lands.
A span no fix ends is still found, and its builds are still no evidence of a head's guilt, but
the replay plays no episode for it and its red candidates stay in the chance of red. Trees are
judged at their start in every world again. The row counts the unplayed spans that overlap the
window.
…e row says so

An unplayed span counts only where it overlaps the scored window, and the row gives the minutes
it overlaps. The posted row adds a line under the simulator's when the replay landed through one.
* replay-warm:
  A wrong ejection's return that falls due before the window is tested again
  Four lead-in replay tests hold the waits they score
…r each build

A recorded replay gave every candidate and check the day's red share among answered candidates
with no culprit. Such failures bunch in time, so a replay spread an hour of reds over the whole
day. Now a simulated candidate or check pushed at t whose drawn time is d takes the red share of
the recorded candidates pushed within d of t, ends included, and the day's share where none was.
Probes take zero as before.

The sample is every candidate the records read that was read green or red, holds no head the
replay holds broken, and is no build of a red trunk the replay plays. A flake is in play where
the day's share is above zero or a red in the sample was pushed within an hour of the hours the
replay runs. The day's share is counted in the same walk with the same tests. The build map now
keeps builds with no chain, which the day's count walked before.
…m the sample

A recorded replay told checkEject a flake was in play where the sample held a red pushed
within an hour of the hours it runs. That window could be true where the replay opened later
than the lead-in, false at its exact ends, and false while a long build drew from a red outside
it. Each seed now records that one of its builds took a chance above zero from the candidates
pushed near it, whether or not that build then failed, and a flake is in play from then on, or
from the start where the day's share is above zero.

The tests cover the new rule, the share read over a build's drawn time rather than the nominal
one, and one recorded day whose simulated half moves because a red candidate answered after the
window is near its builds, and is the quiet day's with that candidate green.
* train/main:
  The replay plays a red trunk its fix ends (#28)
  The replay opens four hours before the window and scores only the window (#27)
  The replay holds guilty a head that broke builds and left unejected (#26)
The mark a build sets when it takes a chance above zero from the sample was
read only where the shape had no script, though the draw itself is not. No
replay of records sets a script, so no row changes.

A test holds the mark across a later build that draws zero.
@jeremy
jeremy marked this pull request as ready for review November 27, 2026 08:29
Copilot AI balanced review requested due to automatic review settings November 27, 2026 08:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

No active review issues remain for the recorded replay failure-rate changes.

No open issues 🎉

What changed in this PR

This PR makes recorded replay failures follow local clusters of unexplained red candidates, rather than applying the same daily failure rate throughout the window. It changes simulated results while leaving probes and live measurements unchanged.

Changes:

  • Collects answered candidates with no identified culprit, excluding builds attributed to repaired red trunks.
  • Uses nearby candidates’ red share within each simulated build’s drawn duration, falling back to the daily rate when none are nearby.
  • Tracks when a seed draws a nonzero local failure chance and adds tests for sampling, boundaries, fallback behavior, and end-to-end replay results.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
eval/​tick_replay.go Extracts eligible recorded candidates and their push times and outcomes.
eval/​sim.go Applies local failure probabilities and tracks flake eligibility for invariant checks.
eval/​local_chance_test.go Tests sampling rules, simulated outcomes, and unchanged no-red replay results.
eval/​live.go Passes the window’s candidate sample into recorded simulations.

Review effort: Balanced

* train/main:
  A moved head's test fixture clears its breaking flag at the move (#29)
@jeremy
jeremy merged commit 3952468 into main Nov 27, 2026
4 checks passed
@jeremy
jeremy deleted the replay-local-chance branch November 27, 2026 09:10
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