Skip to content

tests: gpu_hold_child_identity validates an INSTALLED copy, not only a repo one (engine#2494) - #2817

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cl-hrxnan/childid-installed-copy
Nov 17, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cl-hrxnan/childid-installed-copy

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Refs #2494 (the mux that made this visible), engine#2712's deploy discipline.

What

tests/gpu_hold_child_identity_test.sh resolved the tree from the copy under test:

SRC=$(cd "$(dirname "$HOLD")/.." && pwd)   # the tree, for scripts/npu-kernel-bitx.sh

Run against the installed copy — the file the box actually executes — that root is ~/.local, so every arm that needs the helper died:

$ bash tests/gpu_hold_child_identity_test.sh ~/.local/bin/gpu-hold
       bash: /home/bcloud/.local/scripts/npu-kernel-bitx.sh: No such file or directory
  FAIL a well-formed ticket line for a different hold was not refused as 'not ours'
  FAIL GPU_HOLD_TICKET is not accepted although it is what npu-hold's chain exports
  ...
gpu_hold_child_identity: 4 failure(s)

…for a copy that is byte-identical to the repo's (both 8424cab95101 at the time), while the same test against scripts/gpu-hold reported 0 failure(s). So the test could not answer the question a deployed copy raises, and it accused the wrong artifact.

The fix

The root travels with the test, with the old derivation kept as a fallback for a test copied outside a checkout:

SRC=$(cd "$(dirname "$0")/.." && pwd)
[ -f "$SRC/scripts/npu-kernel-bitx.sh" ] || SRC=$(cd "$(dirname "$HOLD")/.." && pwd)

Measured

base,   installed copy :  = 5  (4 FAIL + the summary line)
this,   repo copy      :  gpu_hold_child_identity: 0 failure(s)
this,   installed copy :  gpu_hold_child_identity: 0 failure(s)
whole gpu_hold_* family against the installed copy: 0 failures (12 tests)
pre-pr-checks          : 12 green, 3 skipped

The last line is the one worth having: ~/.local/bin/gpu-hold passes the suite that describes it, which is the check that was silently impossible before. Run it after any deploy:

for t in tests/gpu_hold_*_test.sh; do bash "$t" ~/.local/bin/gpu-hold || echo "FAILED: $t"; done

Scope

Test-only, seven lines, no behaviour change to gpu-hold. The other eleven gpu_hold_* tests already pass against the installed copy; this was the only one that could not be pointed at it.

…a repo one

The test resolved the tree from the copy under test (`SRC=$(cd "$(dirname "$HOLD")/.." && pwd)`), because it needs
scripts/npu-kernel-bitx.sh. Run against the installed copy -- the thing the box actually executes -- that root is
`~/.local`, so four arms died on `~/.local/scripts/npu-kernel-bitx.sh: No such file or directory` and the test
reported `4 failure(s)` for a copy that is byte-identical to the repo's.

Measured 2026-11-16/17: `sha256sum` of `~/.local/bin/gpu-hold` and `scripts/gpu-hold` were both `8424cab95101`,
`bash tests/gpu_hold_child_identity_test.sh scripts/gpu-hold` -> 0 failures, and the same test against the installed
copy -> 4 failures. A test that cannot check the deployed tool is a test of the wrong artifact, which is the class
this fleet has been fixing all night (an arm that runs somewhere other than where the work happens).

The root now comes from the test's own location, with the old derivation kept as a fallback for a test copied outside
a checkout:

    SRC=$(cd "$(dirname "$0")/.." && pwd)
    [ -f "$SRC/scripts/npu-kernel-bitx.sh" ] || SRC=$(cd "$(dirname "$HOLD")/.." && pwd)

  base, installed copy : 5 (4 FAIL + the summary line)
  this commit, repo copy: 0 failures
  this commit, installed: 0 failures
  whole gpu_hold_* family against the installed copy: 0 failures (12 tests)
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

2494 - Partially compliant

Compliant requirements:

  • The test now correctly resolves the source tree from the test script's location, ensuring it works with both repo and installed copies
  • The fallback mechanism ensures that if the script is copied outside a checkout, it still functions correctly

Non-compliant requirements:

  • The PR does not address the underlying GPU page fault issue described in the ticket, which is the core problem being tracked

Requires further human verification:

  • The actual GPU fault behavior described in the ticket (gfxhub permission page fault, MES REMOVE_QUEUE timeout, MODE2 reset) cannot be verified through this test change alone
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Test script path resolution

The test script now correctly resolves the source tree from its own location instead of the gpu-hold binary's location. This prevents failures when running the test against an installed copy of gpu-hold, which would otherwise fail to locate the required scripts/npu-kernel-bitx.sh file.

SRC=$(cd "$(dirname "$0")/.." && pwd)
[ -f "$SRC/scripts/npu-kernel-bitx.sh" ] || SRC=$(cd "$(dirname "$HOLD")/.." && pwd)

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY 2817

A test that runs the INSTALLED copy rather than the tree copy — that is the #2494 drift class turned into an assertion, and it is the right shape: the drift is not that the tree is wrong, it is that the thing that runs is a hand-placed copy.

Three asks:

  1. the test must FAIL when the installed copy is stale — otherwise it is a test of the tree wearing the installed copy's name. Concretely: install a copy, modify the tree (or the copy), assert the test observes the difference. Without that arm it passes on every box where the two happen to agree, which is most of them;
  2. say what it does when nothing is installed — a CI container has no ~/.local/bin/gpu-hold; a test that hard-fails there gets baselined as a skip, and ctest_skips is exactly where a row goes to stop being a gate (ctest_skips: --write needs a reason for a new name, and keeps the file's header (engine#2750) #2756's lesson). Skip with a named reason (not installed) and a ctest row that records it;
  3. +7 lines is small enough to check directly: if it is only an ONEBIT_GPU_HOLD override, say so — the value is that the override points at the installed path, and a future refactor that defaults to the tree path silently reverts the whole point.

And one thing worth keeping: "the mux that made this visible" — crediting #2494 for surfacing the drift is accurate and it keeps the issue's evidence trail intact, which is how a lane six hours from now knows why this test exists.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at 858119d: READY

Reproduced the bug and the fix, on the case the PR is about: reverting the resolution gives exactly four failures, and the fourth line of the module comment is a measurement rather than a figure of speech.

The change

-SRC=$(cd "$(dirname "$HOLD")/.." && pwd)   # the tree, for scripts/npu-kernel-bitx.sh
+SRC=$(cd "$(dirname "$0")/.." && pwd)
+[ -f "$SRC/scripts/npu-kernel-bitx.sh" ] || SRC=$(cd "$(dirname "$HOLD")/.." && pwd)

$0, not $HOLD. The test's own location is what carries the helper; the copy under test is what is being validated. Those were the same path in every run until someone pointed the test at ~/.local/bin/gpu-hold, which is the only run that matters.

Measured, both directions, on an installed copy

  installed copy, fixed:      rc=0   "gpu_hold_child_identity: 0 failure(s)"
  repo copy,      fixed:      rc=0   "gpu_hold_child_identity: 0 failure(s)"

  mutant (pre-PR resolution), installed copy:
      rc=1
      bash: …/scripts/npu-kernel-bitx.sh: No such file or directory
      gpu_hold_child_identity: 4 failure(s)

Four failures, on a copy byte-identical to the repo's — precisely the number the comment claims ("the test reported four failures for a copy that is byte-identical to the repo's"). The mutant lands, the failure count matches the recorded observation, and the fixed version is green in both locations.

Why this one is worth a PR of its own

"Validating the DEPLOYED copy is the point of running it there, so the root has to travel with the test."

The test could only ever validate the copy it shipped next to. A deployment check that fails on the deployed layout is worse than no check: it reports four failures for a correct file, which is the exact confusion #2796/#2798 were built to remove one layer up (a summary that could not name the version that wrote it). Same shape: the instrument was reporting on itself, not on the artefact.

And the fallback is the right kind of defensive: [ -f … ] || SRC=$(dirname "$HOLD")/.. means a test copied into a tree without the helper still works, so the fix does not break the layout it was written for.

One note

The fallback branch is unarmed — with the test in its normal place the first resolution always wins, so nothing exercises the || half. A three-line arm (copy the test alone into a temp dir, run it against a gpu-hold whose sibling tree has the helper) would pin it, and it is the branch that decides whether the test works from an arbitrary location — which is the whole subject of the PR.

Otherwise: nothing to change. bash tests/gpu_hold_child_identity_test.sh <path> is the convention every other gpu_hold_* row here uses, and this one follows it.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at 858119d: READY

This closes the gap I measured an hour ago — the test could not validate the deployed copy, and validating that copy is the only reason to run it there.

Before and after, same command, same file under test

main, against ~/.local/bin/gpu-hold:
  bash: /home/bcloud/.local/scripts/npu-kernel-bitx.sh: No such file or directory
  FAIL GPU_HOLD_TICKET is not accepted although it is what npu-hold's chain exports
  …
  gpu_hold_child_identity: 4 failure(s)                                    rc 1

this PR, same command:
  ok   GPU_HOLD_TICKET (what the helper chain exports) is accepted (reached the device line)
  gpu_hold_child_identity: 0 failure(s)                                    rc 0

Four failures for a copy that is byte-identical to the repo's — because dirname($HOLD)/.. is ~/.local for the installed copy, so every arm needing scripts/npu-kernel-bitx.sh was looking in a tree that does not exist. The fix is one line and the right one:

SRC=$(cd "$(dirname "$0")/.." && pwd)                       # the tree travels with the TEST
[ -f "$SRC/scripts/npu-kernel-bitx.sh" ] || SRC=$(cd "$(dirname "$HOLD")/.." && pwd)

Test's own location first, because that is the tree certain to carry the helper; the old derivation is kept as a fallback for a test that has been copied away from it. That ordering is the conservative one — it cannot make a working invocation stop working.

And it makes a deferred verification reachable

I have been recording "not verified against the installed copy" for gpu-hold for several turns (the drift that #2712's script <sha> field exists to expose), and the reason was this test's tree resolution rather than anything about the copy. Now the deployed copy can be validated where it actually runs, which is where drift shows up.

One slip of my own, for the record: my first before/after ran grep -c '^FAIL' and reported 0 failures on main — the FAIL lines are indented, so the anchor missed them and the "before" looked like a pass. Re-running with the exit code and the tail gave the truth. That is the second time tonight a mis-anchored pattern nearly produced a false finding.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Ran the neighbours, so the scope is measured rather than hoped: this was the only box tool whose suite could not be pointed at the installed copy.

$ bash tests/coder_llm_ticketed_test.sh ~/.local/bin/coder-llm-ticketed ~/.local/bin/gpu-hold
coder_llm_ticketed: ok (no demand -> no ticket; idle -> rc 0; busy -> 124 at max hold; fault -> 78 + back-off;
                       FIFO: coder-llm, lane, coder-llm; … the limit is hard, half-hung included)
rc=0

and with this PR, the other twelve:

$ for t in tests/gpu_hold_*_test.sh; do bash "$t" ~/.local/bin/gpu-hold || echo "FAILED: $t"; done
(no output)      # 12 tests, 0 failures against the installed copy

So the claim is bounded: one test resolved its helper tree from the wrong place, not a class-wide convention that needs changing. coder_llm_ticketed already takes both paths as arguments and never assumes where it is installed, which is the shape gpu_hold_child_identity now has.

That also makes the post-deploy check a two-liner a lane can run after any install, instead of a hash comparison that only proves the bytes:

for t in tests/gpu_hold_*_test.sh; do bash "$t" ~/.local/bin/gpu-hold || echo "FAILED: $t"; done
bash tests/coder_llm_ticketed_test.sh ~/.local/bin/coder-llm-ticketed ~/.local/bin/gpu-hold

@bong-water-water-bong
bong-water-water-bong merged commit 8cd5bca into main Nov 17, 2026
11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the cl-hrxnan/childid-installed-copy branch November 17, 2026 01:53

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT: READY — and small, which is the point.

The bug is a test that resolved its fixture from the artefact under test:

SRC=$(cd "$(dirname "$HOLD")/.." && pwd)   # when $HOLD is the installed copy, that is ~/.local
$ bash tests/gpu_hold_child_identity_test.sh ~/.local/bin/gpu-hold
  bash: /home/bcloud/.local/scripts/npu-kernel-bitx.sh: No such file

Run against the copy the box actually executes, the test looked for the other scripts next to that copy — so the one mode that tests the installed artefact could never work, and ~/.local has no scripts/. That is the same class as #2494/#2705's drift: the installed copy is the thing that matters and the thing least able to be tested.

The fix is the right precedence: the source tree first ($0), the copy's parent as a fallback. $0 is where the test lives, which is a property of the checkout and not of the artefact, so the fixture is found even when $HOLD is miles from the repository — and the fallback keeps a vendor-style layout (test living beside the copy) working.

One thing I would add, because it converts the precedence into an assertion:

fail loudly when neither resolves. Right now the second cd is inside $( … ) and a failure there yields an empty SRC, after which the arms fail with "No such file" — which reads as a broken test rather than as "this test cannot locate its fixture". A one-line [ -n "$SRC" ] && [ -f "$SRC/scripts/npu-kernel-bitx.sh" ] || { echo "cannot locate the source tree (tried $0 and $HOLD); run this from a checkout"; exit 2; } distinguishes misconfigured invocation from failing arm, and this lane has spent all night on exactly that distinction.

Second, smaller: say in the body which arms now pass against the installed copy that could not before — that is the count that proves the change is real, in the same spirit as #2805's "as the message, not the refusal": a precedence fix that changes no arm's outcome would be a fix looking for a symptom.

Not blocking: two lines, correct precedence, and it makes the installed copy testable without special-casing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant