scripts/agent-preflight.sh goes RED on a busy host, on a change that cannot
possibly affect it. Found while landing a .agents/-and-docs/-only records
reconciliation (#527): zero src/, include/, tests/ or scripts/ files in
the diff, and test_cpu_x86_llamacpp_floor still failed inside preflight.
FAIL: test_a_contended_leg_is_discarded_and_never_summarised
AssertionError: 4 != 2 : ours rep=1 START load=73.49 91.67 65.95 builders=0
Mechanism
test_a_contended_leg_is_discarded_and_never_summarised
(tests/scripts/test_cpu_x86_llamacpp_floor.py:160-166) runs the real harness
with FOREIGN_MAX=-1 to force every leg contended, and asserts the harness
gives up with exit 2:
got = self.run_harness(out, FOREIGN_MAX="-1")
self.assertEqual(got.returncode, 2, got.stdout + got.stderr)
But scripts/cpu-x86-llamacpp-floor.sh gates every leg behind a quiet window
first:
QUIET_BUSY=${QUIET_BUSY:-10} # :39
if [ "$p" -le "$QUIET_BUSY" ] && [ "$b" -eq 0 ]; then return 0; fi # :122
echo "NO_QUIET_WINDOW after ${waited}s ..." # :126 -> exit 4
...
if [ "$attempt" -gt 24 ]; then echo "GIVING_UP too many discards"; exit 2; fi # :336
The test does not pin QUIET_BUSY, so the harness reads the real host
loadavg. On a busy box wait_quiet times out and the harness exits 4
(NO_QUIET_WINDOW) before the discard loop can ever reach the 24 attempts that
produce exit 2. The sibling test
test_no_quiet_window_stops_instead_of_averaging_through_it asserts exit 4 and
pins QUIET_BUSY="-1" explicitly — so the pattern for making this hermetic is
already in the file, two tests down.
Why it matters more than a flake
Preflight runs its gates concurrently, so preflight raises the load that makes
this test fail — it can fail itself. Observed today across three preflight
runs at loadavg 73, 38 and 30, while the same test passed 10/10 standalone
twice on the same tree minutes apart at lower load. A gate whose result depends
on how busy the box is teaches readers to ignore it, and this repo has already
been burned by environment-manufactured failures (a full disk producing a fake
"137 failed / 10 errors" pytest result).
Suggested fix
Pin the environment the test claims to be testing, the way its sibling already
does: pass QUIET_BUSY (and WAIT_TIMEOUT) explicitly in
test_a_contended_leg_is_discarded_and_never_summarised so the quiet-window
check cannot pre-empt the discard path being asserted. Audit the other
run_harness callers in the file for the same unpinned dependency —
test_the_published_figures_are_computed_not_transcribed and
test_g5_load_is_recorded_before_and_after_every_leg both assert exit 0 and
look exposed to the same timeout.
NOT fixed in #527's PR: changing a checker/gate's semantics needs its own spec
and a RED-before/GREEN-after demonstration, per AGENTS.md.
scripts/agent-preflight.shgoes RED on a busy host, on a change that cannotpossibly affect it. Found while landing a
.agents/-and-docs/-only recordsreconciliation (#527): zero
src/,include/,tests/orscripts/files inthe diff, and
test_cpu_x86_llamacpp_floorstill failed inside preflight.Mechanism
test_a_contended_leg_is_discarded_and_never_summarised(
tests/scripts/test_cpu_x86_llamacpp_floor.py:160-166) runs the real harnesswith
FOREIGN_MAX=-1to force every leg contended, and asserts the harnessgives up with exit 2:
But
scripts/cpu-x86-llamacpp-floor.shgates every leg behind a quiet windowfirst:
The test does not pin
QUIET_BUSY, so the harness reads the real hostloadavg. On a busy box
wait_quiettimes out and the harness exits 4(
NO_QUIET_WINDOW) before the discard loop can ever reach the 24 attempts thatproduce exit 2. The sibling test
test_no_quiet_window_stops_instead_of_averaging_through_itasserts exit 4 andpins
QUIET_BUSY="-1"explicitly — so the pattern for making this hermetic isalready in the file, two tests down.
Why it matters more than a flake
Preflight runs its gates concurrently, so preflight raises the load that makes
this test fail — it can fail itself. Observed today across three preflight
runs at loadavg 73, 38 and 30, while the same test passed 10/10 standalone
twice on the same tree minutes apart at lower load. A gate whose result depends
on how busy the box is teaches readers to ignore it, and this repo has already
been burned by environment-manufactured failures (a full disk producing a fake
"137 failed / 10 errors" pytest result).
Suggested fix
Pin the environment the test claims to be testing, the way its sibling already
does: pass
QUIET_BUSY(andWAIT_TIMEOUT) explicitly intest_a_contended_leg_is_discarded_and_never_summarisedso the quiet-windowcheck cannot pre-empt the discard path being asserted. Audit the other
run_harnesscallers in the file for the same unpinned dependency —test_the_published_figures_are_computed_not_transcribedandtest_g5_load_is_recorded_before_and_after_every_legboth assert exit 0 andlook exposed to the same timeout.
NOT fixed in #527's PR: changing a checker/gate's semantics needs its own spec
and a RED-before/GREEN-after demonstration, per AGENTS.md.