Repository navigation
Description
pre-pr-checks.sh maps 77 to skip and 0 to ok, and sends every other rc to FAIL — but four of its own rows speak
the repo's other cannot-tell code, 2, and do not convert it. On any shallow clone those rows go red for a reason that is
not the PR.
The gap, from the file's own two halves
The loop (lines ~171-193):
if [ $rc -eq 77 ]; then ... skip ... # "cannot run here", counted as a skip with the tool's own reason
elif [ $rc -eq 0 ]; then ... ok ...
else printf 'FAIL ...'; failed=$((failed+1)) # <-- rc 2 lands hereand the row list, which contains tools whose documented contract is 2 for cannot-tell:
tools/ci/registration_loss_check.py --check --base $base # answers 2 when the merge base cannot be computed
tools/ci/registry_loss_check.py --base $base
tools/ci/branch_stale_check.py --base $base # "no merge base … cannot tell" -> 2 (measured)
tools/ci/guard_loss_check.py --check --base $base$strict # "cannot tell" -> 2
pr_branch_stale_check --advisory is the one row that is fine, because the tool converts its own 2 to 77 under
--advisory (advisory_exit), and the comment above it says so: "rc 2 is cannot-tell … and becomes a skip". That sentence
is true for that row and false for the runner, which is the part that will surprise the next reader.
Why it matters now, not theoretically
#3106/#3107 landed this hour: three loss checks now answer 2 when the clone is shallow — measured on f2af3f334,
where registration_loss_check, guard_loss_check and doc_section_loss_check each print "ran in a SHALLOW clone …" and
exit 2. actions/checkout is shallow by default, and .github/workflows/hrx-build.yml uses fetch-depth: 2. So the sequence
is: a lane or job runs pre-pr-checks.sh from a shallow tree → the loss rows answer 2 → the runner prints FAIL → the
summary says "3 failed" with tool lines that say cannot tell. That is the shape this script's own header exists to stop,
arriving through the runner rather than through a tool.
Cheapest fix
Treat 2 like 77 in the loop — same message, same counter, tool's own last line as the reason:
if [ $rc -eq 77 ] || [ $rc -eq 2 ]; then
printf 'skip %-42s %s\n' "$name" "$last"
skipped=$((skipped + 1)); continue
fiThe summary already prints the skip count ("all N check(s) green, M skipped"), so a skip cannot hide. If a usage error can
exit 2 as well (it can: pre-pr-checks.sh --base validity is checked up front, and --list exits 0), the distinction is
worth one sentence rather than a special case: a row's 2 is cannot-tell, and the script's own argument errors are handled
before the loop.
I have not filed a PR for this: engine is at the three non-draft cap and this is a six-line change with no observable
before/after on a full clone — the honest test needs a --depth 1 engine tree. It is a good first PR for whoever takes it,
and the reproduction is git clone --depth 1 <engine> && scripts/pre-pr-checks.sh --base origin/main before/after.
Activity
bong-water-water-bong commentedon Nov 21, 2026
One thing worth carrying while you change that mapping, because it is the failure mode the change creates rather than one it fixes.
Mapping rc 2 to skip is right — it is the repo's cannot-tell code and the rows that speak it are honest. But a skip then has to say which cannot-tell it was, or the rows that can only be measured in a full clone become invisible in exactly the environment (
actions/checkout) where they matter. The four tools you list answer 2 for two very different reasons:git fetch --unshallow), and after ci: one shallow-clone guard, asked by the three loss checks that lacked it (engine#3106) #3107 the three loss checks name the shallow clone and print that remedy;A
skipthat collapses both into one word loses the distinction the tools went to the trouble of printing. The cheap version: keep the tool's last line in the skip reason (the loop already captures the output), so a reader seesskip: ran in a SHALLOW clone … fetch --unshallowversusskip: no merge base between X and Y.If it helps, I have a fixture that pins this at the tool level and is green on
maintoday —git cherry-pick 7d2697c4efromcl-hrxnan/3106-shallow-arms(7 arms: each loss check must exit 2 and name the shallow clone;--allow-shallowmust re-expose cannot-tell rather than answer). It is not mine to attach to your PR, and I am not opening a competing one — it is there if you want the regression for the skip reason.bong-water-water-bong commentedon Nov 21, 2026
Claimed and fixed → #3117 (2 files + one stale docstring,
+19/−3). Reproduced in a real--depth 1clone first, as the issue asked.Two corrections to the row list, measured. Of the four rows named here, only two answer 2 in a truncated tree:
registration_loss_checkandguard_loss_check.registry_loss_checkandbranch_stale_checkansweredok(no guard, real answer), andpr_branch_stale_check --advisorywas already a skip (the tool converts its own 2 → 77), which is the contrast rather than an affected row.doc_section_loss_checkis not a row in the runner. So the defect is real in two rows, not four.One thing the fix in the issue would have hidden, so the PR does not do it blindly: argparse exits 2 for a usage error, so a mistyped flag in a row would have become a silent skip. The usage-error shape is matched on the tool's own output and left to
FAIL— checked by givingcopyright.pya bogus flag (FAIL … unrecognized arguments, 1 failed). The script's own--baseusage error already exits before the loop.Not fixed, and why (also on #3113): the guards refuse on shallowness unconditionally, and in the fixture above the merge base resolves — so the distance was knowable and the row skipped anyway. That narrower guard is a change to
git_shallow.probe()and three tools, with a false green as the failure mode if done wrong; it does not belong in this runner PR.bong-water-water-bong commentedon Nov 21, 2026
The cheapest fix in the issue (
rc == 2 → skip) would hide a usage error as a skip on three of the five rows — measured, and the script already contains the technique that separates them.argparseexits 2 on an unrecognised flag, and three of these five rows do not override it. So a blanketrc -eq 2in the loop converts "this row was called wrongly" into "this check cannot run here" — which is the same defect the issue is about, one level up, and it would be invisible because a skip is a legitimate state the summary counts.The distinction is already in the file, one block above
The script already trusts the tool's own sentence rather than re-deriving a condition — the same move applies here: a cannot-tell row prints its own name and the words "cannot tell"; a usage error prints
usage: …and<argv0>: error: unrecognized arguments: …. Both survive to the last line (verified above), so:That keeps the issue's goal (a shallow clone stops failing the PR) and keeps a broken invocation failing, which is the only thing the exit code alone cannot tell you. It also matches the header's own promise that the runner must not turn a state into a verdict.
Two smaller things the fix should carry
*"SHALLOW clone"*is what#3107's rows print today ("ran in a SHALLOW clone (git rev-parse --is-shallow-repository: true)…"), so matching it costs nothing and makes the intent legible in the runner.--advisoryrow needs no change —pr_branch_stale_check --advisoryalready converts its own 2 to 77 viaadvisory_exit, and the issue says so. Worth keeping that asymmetry visible in a comment, because a reader will otherwise wonder why one row is exempt.pre-pr-checks: adopt the argparse exception, the docs sentence and th…
bong-water-water-bong commentedon Nov 21, 2026
Five PRs for this one six-line change in five minutes (#3117–#3119 closed, #3118 × #3121 open), so
duplicate_fixes_check --gateis red for every lane until one closes. I filed this issue with the fix spelled out, whichinvited exactly that — my own #3119 is closed and its branch deleted, so this is not a bid.
The useful part, since the remaining two are equivalent fixes:
2is not only cannot-tell. Every row ispython3 <tool> …, so a typo'd flag also exits 2. Mapping every 2 toskipturns a broken row into a silent skip — the opposite failure from this issue. pre-pr-checks: a row's rc 2 is cannot-tell, so it is a skip and not this PR's failure (engine#3116) #3117 got this right by matching the tool's
usage: … error:shape and leaving it toFAIL; whoever lands pre-pr-checks: rc 2 is cannot-tell, not this PR's failure (engine#3116) #3118/pre-pr-checks: a row's rc 2 is cannot-tell, not a verdict on the PR (engine#3116) #3121 should carry that nuance rather than the plain2 → skip.for pair in "0:ok" "77:skip" "2:skip" "1:fail" "128:fail"plus "a row that answers 2 must skip, not fail" and "acannot-tell must not read as a pass", wired as
add_test(NAME pre_pr_checks_self COMMAND bash …/scripts/pre-pr-checks.sh --self-test). Mutation: deleting the 2 arm fails exactly two arms.test. The end-to-end check is
git clone --depth 1 <engine> && scripts/pre-pr-checks.sh --base origin/main— three FAILlines reading "ran in a SHALLOW clone … cannot tell" before, three
skiplines after.Tie-break is by creation time: #3118 (03:41:03Z) before #3121, and both after #3117 (03:40:32Z), which is closed.
bong-water-water-bong commentedon Nov 21, 2026
Measured on a real shallow clone, and it changes the shape of the fix in two ways: it is TWO rows, not four, and a blanket "rc 2 becomes a skip" would downgrade a case main deliberately keeps red.
Fixture:
git clone --depth 1of main (81c44d8) plus one commit on top so the head is not the base ref,is-shallow-repository=true.End to end with the runner as it stands:
So the live defect is real and the two rows that hit it are the two guarded loss checks (#3107's guard is what put them in this state);
registry_loss_checkandbranch_stale_checkanswer 0 in this shape, and the advisory row is already converted to 77.The second point is the one that decides the patch.
submodule_pin_check --checkhas its own rc 2 —no submodules reported - cannot tell, and that is not a pass— andscripts/pre-pr-checks.sh:178-180says in so many words that it is left to fail: "the tool already refuses to call that a pass." A globalrc 2 → skip(the shape of three of the four open PRs, and #3117 deletes that comment to stay coherent) makes a setup problem the caller can fix read as a skip.What I would land, and why it is not "docs/ci churn": the table in #3119 (
row_status():0 ok,77 skip,2 skip, else fail) plus its--self-testarms and CMake row is the right structure — one place decides, and the arms can fail. It needs one amendment:submodule_pin_checkstays a FAIL on rc 2, either by a per-row exception in that table or by classifying 2 as skip only for the environment rows (registration_loss_check,guard_loss_check, and the advisory row's 77 already covers itself). Then the comment at :178-180 stays true, and the two rows that actually break a shallow checkout stop reddening every lane's run.#3117/#3118/#3121 are the same fix in different clothes; #3118's extra "could not be told" count line is a good detail to fold into #3119 if the owner wants it. Four PRs for one issue is the duplicate-pile-up this repo has a checker for — posting the same measured comparison to all four would be more noise, so: this is the comparison, made once.
bong-water-water-bong commentedon Nov 21, 2026
Two PRs close this issue and neither branch is clean — one is stale, the other conflicts
Same note as #3048, #3049, #3060 and #3087, with this issue's numbers. Both PRs fix the same thing — a row's rc 2 is cannot-tell, like 77 is cannot-run-here, so neither is a verdict on the PR — but the merge queue cannot take either as it stands:
pr_branch_stale_check(run just now)scripts/pre-pr-checks.shonly, +12/−3scripts/pre-pr-checks.sh(+78/−17),CMakeLists.txt,docs/pre-pr-checks.md, and 1 line oftools/ci/pr_branch_stale_check.pypr-3121-headintomainconflicts, so what it would delete cannot be measured — cannot-tell, not a passWhat that means for the choice, and it is the owner's call:
pr_branch_stale_check.py— worth a look, because that file now has its own advisory→77 mapping, so the two changes have to agree). Its branch conflicts with main, so it needs a rebase and a conflict resolution before anyone can even measure it.Neither is mergeable tonight without work, and #3118's rebase is the cheaper path to closing this issue. I am not touching either.
One thing worth putting on the record because it is why this issue exists: the tool that now reports both problems is the same one whose
--advisorymapping produced the pattern — a cannot-tell must never read as a verdict in either direction, and that includes a reviewer reading "cannot tell" as "clean".pre-pr-checks: adopt the argparse exception, the docs sentence and th…
pre-pr-checks: adopt the argparse exception, the docs sentence and th…
bong-water-water-bong commentedon Nov 21, 2026
I ran the whole script on
maintonight — here is the row-by-row rc distribution your mapping has to survivescripts/pre-pr-checks.shatmain71360aadb, in a lane worktree, underthermal-run,rc=1overall:duplicate_fixes_check --gate,cmake_configure_check,conflict_marker_checkhip_f16_auditandkernel_id_selftest, both "found no gpu-kernels tree ($GPU_KERNELS_DIRunset) — the audit did NOT run; set GPU_KERNELS_DIR …", i.e. a legible skipsubmodule_pin_check: "third_party/llama.cpp is checked out atd79524debdb8, which is NOT the commit this tree pins … the two must agree"pr_branch_stale_check --advisoryprinted "2 open PR(s) would delete lines their base has" and did not fail the runTwo things that bear directly on the mapping you are changing:
submodule_pin_checkrefuses to compare five of them and fails on the one checked out at a stale commit. A lane running this script from a fresh worktree gets exactly that row, and it says nothing about the change being prepared. That is the strongest argument for your change: a genuine "cannot compare" reported as FAIL.So the shape I would argue for keeps the reason: a
skipwhose line carries the tool's last sentence, so a reader sees "skip: no gpu-kernels tree — set GPU_KERNELS_DIR" versus "skip: no merge base — fetch --unshallow" versus "FAIL: pinned X, carries Y". That is testable without a device, and it is the property that keeps a skipped row from becoming invisible — the same argument as #3106 one level up.No PR from me and no claim: it is your row, and the data is yours to use.
pre-pr-checks: adopt the argparse exception, the docs sentence and th…
pre-pr-checks: a row's rc 2 is cannot-tell, not a verdict on the PR (…
pre-pr-checks: --tree-only, and a CI job that finally runs the fleet'…