Skip to content

The replay plays a red trunk its fix ends - #28

Merged
jeremy merged 31 commits into
mainfrom
replay-red-trunk
Nov 27, 2026
Merged

jeremy merged 31 commits into
mainfrom
replay-red-trunk

Conversation

@jeremy

@jeremy jeremy commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

When the trunk itself fails, the queue holds until a fix lands. The replay had no red trunk: it kept landing through the stretch, so the pull requests that waited it out live waited nothing there. On the one scored day in the records with such a stretch the replay's p90 was 29% under live.

This plays a red trunk that a fix ends. It is stacked on the lead-in replay. The live half of the row is unchanged; the simulated half gains four fields, and the rendered row one line.

The rule

  • Finding a span. The trunk at commit T is red where two probes of the bare trunk on T were read red and no build read green on T was pushed between them. The landed candidate's own build of T does not count as green. A green counts under the base it was pushed on as well as the one it is read on, since the records rewrite a build's base as the trunk moves. The span starts when T becomes the trunk, or at the push of the last green build on T before the pair where that is later.
  • How it ends. G is the first green build on T pushed after the first of the two probes.
    • A fix ends it where G is a candidate holding a pull request labelled to go first. That pull request is the fix. The span is played: a tree without the fix is red until the replay's own queue lands it. There is no clock end.
    • Nothing in the queue ends it otherwise. The span is found and not played.
  • The trunk's own red builds are no evidence of a head's guilt, in either kind. Where the span is played they are also left out of the day's chance of red, since the episode plays them; they are the red builds without the fix pushed before the fix's confirmed landing. Where it is not played they stay in the chance of red, as before this change.
  • The row gains red_trunk_spans (played), unfixed_red_trunk_spans (the mean over seeds of played spans whose fix has not landed when the window ends), and unplayed_red_trunk_spans with unplayed_red_trunk_minutes (spans no fix ends, and the minutes of the scored window they cover). When a span was not replayed, a row rendered with its simulated half says so under the simulator's line: | Red trunk no fix ended, not replayed | 1 span, 64 min of the window: the replay landed through it |.

The end was decided before any window ran: a clock cannot say "the trunk fails, the trunk plus the fix passes", and ending a fix-ended span at G's push would put the end on the replay's own push of the same candidate.

What the records hold

All the records kept, 15 to 26 Nov, both queues, hold two spans. Both are hey-native-apps':

Day Trunk red Ended by Here
26 Nov 15:18 to 16:23, 6 builds answered, all red a one-member candidate labelled to go first, landed 16:50 played
23 Nov 21:52 to 23:23, 15 builds answered, all red three fresh candidates on the same commit, all green found, not played

26 Nov, whole day, simulated over live:

Landings Median p90 Builds per landing Minutes the queue adds, p90 (live 83) Held over 30 min (live 52)
Base branch +8.0% −8.4% −28.8% +2.0% 44 36
This branch +8.1% −4.0% −6.9% +0.5% 69 53

Landings while the trunk was red, 15:17 to 16:47: live 7, base branch 16.0, this branch 3.6. hey2's whole day is identical on both.

The other 18 windows (18 to 25 Nov and 26 Nov to 11:19, both queues): 17 give the base branch's simulated half exactly. hey-native-apps' 24 Nov, whose four hours before the window hold 23 Nov's span, moves by a head no longer held guilty on the trunk's builds: landings +1.9% → +1.6%, median +11.2% → +11.2%, p90 +9.4% → +10.3%, builds per landing +3.5% → +2.8%.

Why the span no fix ends is not played

It was built and measured first. Played as a clock episode, 23 Nov's span left the replay with 11.1 pull requests waiting when 24 Nov's window opened, against 7.0 without it, because the replay lets go about half an hour after live did: live pushed three stacked candidates in one tick and landed 24 pull requests by 00:05; the replay's median was 15. That window's p90 over live went from +10.3% to +14.9%. No scored window holds a span of that kind to show the other side, so the only evidence for playing it moves a window away from live.

The cost: a day with such a stretch inside its window is replayed as landing through it and will likely miss, as 26 Nov did before this change. unplayed_red_trunk_spans says so on that day's row.

Limits

  • One played span in the records, and it is the day the rule was shaped on. The records hold no red trunk the rule has not seen.
  • The replay holds, but not as live did. On the row's 200 seeds, measured at this head, it first probes the bare trunk a median 35 minutes after the break (live 5), pushes three candidates into it (live one) and lands the fix a median 13.5 minutes after live. Live learned from a candidate already building when the trunk broke; the replay judges a tree when it starts. Failing a tree answered inside the span whenever it was pushed brought those to 16 minutes, two candidates and 9 minutes, and took 24 Nov's p90 to 26% over live, so it is not here.
  • Two red probes cannot tell a broken trunk from a job that nearly always fails. 26 Nov's was the second: the same test had failed five builds of six before that commit landed, and seven of fifteen candidates still failed after the fix.
  • One span per trunk commit; a second red stretch on the same commit is not found. None in the records.
  • The fix is keyed by pull request number, as the rest of the simulator's trees are. The one fix in the records had one head from its label to its landing.
  • Where two members of G are labelled to go first, either lands as the fix; a label set for another reason on the first green candidate after an outage is taken for one. None in the records.
  • Builds pushed before T landed that the records later stand on T are the trunk's (three in the records, all red). The records cannot tell a failure of their own from the trunk's.

Checked

  • Both replay checks pass on the build of this head: every window within, every perturbation fails as it should.
  • The 18 windows and both whole days were run at the fourth commit and compared field by field with the base branch's rows; the fifth commit's three reruns (24 Nov, and both queues' whole 26 Nov) equal the fourth's.
  • On the real records the two spans above are the only ones found, with 17 and 7 builds the trunk's.
  • Each test failed first under a one-line change to the code it holds: a pair must be two bare-trunk probes; a green between them clears; the landed candidate's own build does not; a green counts under its push base; the start at the last green; the first green ends it; a fix is a member labelled to go first on the first green candidate; a span no fix ends plays no episode, clears guilt and stays in the chance of red; a fix-ended span's builds leave both; no ownership past the fix's landing; a refused landing does not end a span; the overlap count and minutes at each edge; a tree without the fix fails until the replay lands it, one holding it passes; the row line's exact text, and nothing printed for an older row.
  • A day with no red trunk gives the simulated half it gave before, pinned by a row test.
  • The records do not exercise "a span no fix ends keeps its reds in the chance of red": 24 Nov's unblamed red candidates are 3 of 62 either way. Only the unit test holds it.
  • The live half of the row is unchanged.

After two outside reads

Findings per read: 12 (4 High), then 9 (2 High). The first read the second commit; the second read the fourth. The fifth commit, which only reports, has had no read of its own.

Taken from the first: the trunk's builds for a fix-ended span run to the fix's confirmed landing and leave out builds holding the fix; a landing counts only where the records confirm it; a green counts under the base it was pushed on; a span starts no earlier than the last green before the pair. None moved a figure. Taken from the second: the minutes and the row line for a span not replayed, the overlap test for an empty span, and three tests.

Not changed, with reasons:

  • A head the record ejected on the trunk's own failures is still held broken. None of the 11 ejections from 18 to 26 Nov cites one of the 24 builds, and none falls inside a span: the planner ejects nobody while the trunk's tip fails.
  • The trunk's builds can include reds on T from before the last green. Both spans start at the trunk's landing, so the two boundaries are the same on every recorded day.
  • A probe first read red while stacked, then on the bare trunk, keeps its first reading, so a pair can be missed. A missed span leaves the replay as it was before this change.
  • With no green on T the span runs to the last record, even if the trunk moved off T by a push outside the queue. No span in the records lacks a green.
  • A tree without the fix that starts after the fix lands still fails. It does not hold the fix, so it should.
  • A seed stopped by a broken invariant counts a later span as unfixed. A row with any broken invariant is already not judged.
  • pushTimes keeps the first planned push, as it did before this change.

For main, on trial

It lands after the two changes under it (#26 and #27), the same day. An earlier form of this section held it back for a red trunk in a later day's records, read by hand; only the posted row counts, so the posted row is the test.

  • It changes nothing on a day with no red trunk a fix ends: the row then equals the one the changes under it give, and a difference is a fault.
  • On a day the row shows a red trunk played, the day is also replayed with the build without this. It is reverted if a figure that build has inside 20% is outside with it, and kept on the first such day it is inside on all four and closer to live by more than three points, or that build is outside.
  • The one way it is known to go wrong is in the limits above: two red probes in an outage, then an unrelated pull request labelled to go first on the first green candidate, taken for the fix.
  • The nightly comparison comment is written by a script outside this repository, not by eval/daily-row.jq. It gets the line for a span not replayed when this lands; the change was run in its print mode against a row carrying the fields.

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
Base automatically changed from replay-warm to main November 27, 2026 06:40
* train/main:
  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)
@jeremy
jeremy marked this pull request as ready for review November 27, 2026 06:45
Copilot AI balanced review requested due to automatic review settings November 27, 2026 06:45
@jeremy
jeremy merged commit 8fda58b into main Nov 27, 2026
4 checks passed
@jeremy
jeremy deleted the replay-red-trunk branch November 27, 2026 06:45

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.

🟡 Changes recommended

The replay logic can skip fix-ended spans when the first green verdict falls beyond the scoring cutoff; span resolution must use later records independently and include a bounded-window regression test.

1 open issue
What changed in this PR

Extends the merge-queue replay built on #26 and #27 to model failing trunk spans that end when a recorded fix lands, while leaving live metrics unchanged.

Changes:

  • Detects red-trunk spans and excludes their failures from head-guilt evidence.
  • Replays fix-ended spans and reports played, unresolved, and unplayed spans.
  • Adds reporting and regression tests for span detection, fix behavior, and unchanged clean-day 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 Detects red-trunk spans, identifies fixes, and adjusts failure attribution.
eval/​sim.go Supports recorded fixes and counts unresolved episodes.
eval/​red_trunk_test.go Tests span detection, replay behavior, and boundary cases.
eval/​live.go Connects episodes and span metrics to replay scoring.
eval/​live_replay_test.go Updates replay helpers and clean-day regression checks.
eval/​live_metrics.go Adds four red-trunk fields to simulated results.
eval/​daily-row.jq Renders a notice for red-trunk spans not replayed.
eval/​daily_row_test.go Tests notice text and compatibility with older rows.

Review effort: Balanced

Comment thread eval/tick_replay.go Resolved
@jeremy

jeremy commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

🤖 The automatic review reported at 06:50Z, five minutes after this merged. Its one finding, a fix read more than an hour past the window's end (thread), is declined: the nightly row cannot have those records, and it reports such a red trunk as not replayed. Resolved.

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