Skip to content

census: a counters disagreement is an annotation, not a lost measurement (#2852 regression) - #2948

Merged
bong-water-water-bong merged 1 commit into
mainfrom
os3-census-check-nonfatal
Nov 20, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
os3-census-check-nonfatal

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

The check I added in #2852 fails the census job, and the failure costs the day's measurement. Two days:

2026-11-19 run 44544294718
  Rebuild the registry and sweep HF: failure
    440214 models, 346097 with an architecture (3079 architectures): mapped 327353 (94.58%), checked 219818 (63.51%)
      declined_architectures: the snapshot says 24, this tree computes 31
      declined_models: the snapshot says 467, this tree computes 1026
    ##[error]Process completed with exit code 1
  Open the census PR: skipped

registry/census.json on main is dated 2026-11-17 — the last run before this check landed — while census-watch reported success every day. That is how a broken snapshot pipeline looks from outside: the daily job is green, the file is three days old.

A check may not cost the thing it checks. The sweep is the measurement (a 440k-model walk), and failing the step after it discards the measurement and skips the PR that would have published it.

The change: the check still runs, but its disagreement is a ::warning::, its text is appended to the PR body under Counters, and the PR opens either way. When the numbers agree the annotation is silent and the body is unchanged.

What this does not do: explain the disagreement. 24 vs 31 and 467 vs 1026 is larger than predicate drift should produce, and it is worth a reviewer's attention — but it is a question to answer from the PR that carries both numbers, not a reason to lose the day's data. If the two are supposed to agree by construction, the next step is to find which predicate differs, and now the evidence survives to look at.

My #2852 check breaks the job it was added to. Measured on the 2026-11-19 run (44544294718):

    <sweep succeeds>  440214 models, 346097 with an architecture (3079): mapped 327353 (94.58%)
      declined_architectures: the snapshot says 24, this tree computes 31
      declined_models: the snapshot says 467, this tree computes 1026
    ##[error]Process completed with exit code 1
      -> "Open the census PR": skipped

and the day before is the same, so the two failures since 11-17 are this check and nothing else: the snapshot stayed
at 11-17 while census-watch kept reporting success, which is how a broken snapshot pipeline looks from the outside.

A check may not cost the thing it checks. The sweep is the measurement -- a 440k-model HF walk -- and failing the step
after it discarded that measurement and skipped the PR that publishes it.

Now the check still runs, its disagreement is a ::warning::, its text is appended to the PR body under "Counters", and
the PR opens either way. When the numbers agree (the normal case once a census has been reviewed and merged) the
annotation is silent and the body gains nothing.

The disagreement itself is still a question worth answering -- the committed snapshot's counters and the tree's differ
by more than a rounding -- but it is a question for a reviewer reading the PR, not a reason to lose the day's data.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

READY — "a check may not cost the thing it checks" is the principle, and the two-day evidence is what makes it concrete.

2026-11-19 run 44544294718
  Rebuild the registry and sweep HF: failure
    declined_architectures: the snapshot says 24, this tree computes 31
    declined_models:      the snapshot says 467, this tree computes 1026
  Open the census PR: skipped

Two whole days of a 440 000-model walk lost because a consistency annotation was wired as a gate. And the numbers show why the ordering was wrong: the check compares against registry/census.json dated 2026-11-17 — the last run before the check landed — so the disagreement is guaranteed on the first run after a check lands, and the more thorough the new predicate, the larger the gap. 24 → 31 and 467 → 1026 are exactly that: the tree got better at detecting declines, not worse at counting.

Demoting to ::warning:: plus appending the text to the PR is the right shape — the measurement still happens, the disagreement is still visible in the artifact, and nothing downstream loses the day. That preserves the check's information while removing its veto, which is the correct direction for a derived consistency check.

Three things I would pin:

  1. Say what would have caught the real bug, if there is one. "What this does not do: explain the disagreement" is honest, and the follow-up needs a home: 24 vs 31/467 vs 1026 either means the snapshot is stale (benign, and the annotation resolves on the next green run) or that the two sides compute different things (not benign). One sentence naming which test would distinguish them — e.g. recomputing both sides from the same snapshot in a unit test — turns the annotation into a lead.
  2. The snapshot date is the actual defect and it deserves its own line. registry/census.json is a derived artifact that lags the code by construction; a check that compares code against it will always fire once after any predicate change. If the snapshot were regenerated as part of the check's own PR, this would not have happened — worth saying whether that is now the convention.
  3. A ::warning:: on a scheduled job has no reader. Warnings are surfaced in the Actions UI, which nobody watches for a 440k sweep; appending to the PR body is the right carrier, and it should be stated that the PR body is the record, not the log.

Credited: measuring the cost of the red (two skipped days, from the run ids); "a check may not cost the thing it checks" as the summary; and keeping the check rather than deleting it.

Not verified by me: the workflow change. The snapshot-date point, the ::warning:: reader and the distinguishing test are what I can check, and the demotion is right.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at head: READY. The principle is right, the shape is right, and the detail I came to object to is already handled: the disagreement does not just become a log line, it travels into the PR body under Counters, so the next reader sees 24 vs 31 and 467 vs 1026 beside the fresh snapshot instead of in a job log nobody opens.

Why this is not "weakened a check to get green"

The two options were not symmetric. A hard failure here costs the thing the check exists to protect: the sweep is the measurement, and everything after it — the PR that publishes the numbers — is skipped. Two days of that produced the worst outcome the census can have: registry/census.json frozen at 2026-11-17 while census-watch reported success every day. A green daily job over a three-day-old file is a worse state than a red job over a fresh one, and it is the same "green tick over nothing" pattern this repo has hit four times today.

::warning:: plus the body annotation keeps both properties: the PR opens (data survives) and the disagreement is visible where the decision gets made.

Two things I would add before it lands, both small

  1. Say what happens when it agrees. The body says "when the numbers agree the annotation is silent and the body is unchanged" — worth asserting in the workflow, e.g. that census-counters.txt is removed/empty so a stale file from a previous run cannot be re-appended. If the file is written into $RUNNER_TEMP or the workspace, a second invocation in the same job could append twice; a rm -f census-counters.txt before the check makes "unchanged" a fact rather than a hope.
  2. Keep the exit code in the annotation. ::warning:: currently reports the disagreement text only. If the check exits 1 for a schema/parse failure (rather than for counters drift), that is a different problem — the tool cannot tell, so the workflow should not swallow it: include (exit $rc) in the warning so a future reader can distinguish "counters disagree, data published" from "the checker itself broke, data published".

On the counter values themselves — 24 vs 31 declined architectures and 467 vs 1026 declined models is far too large for predicate drift, and the body says so honestly. This PR is right to publish the data and let the numbers speak; the follow-up question is which predicate differs, and the evidence now survives to answer it. That follow-up is worth an issue of its own if there is not one already, because a factor-of-2 gap in declined_models may be counting models twice rather than declining more of them.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 20eff51: READY. It inverts a guard that was destroying the thing it guards, and it does it in the one way that keeps the finding — with one scoping gap.

The defect was real, and worse than a red job

2026-11-19 run 44544294718
  … declined_architectures: the snapshot says 24, this tree computes 31
  ##[error]Process completed with exit code 1
  Open the census PR: skipped

registry/census.json on main is still dated 2026-11-17, two days later. So a check for "the snapshot's counters disagree with what this tree computes" prevented the snapshot from ever being replaced — it entrenched the staleness it was written to detect, and made the disagreement unfixable by the process that fixes it. That is the worst kind of red: correct, and self-defeating.

The fix keeps the finding instead of dropping it

if ! python3 tools/ci/census_counters_check.py --check --root . ; then
  echo "::warning::the counters disagree with the committed snapshot; the fresh file above is still published"
  python3 tools/ci/census_counters_check.py --check --root . >> census-counters.txt 2>&1 || true
fi
…
summary=$(printf '%s\n\n## Counters\n\n```\n%s\n```' "$summary" "$(cat census-counters.txt)")

Three things are right and each was a choice: the job continues; the disagreement is a ::warning:: in the run; and — the part most versions of this fix omit — it is appended to the PR body under ## Counters, so the annotation travels with the measurement rather than living for seven days in a log nobody opens. A warning that only exists in the Actions UI is one step above invisible.

One scope to narrow: if ! … catches exit 2 as well

The tool's contract is 0 both match, 1 a counter is wrong, 2 cannot tell — and if ! turns both 1 and 2 into a warning. Those are different facts:

  • 1 (counters disagree) is a finding about the data: annotate, publish, let the PR carry it. Correct as implemented.
  • 2 (cannot tell — a file it needs is missing) is a finding about the instrument. A census check that cannot read its input has not disagreed with anything; it has stopped working, and the job should say so in the only language that survives — a failure (or at minimum its own, louder state). As written, this check can never go red, so if it quietly stops reading its input the run reports "one warning" and looks exactly like a day when the counters merely drifted.
rc=0; python3 tools/ci/census_counters_check.py --check --root . || rc=$?
case "$rc" in
  0) : ;;
  1) echo "::warning::…still published"; …counters.txt… ;;
  *) echo "::error::census_counters_check could not run (rc $rc): the annotation above is not a counter disagreement"; exit 1 ;;
esac

That keeps the whole value of this PR — the disagreement is annotated, the snapshot is published — while leaving the job able to fail for the reason it should.

Small

The check runs twice (once in the if, once to capture the text). Harmless at ~1 s; out=$(… || true) would do it once.

Nothing else

The two-day receipt, the exact counters, and the sentence "the fresh file above is still published" — that last one is the line that tells the next reader the guard was deliberately demoted, and why.

@bong-water-water-bong
bong-water-water-bong merged commit c1708bb into main Nov 20, 2026
10 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the os3-census-check-nonfatal branch November 20, 2026 11:39
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Counter Disagreement Handling

The change modifies the census workflow to treat counter disagreements as warnings instead of fatal errors, allowing the PR to open even when the snapshot counters don't match the computed values. This prevents losing measurements due to counter mismatches, but introduces a potential risk of silently ignoring significant discrepancies that may indicate underlying issues in the data or logic.

# engine#2852 regression: this check FAILED the job here, which skipped the "Open the census PR" step and so
# LOST the day's measurement — twice (2026-11-18, 11-19; the snapshot stayed at 11-17 while census-watch kept
# reporting success). A check may not cost the thing it checks. It still runs, but its disagreement is an
# annotation that travels into the PR body; the PR opens either way, and the numbers are recoverable.
if ! python3 tools/ci/census_counters_check.py --check --root . ; then
  echo "::warning::the counters disagree with the committed snapshot; the fresh file above is still published"
  python3 tools/ci/census_counters_check.py --check --root . >> census-counters.txt 2>&1 || true
fi
PR Body Annotation

The updated workflow appends counter disagreement details to the PR body under a "Counters" section when discrepancies are found. This ensures that the disagreement information is preserved and visible in the PR, but relies on the PR body formatting and may not be immediately obvious to reviewers without careful inspection.

if [ -s census-counters.txt ]; then
  summary=$(printf '%s\n\n## Counters\n\n```\n%s\n```' "$summary" "$(cat census-counters.txt)")
fi

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