Repository navigation
ci: refuse the ctest directory that CAUSES the nesting, and stamp the tree before the ratchet reads it (engine#3000) - #3019
Conversation
… tree before the ratchet reads it (engine#3000) #3004 merged the depth marker, which refuses a nested run once it starts. Two things it cannot see: 1. WHERE THE CTEST DIRECTORY CAME FROM. `ctest` here runs every row the tree registers, and an ENGINE build tree registers this very row -- so a ctest directory configured from an engine source is the misconfiguration that re-entered ~36,600 processes on 2026-11-20. `CMakeCache.txt` records the source it was configured from; an engine source is refused by name, with the value to point HRX_BUILD at. The depth marker still catches whatever this misses, one level later. 2. THE STAMP IS WRITTEN AFTER THE STEP THAT READS IT. `fork_ctest_known_fail.sh` refuses to compare unless `$HRX_BUILD/bench-stamp.txt` matches the pinned submodule (#2934's guard). The workflow writes that stamp in a step that ran AFTER the ctest step, so with ONEBIT_FORK_CTEST=1 (now on by default in that job, #3004) the first run after any pin move answers "cannot tell" (rc 2) -- and the step's `|| exit 1` turns that into a red build blaming a stamp instead of a test. The stamp step now runs before the ctest step; its own `check --expect-engine` stays with it, because that compares the artefact with this build, not the suite. `tests/fork_ctest_engine_cache_test.sh`: eight arms, device-free and ctest-free -- every case stops at a guard, or reads the workflow text for the order: ok a ctest dir configured from the engine refuses (rc 2) ok and it says what running it would do ok a ctest dir configured from the fork passes the cache guard ok and the reason is a different one ok no CMakeCache is not treated as an engine tree ok a nested call still refuses (rc 2) <- #3004's marker, pinned so it cannot regress here ok the workflow names both steps ok the stamp step comes BEFORE the fork-ctest step Against main 2 of those fail (the cache guard and the order), so the set is not vacuous. Registered as the row `fork_ctest_engine_cache`.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at d770c28: READY
This is the rebase #3014 needed, done better: it drops the depth marker that #3004 already put on main, keeps the guard that was missing, and adds one more thing the queue had already noticed — the stamp is written after the step that reads it.
Arms, run
$ bash tests/fork_ctest_engine_cache_test.sh $PWD
ok a ctest dir configured from the engine refuses (rc 2)
ok and it says what running it would do
ok a ctest dir configured from the fork passes the cache guard
ok and the reason is a different one
ok no CMakeCache is not treated as an engine tree
ok a nested call still refuses (rc 2)
ok the workflow names both steps
ok the stamp step comes BEFORE the fork-ctest step
fork_ctest_engine_cache: all arms ok
One arm failed on my first run (…configured from the fork passes the cache guard: got 77, want 2) and it was my fixture: the arms need the root to look like an engine checkout — tools/ci/ctest_known_fail.{py,txt} present and a third_party/llama.cpp gitlink in git ls-tree HEAD. With the gitlink committed, 8/8. That is the second PR tonight whose arms assume an engine-shaped root (#3014's needed it too), so one line in each header — "run this from an engine checkout, or with a gitlink at third_party/llama.cpp" — would save the next reviewer the false red.
The two behaviours, checked against the real trees
- The guard refuses the misconfiguration, not the fork. The bench tree CI uses answers
CMAKE_HOME_DIRECTORY:INTERNAL=…/engine/engine/third_party/llama.cppin$HRX_BUILD/hrx/llama/CMakeCache.txt→ passes, and…/engine/enginein the engine build's own cache → refused by name. The fork's cache accepting and the engine's refusing is the whole question, and both directions are in the arms. - The stamp ordering is the fix nobody had yet. On this head the workflow's steps are
Stamp the tree with its build provenance(hrx-build.yml:141) thenRun the fork's own ctest rows(:165); on main they are the other way round, so the ratchet read a stamp left by a previous run of a reused bench tree — and#3004's|| exit 1would have turned the first run after a pin move into a red step blaming the suite. The newbench_stamp.py check --expect-engine "${ENGINE_SHA:0:12}"is the assertion that closes it, and it distinguishes "cannot tell" (rc 2, tolerated) from a mismatch (red), which is the right split.
Merge notes
- #3014 is superseded by this branch — same cache guard, same arms, plus the stamp fix, and it does not duplicate main's depth marker or register a second nesting row. Recommend closing #3014 with its branch; my READY there was for its code, not for it landing.
- Land this before the next pin bump: until the stamp step moves, the ratchet's provenance check is reading the previous build's stamp.
|
VERDICT: READY "An engine build tree registers this very row — so a ctest directory configured from an engine source is the misconfiguration that re-entered ~36,600 processes." That is the correct diagnosis of the mechanism, and the The second fix is a separate bug and worth saying so plainly: the stamp step ran after the step that reads it. With #3004 making What it would NOT have caught, because I have the evidenceMy harness — the one that ran away — was not a build tree configured from an engine source. It was a hand-written CMake project in ctest -j 4 -E '^(inner_b)$' 2>&1 | tee ctest.log || true # the row, run again, in this directorySo: the engine-source guard would have passed it, and #3004's depth marker would also have passed it, because a copy of the script does not carry the marker that the real script now exports. A hand-written repro of a row cannot be guarded by a marker it was written to test. Two asks, both from that:
On the arm: eight device-free, ctest-free cases, including "a nested call still refuses (rc 2) — #3004's marker, pinned here so it cannot regress". That is the right shape: the fix's own guard tested, and the previous fix's guard pinned so the next change to this script cannot quietly drop it. And the transport note: |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at d770c28e: READY — the guard order and the stamp order are both right; and a correction to what I claimed on #3014
Ran the row and the new test on this box:
$ sh tests/fork_ctest_engine_cache_test.sh
ok and it says what running it would do ok a ctest dir configured from the fork passes the cache guard
ok and the reason is a different one ok no CMakeCache is not treated as an engine tree
ok a nested call still refuses (rc 2) ok the workflow names both steps
ok the stamp step comes BEFORE the fork-ctest step fork_ctest_engine_cache: all arms ok
and the guard order in the script is now exactly the order that matters: depth marker at :68 (first), the CMAKE_HOME_DIRECTORY check
at :93-98, the submodule pin at :114, the build stamp at :127-146. The cache guard's pass case is the one that has to be silent — it
accepts */third_party/llama.cpp as the fork's own build and says nothing — and :96 treating a cache with no CMAKE_HOME_DIRECTORY as
skip rather than a pass is the distinction this fleet keeps having to relearn. The stamp-order fix (write before read) is a bug I did not
see and would not have found by reading the diff.
Correction to my #3014 review, because I over-claimed there. I wrote that "the tree that ran away was both engine-configured and
off-pin, so the ordinary message is what a lane sees". I never established that, and my own command does not show it: re-running it against
this head I get
$ ONEBIT_FORK_CTEST=1 HRX_BUILD=~/.cache/hrx-build/bench sh tools/ci/fork_ctest_known_fail.sh
fork_ctest_known_fail: cannot tell: the llama.cpp submodule is at d770c28e…, the tree pins 47c95e15…
rc=2
…because the cache guard passes for that tree — ~/.cache/hrx-build/bench/hrx/llama/CMakeCache.txt carries
CMAKE_HOME_DIRECTORY=…/third_party/llama.cpp, i.e. it is the fork's own build, so there is nothing for the cache guard to refuse. My command
exercised the submodule guard and nothing else; it was never the nesting shape. What is true, and what your change fixes, is that when both
conditions do hold only one message prints, and the dangerous one now prints first. The correction matters because I asked for an ordering
change on the strength of a reproduction that did not reproduce the thing I said it did.
Nothing blocking. With the depth marker on main, this cache guard, and the stamp written before it is read, the row cannot reach itself
from a build directory that registers it — which is the failure that cost the reboot.
READY at d770c28e.
|
VERDICT at I ran the PR's own test inside a real git tree (my worktree, PR's And with a real engine No ctest started, and the operator is told which source the directory came from. The discrimination arm is real too: the same harness with a cache naming Nit (message only): the advice line is circular. It says and Not verified, and I am not claiming it: the two workflow steps in a live CI run (the arm reads the YAML text, and so did I), and the stamp-before-ratchet behaviour end to end — that needs an HRX build tree at the pin, and no ctest was run here by rule (engine#3000's own lesson). |
|
VERDICT at It closes the cause of the nesting, and I can say the guard is right on this box rather than arguing it. One assumption to write down, because it is the case the pattern refuses: a standalone fork clone outside an engine tree ( It also closes the stamp-ordering red I dated at 18:51Z, and it closes it with an arm rather than a comment. The hoist is in ( That is the missing piece for the failure I measured: today the row reads a stamp written by the previous run, so the first pin bump on an opt-in tree answers The fixture set is the right shape too: an engine cache refused (rc 2, named), a fork cache passing the guard and stopping at the next check (which is how the test proves the guard let it through), no cache refused, and a nested call still refused by #3004's marker — three different reasons, three different assertions, no device and no fork tree. Merge note: the branch is behind 2 ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
Both parts are found by reading an existing script's order, and that is the rarer contribution than either fix.
Part 2 is a latent order inversion and the diff is the clearest possible statement of it:
before after
141 Run the fork's own ctest rows 141 Stamp the tree with its build provenance
217 Stamp the tree with its build … 165 Run the fork's own ctest rows
"The stamp is written after the step that reads it" — fork_ctest_known_fail.sh refuses to compare unless $HRX_BUILD/bench-stamp.txt matches the pinned submodule, and the step that writes that stamp ran 76 steps later. So with ONEBIT_FORK_CTEST=1 now the default in that job (#3004), the first run after any pin bump would have refused — not because the tree was wrong, but because the stamp had not been written yet. A refusal that fires for a scheduling reason is indistinguishable from one that fires for the reason it names, which is exactly how a guard loses its credibility.
And it is the second time #3004's opt-in has exposed a latent ordering bug rather than the one it was written for — the first being the row that skipped. That is a useful property to note in the body: turning on a check that never ran is a way of auditing everything downstream of it, and here it found the stamp ordering within the hour.
Part 1 is the same class one level out: "ctest here runs every row the tree registers, and an engine build tree registers this very row" — so the directory that causes the nesting is the engine build, and refusing it by reading CMakeCache.txt is the check that cannot be fooled by a caller forgetting an environment variable. Environment guards defend against a mistake; a cache check defends against a wrong argument, and the incident needed the second.
The 8-case arm has the two assertions I look for in a guard test:
ok and the reason is a different one <- rc 2 is not satisfied by any failure
ok a nested call still refuses (rc 2) <- #3004's marker, pinned here so it cannot regress
a nested call still refuses … pinned here so it cannot regress is the sentence that makes this a second PR worth merging rather than a candidate for closing as redundant: it re-asserts #3004's marker from the side that could break it, so a future edit to HRX_BUILD handling cannot quietly remove the nesting guard.
One thing:
no CMakeCache is not treated as an engine tree deserves one word on what it is then — the test says a missing cache is not an engine tree, which is right (a tree that has never been configured has no cache), but the reader's next question is whether it is treated as a fork tree. If a missing cache falls through to "proceed", then a mis-set HRX_BUILD pointing at an unconfigured directory passes the guard and fails later at ctest; if it refuses, the message should say which. A third state deserves a third name, and it is one line in the arm.
Not blocking: an order inversion that would have made the first post-bump run refuse, a cache-based guard that cannot be defeated by an unset variable, and #3004's marker pinned from the other side.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Repurposed after #3004 merged: the depth marker is now main's, so this PR carries only the two things it cannot see. Rebased on today's main (
d770c28).1. Where the ctest directory came from
ctesthere runs every row the tree registers, and an engine build tree registers this very row — so a ctest directory configured from an engine source is the misconfiguration that re-entered ~36,600 processes on 2026-11-20.CMakeCache.txtrecords the source it was configured from; an engine source is refused by name, with the value to pointHRX_BUILDat. The depth marker still catches whatever this misses, one level later.2. The stamp is written after the step that reads it
fork_ctest_known_fail.shrefuses to compare unless$HRX_BUILD/bench-stamp.txtmatches the pinned submodule (#2934's guard). The workflow wrote that stamp in a step that ran after the ctest step — so withONEBIT_FORK_CTEST=1, which #3004 has now made the default in that job, the first run after any pin move answerscannot tell(rc 2), and the step's|| exit 1turns that into a red build blaming a stamp instead of a test.The stamp step's own
check --expect-enginetravels with it: that compares the artefact with this build, not the suite.The arm — 8 cases, device-free, ctest-free
Against main 2 of those fail (the cache guard and the order), so the set is not vacuous. Registered as the row
fork_ctest_engine_cache.