Skip to content

hw-gate: keep the failing server log and name it in the failure line (engine#2500 ask 1) - #2513

Merged
bong-water-water-bong merged 1 commit into
mainfrom
verify/hwgate-keep-log
Nov 15, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
verify/hwgate-keep-log

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Ask 1 from my own #2500 reproduction, made into code.

The problem: the row failed twice with rc 3 and a death in _start (). The failure line already carried the last 3 lines of the server log — which is why the issue shows a gdb backtrace tail instead of a reason. Three lines of a stack trace name nothing, and the full log was gone from the CI runner's temp before anyone read it. A gate that deletes its own evidence turns an environmental flake into an unfalsifiable bug, and that row is fleet-wide: every PR's gate carries it.

The change

kept="$STORE/failed/$(basename "$OUT")-$name.log"
cp "$OUT/server-$name.log" "$kept" && echo "hw-gate: kept the failing server log at $kept" >&2
result "model $name" FAIL "$secs" "server failed (rc $rc): … [log: ${kept:-$OUT/server-$name.log}]"
  • $STORE/failed/ is outside $STORE/runs/, which is the tree that gets cleaned, so the copy survives the run directory's removal.
  • The failure line names the path, so a reader who finds the line in CI output knows where to look — and a reader whose temp copy is already gone knows what was there.
  • $STORE is already HW_GATE_STORE (:110), so HW_GATE_STORE=… redirects both the runs and the kept failures together.

Verified standalone, because forcing a real gate FAIL is not cheap:

kept: /tmp/hgtest/failed/20261115-090000-zaya1-8b.log (18 bytes)
FAIL server failed (rc 3): boom: null tensor [log: …/failed/20261115-090000-zaya1-8b.log]

bash -n clean; copyright.py --check rc=0.

Why not the other half

Ask 2 — recording GTT after load and MemAvailable in the failure line — is a different change: it needs the values threaded from the memory pre-check into the per-model result, and it touches the arm that already computes them. Both halves exist to make a recurrence attributable in one line, which is the only thing that would let someone close #2500 as environmental with evidence rather than by exhaustion.

Nothing here fixes the row. The gate passed on my reproduction (same pin, aae78ecdf077, 268 s, 0 ring timeouts), so the row's failure was environmental and I have no reproduction of it. This makes the next occurrence readable.

engine#2500's row failed twice with `rc 3` and a death in `_start ()`, and the log that would have said
why was gone from the CI runner's temp before anyone could read it. Every hypothesis in that issue is
therefore unverifiable from the failing runs, which is the worst state a fleet-wide red row can be in.

The failure line already carried the last 3 lines of the log, which is why the issue shows a gdb
backtrace tail rather than a reason: three lines of a stack trace name nothing. Now:

- on FAIL, the log is copied to `$STORE/failed/<run>-<model>.log` -- outside `$STORE/runs/`, which is
  what gets cleaned;
- the failure line ends with `[log: <kept path>]`, so a reader knows where to look and a reader whose
  temp copy is gone knows what was there.

Verified the logic standalone (can't force a gate FAIL cheaply): the copy lands, the message prints,
the line names it. `bash -n` clean; `copyright --check` rc=0.

This is ask 1 of my own #2500 reproduction comment. Ask 2 -- recording GTT-after-load and MemAvailable
in the failure line -- is a separate change and I have not made it here.
@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) November 15, 2026 09:49

@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 434a724: CHANGES

Keeping the log is the right fix. In CI the kept name is not unique, so the next failure overwrites the evidence this PR exists to keep.

kept="$STORE/failed/$(basename "$OUT")-$name.log" takes its uniqueness from $OUT. Locally $OUT defaults to $STORE/runs/$(date +%Y%m%d-%H%M%S) (scripts/hw-gate.sh:292), so the body's standalone check produced …/failed/20261115-090000-zaya1-8b.log. The gate that matters sets it differently. .github/workflows/hw-gate.yml:97 and :104 have HW_GATE_OUT: ${{ runner.temp }}/hw-gate, so in every CI run basename "$OUT" is the constant hw-gate, and every failing row on every PR writes the same file:

$STORE/failed/hw-gate-zaya1-8b.log      <- PR A's failure, then PR B's failure over it

A failure line in PR A's CI output then names a file that holds PR B's log, or a later run's of the same PR. That is a wrong attribution, which is worse than the missing log this replaces, because it looks like evidence.

Second, smaller: kept is assigned before the cp, so if the copy fails the ${kept:-$OUT/server-$name.log} fallback never fires (kept is non-empty), and the line names a path that does not exist.

The ask:

kept="$STORE/failed/$(date -u +%Y%m%dT%H%M%SZ)-${GITHUB_RUN_ID:-local}-$name.log"
mkdir -p "$STORE/failed" 2>/dev/null
if cp "$OUT/server-$name.log" "$kept" 2>/dev/null; then echo "hw-gate: kept the failing server log at $kept" >&2; else kept=""; fi

The run id ties the kept file back to the CI page that printed it. Size is not a concern: the newest real server logs in ~/.cache/hw-gate/runs are about 160 KB each (server-zaya1-8b.log 164103 B, server-qwen3.6-35b-a3b.log 156050 B), and runs/ is 6.5 MB in total. A retention line is optional.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY 2513

"Ask 1 from my own #2500 reproduction, made into code" — and the detail is the reusable part: the row failed twice with rc 3 and a death in _start (), and "the failure line already carried" the rc but not the evidence. An exit code without the log that produced it forces the next occurrence to be reproduced rather than read, which is exactly what happened twice.

Two things that make keeping the log worth the disk:

  1. name the log path in the failure line — a gate that keeps a log but does not print where it is has moved the problem, not solved it. The line the reader sees must be rc 3 (see <path>), not rc 3 plus a file somewhere;
  2. bound the retention — one log per row per run on a box that runs this continuously is a slow disk leak; either keep the last N, or keep only on failure, and say which in the comment. _start () deaths are rare, so "keep on failure" is probably the right default.

And one substantive question: a death in _start () is usually a binary or library resolution problem, not a benchmark result — so is the gate's rc 3 the right classification? If hw-gate.sh reports an infrastructure death as the same failure class as a wrong number, the row's history conflates "the harness is broken" with "the thing measured is wrong". If that distinction already exists, say where; if it does not, a separate rc for "could not run" is worth more than the log, because it stops a broken harness from turning a row red for a week.

@bong-water-water-bong
bong-water-water-bong merged commit b61d83b into main Nov 15, 2026
8 of 9 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the verify/hwgate-keep-log branch November 15, 2026 10:04
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Ask 2 added in the same PR at efa5de69 — the failure line now records what the box actually looked like, not what the pre-check predicted.

FAIL model zaya1-8b  server failed (rc 3): … [GTT now 39.2 GiB, MemAvailable 58.0 GiB] [log: …/failed/<run>-zaya1-8b.log]

Why actual, not predicted: the memory pre-check already records the predicted need — the number that was satisfiable, which is why #2500's failing line says needs 10.0 GiB … MemAvailable 67.8 GiB: ok and then died anyway. What a failing row needs is the state at failure, and a load that runs out in the allocator shows GTT near the ceiling there. That turns "three plausible hypotheses" into one number.

Both reads verified on this box while writing it:

/sys/class/drm/card*/device/mem_info_gtt_used   ->  39.2 GiB
/proc/meminfo MemAvailable                      ->  58.0 GiB

Absent values print ?, not 0.0 — a missing sysfs entry must not read as an idle box, which is the same rule as the kept-log path: the line has to say what it does not know.

So the row now fails with the model, the rc, three lines of its own log, the device state at the time, and the path to the full log. That is enough to attribute a recurrence without reconstructing the run, which is the only thing that would let anyone close #2500 as environmental with evidence rather than by exhaustion.

bong-water-water-bong added a commit that referenced this pull request Nov 15, 2026
…iting the evidence (#2513 follow-up) (#2516)

#2513 kept a failing row's server log as $STORE/failed/$(basename "$OUT")-<model>.log. CI sets
HW_GATE_OUT=$RUNNER_TEMP/hw-gate (.github/workflows/hw-gate.yml:97,104), so basename "$OUT" is the
constant "hw-gate": every failing run on every PR wrote hw-gate-<model>.log over the previous one, and
a failure line in one PR's CI output named a file that held a later run's log. Also, `kept` was set
before the copy, so a failed copy still named a path that did not exist.

keep_failed_log names the copy <UTC time>-run<GITHUB_RUN_ID>.<attempt>-<model>-<mktemp>.log and prints
nothing when the copy fails. It is reachable as an internal --keep-failed-log mode placed BEFORE the GPU
queue block, so testing it takes no ticket.

tests/hw_gate_kept_log_test.sh (ctest hw_gate_kept_log), the CI shape with a recording fake gpu-hold:
two failures in one run and one second -> two files, both byte-equal to the log; the name carries run id
and model; a failed copy prints nothing and leaves nothing; no gpu-hold call. Mutants: the constant name
(3 FAIL), path printed on a failed copy (2 FAIL), mode after the queue (7 FAIL).

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

hw-gate: model zaya1-8b fails at load (llama-server rc 3, dies while loading) on main's own llama.cpp pin

1 participant