Skip to content

fix(pins): the wave body fails loud when the shared pin-contract definition is missing - #667

Merged
github-actions[bot] merged 2 commits into
mainfrom
fix/wave-body-shared-source-guard
Oct 24, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
fix/wave-body-shared-source-guard

Conversation

@aitrawog

@aitrawog aitrawog commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Three findings, one story: a check must not report what it has not verified, and it must
not leave behind what it created.
The wave body published a coverage decision it never
made; this PR's own body published a sweep it had never run; and the guard that closes the
first defect leaked its own scratch every time it failed. All three are fixed here, and all
three are measured.

One — the wave body failed OPEN (the observation the validator raised on #664).

set -euo pipefail sat after scripts/sync-pin-evidence.sh sourced
scripts/pin-contract-inputs.sh, and — unlike the commit gate — the body carried no
existence guard, so a missing shared file would not fail loud. Measured on the merged
tree of #664 (squash c717835), in a scratch copy with the shared file absent:

$ bash sync-pin-evidence.sh "$PWD" "$PWD/pin-check.log" < /dev/null

stderr:

sync-pin-evidence.sh: line 54: /tmp/obs1-measure/pin-contract-inputs.sh: No such file or directory
sync-pin-evidence.sh: line 419: pin_contract_touches_input: command not found

stdout — the coverage decision the body published, as a FACT:

**The pin check is NOT offered as this diff's coverage:** **this diff changes NONE
of the pin contract's commit-carried inputs** (no gitlink, the manifest
`charly.yml`, the declared path set `.gitmodules`), so that gate cannot fail on
this diff. For transparency the pin-check gate still ran and passed:

exit status: 0. The source failed silently (no set -e was in force yet), the
undefined function answered "no" inside an if condition (a non-zero status there is a
false test, not an error), and the body published a decision it never made. A body whose
whole job is to state what covers a diff must not claim what it cannot decide.

The fix. The body takes the commit gate's own shape — hooks/pre-commit-gate.sh:77
already guards the same shared file — and nothing else: set -euo pipefail first, then
an explicit existence guard that names the missing file, before the source. The two
readers of the one shared definition are now guarded the same way.

The coverage. A new self-test arm runs a COPY of the body in a directory with no
shared file, in body mode with empty stdin — never --self-test, because the copy's
own self-test would re-enter the arm, and a self-referential arm is a hang, not a test.
The discriminator is the fail-open signature, not an exit code: the arm asserts that
command not found and the NOT offered as this diff claim are both absent, and that
the loud failure says the body cannot decide. The positive control re-runs the same copy
with the shared file and requires it to reach a coverage decision, so the arm cannot
pass by failing everything.

Two — this PR's own body published a sweep it had never run.

The validator's run on this PR came back INCONCLUSIVE — an engine class, filed as
opencharly/plugin-review#47 (below). Its reasoning carried one real finding, and it
was against this body: the pasted git grep sweep was taken on another tree. The body
pasted scripts/sync-pin-evidence.sh:290: with that line's text, and on the head being
pushed line 290 read guard_rc=0; and the body claimed the phrase survived "in exactly
one place"
when the tree carries it on three lines. The finding is mine, it is fixed, and
it is not filed away.

The RCA. Mechanism: the sweep in the body was written by hand from an earlier draft
of the arm, not pasted from a run against the head being pushed, so it described a tree
that no longer existed. Missed control: the umbrella's own body gate
(scripts/check-pr-body-diff.mjs) judges the body's form and the diff's arithmetic —
the file table (T), the pasted head (H), the counts (N) — and never whether a pasted
output line is the tree's own text. A stale paste is well-formed, so H, T and N all
accept it; the body's evidence was never checked against the tree it claims to describe.
Blast radius: the body is the changelog (R7) — the artifact the reader trusts, and the
one the validator reads. A body could state a fact about the tree that no run of any
command had established, and both gates would pass it. Root fix: a new arm (E) in
that gate — every fenced output line of the shape path:NN:text must resolve in the tree
being pushed: the file must exist there, the line must exist in it, and the pasted text
must be the text of that line. It is scoped to fenced blocks and never to prose (a prose
quote may name a line that has since moved, and that is a judgement, not a mechanical
fact), and a block that names another tree explicitly (git show <blob>, git -C <dir>)
is the documented escape.

Three — the guard this PR adds leaked its own scratch every time it failed.

The missing-shared-file guard's scratch was removed at the END of the arm, and fail
EXITS — so every failing run left the scratch behind. That is not cosmetic: one of the
ways that arm fails is a full filesystem, so a leaked scratch amplifies the very
condition it reports
. Measured on 2026-10-24: the host's /tmp (a tmpfs with
nr_inodes=1048576) ran out of inodes while the arm was running; the arm's positive
control failed with cp: cannot create regular file ...: No space left on device; the arm
reported it, and the arm's own scratch was left behind.

The fix. One scratch helper now creates and registers every temporary path this
script makes — the guard's scratch, the fixture repository, the rows file — and ONE trap
removes every registered path on every exit path, so registering a second scratch can
never unregister the first. A new self-test arm registers a scratch in a subshell that
exits non-zero and asserts the scratch is gone afterwards: remove the helper's trap and
that arm goes RED, because the guard would then leak its scratch on every failure too.

The same class, in the same PR, in the same direction: the wave body reported a decision
it had not made, this body reported an observation it had not made, and the fix for the
first left a scratch behind every time it failed. One is fixed in the shipped builder, one
in the gate that guards the builder's evidence, and one in the builder's own temporary
state.

The third file closes the same gap in the umbrella's own description of that gate:
charly.yml enumerates the arms the reconciliation gate's self-test proves, and the
enumeration would otherwise leave the new arm — and the count arm that predates it —
unmentioned, so the step's own text would under-describe the product it runs.

file what it carries
scripts/sync-pin-evidence.sh the wave body's own loud guard on the shared definition it sources, the self-test arm that proves the fail-open cannot come back, and the one scratch helper that removes every temporary path the script makes on every exit path
scripts/check-pr-body-diff.mjs the body gate's new E arm — a pasted evidence line must resolve in the tree being pushed — with the two self-test arms that prove it can fail
charly.yml the umbrella's own step description for the reconciliation gate's self-test: it enumerates the arms that gate proves, and it would otherwise under-describe the arm this PR adds

Closes #665.

How tested

The head this body describes — the committed tree the evidence below was taken on:

$ git rev-parse HEAD
cdc4582e600a4cd4bc23ddc2563feb90a656563f

The change-class gate, on the committed tree this body describes — the umbrella's own
verify task, which is what owns this change class (the diff touches the manifest
charly.yml, a commit-carried input of the pin contract, and moves no gitlink):

$ ./charly/bin/charly task verify
task verify: 33 step(s), 0 failed
VERIFY_EXIT=0

33 steps, 0 failed, 0 warnings — no step reported a warning, and the two steps that
cover the changed scripts both ran and passed:

  [pass] check — the body/diff reconciliation gate discriminates — a file table that omits a changed file, one that lists an unchanged file, a pasted `git rev-parse HEAD` that is not the head, a stale count of the diff's new files, and a pasted evidence line that does not resolve in the tree being pushed, each turn it RED (fixtures)
      exit=0
  [pass] check — the umbrella's own committed builders pass their self-tests — the set the commit gate runs, owned by scripts/self-test.sh
      exit=0

The first is the body gate's own discriminating fixtures (charly.yml:534); the second is
the umbrella's committed builders' self-tests (charly.yml:537), which run the builder
this PR changes.

The changed paths, live, on their own.

The builder:

$ bash scripts/sync-pin-evidence.sh --self-test
sync-pin-evidence: self-test OK (compact <path> <staged> <remote> <flag> rows both ways; coverage both directions; bounded_rows emits all under budget and >=1 + elision notice over budget; staged-gitlink reads the index + falls back to HEAD; evidence_legend states BOTH readings of a non-distro-* ! and the check that tells them apart)
SELFTEST_EXIT=0

The body gate:

$ node scripts/check-pr-body-diff.mjs --self-test
  PASS  mutation 'the table omits a file the diff changes' is caught (gate red)
  PASS  mutation 'the table lists a file the diff does not change' is caught (gate red)
  PASS  mutation 'the pasted head is not the head being pushed' is caught (gate red)
  PASS  mutation 'the prose states a stale count of the diff's new files' is caught (gate red)
  PASS  mutation 'the body pastes an evidence line the tree does not have' is caught (gate red)
  PASS  mutation 'the body pastes an evidence line whose text is not the tree's' is caught (gate red)
  PASS  mutation 'the body pastes text against a blank line of the tree' is caught (gate red)
  PASS  the unmutated fixture body is GREEN
check-pr-body-diff --self-test: OK (8 arms live)
GATE_SELFTEST_EXIT=0

The R7 discriminators — three, one per finding. Each is the SAME tree mutated, run in a
scratch copy, so the mutation is the only difference between the two runs.

One — the fail-open is RED without the fix. Mutated back to the OLD shape: the existence
guard removed, and set -euo pipefail moved back to after the source. The scratch copy
also carries the shared definition, so the mutation — not a missing neighbour — is what the
run measures:

$ bash sync-pin-evidence.sh --self-test
FAIL: sync-pin-evidence self-test: a copy with NO shared definition must fail loud, not exit 0 (out: **Default-branch HEAD, per moved pin.** Every moved path, complete (no
elision): the STAGED GITLINK this PR records (`git rev-parse --verify --quiet
:\<path>` from the index, `git ls-tree HEAD` fallba)
MUTANT_A_EXIT=1

The mutated copy exits 0 and publishes the NOT offered as this diff claim — exactly what
the new arm refuses to let a body do.

Two — the leak is RED without the fix. One line removed: the helper's trap, the ONE line
that makes every registered scratch disappear on every exit path.

$ bash sync-pin-evidence.sh --self-test
FAIL: sync-pin-evidence self-test: a registered scratch must be removed even when the shell exits non-zero (leaked: /tmp/tmp.E9ceo1SXAz)
MUTANT_B_EXIT=1

Three — the body gate is RED on the very stale paste the validator found. The proof is
the last block of this section, because it is the arm this PR adds.

The R5 claim-keyed sweep — the shared definition's readers, named by their own token,
against the whole tree, so every surviving hit is classified rather than assumed away:

$ git grep -n -F "pin-contract-inputs" -- . ; echo "grep exit=$?"
CHANGELOG/2026.297.0654.md:33:`scripts/pin-contract-inputs.sh`, and the two places that ask the question ask it of that
CHANGELOG/2026.297.0654.md:70:| `scripts/pin-contract-inputs.sh` | the ONE definition of the pin contract's commit-carried inputs |
CHANGELOG/2026.297.0654.md:107:scripts/pin-contract-inputs.sh
CHANGELOG/2026.297.0654.md:168:$ . ./scripts/pin-contract-inputs.sh
CHANGELOG/2026.297.0654.md:189:  FAIL  scripts/pin-contract-inputs.sh exists — the one definition of the pin contract's commit-carried inputs
CHANGELOG/2026.297.0654.md:190:  FAIL  firing hooks/pre-commit-gate.sh (ENOENT: no such file or directory, lstat '/tmp/r1-repro/oldroot2/scripts/pin-contract-inputs.sh')
CHANGELOG/2026.297.0654.md:310:scripts/pin-contract-inputs.sh:23:# was derived by judgement ("a diff that moves a gitlink") instead of from what the
CHANGELOG/2026.297.0654.md:339:- **R2** — the rule has ONE owner: `scripts/pin-contract-inputs.sh`. The commit gate and
hooks/pre-commit-gate.sh:38:#      That set is DEFINED ONCE — scripts/pin-contract-inputs.sh — and this file
hooks/pre-commit-gate.sh:74:# body's coverage decision (scripts/pin-contract-inputs.sh). It is sourced, not
hooks/pre-commit-gate.sh:77:if [ ! -f "$ROOT/scripts/pin-contract-inputs.sh" ]; then
hooks/pre-commit-gate.sh:78:  echo "pre-commit: no scripts/pin-contract-inputs.sh in THIS tree, and the pin check's" >&2
hooks/pre-commit-gate.sh:84:. "$ROOT/scripts/pin-contract-inputs.sh"
hooks/pre-commit-gate.sh:119:# that decides is shared (scripts/pin-contract-inputs.sh), so this file only has to
scripts/check-pre-commit-gate.mjs:47:const inputsRel = "scripts/pin-contract-inputs.sh";
scripts/check-pre-commit-gate.mjs:144:  //    place: scripts/pin-contract-inputs.sh. The gate SOURCES it, and the wave
scripts/check-pre-commit-gate.mjs:227:    cpSync(inputsFile, join(repo, "scripts", "pin-contract-inputs.sh"));
scripts/check-pre-commit-gate.mjs:455:      (s) => s.replace('. "$ROOT/scripts/pin-contract-inputs.sh"', '. "$ROOT/scripts/no-such-file.sh"'),
scripts/pin-contract-inputs.sh:2:# pin-contract-inputs.sh — the pin contract's COMMIT-CARRIED INPUTS: ONE definition.
scripts/sync-pin-evidence.sh:23:# rule (scripts/pin-contract-inputs.sh), the same one the commit gate's change class
scripts/sync-pin-evidence.sh:92:if [ ! -f "$SCRIPT_DIR/pin-contract-inputs.sh" ]; then
scripts/sync-pin-evidence.sh:93:  echo "sync-pin-evidence: no scripts/pin-contract-inputs.sh in THIS tree, and the pin" >&2
scripts/sync-pin-evidence.sh:99:# shellcheck source=scripts/pin-contract-inputs.sh
scripts/sync-pin-evidence.sh:100:. "$SCRIPT_DIR/pin-contract-inputs.sh"
scripts/sync-pin-evidence.sh:143:# from the shared definition (scripts/pin-contract-inputs.sh): the check reads the
scripts/sync-pin-evidence.sh:282:  # The COVERAGE DECISION itself — the shared rule (scripts/pin-contract-inputs.sh).
scripts/sync-pin-evidence.sh:297:  # scripts/pin-contract-inputs.sh, so a body that cannot read that file cannot
scripts/sync-pin-evidence.sh:338:  cp "$SCRIPT_DIR/pin-contract-inputs.sh" "$guard_dir/pin-contract-inputs.sh"
scripts/sync-pin-evidence.sh:531:# The DECISION — the shared rule (scripts/pin-contract-inputs.sh), the same one the

Every hit is classified: the CHANGELOG/ hits are history (this repo keeps history only in
CHANGELOG/), the scripts/check-pre-commit-gate.mjs hits are the FIXTURE that copies the
definition into its scratch repo and mutates the source path to prove the gate fires, and
the two shell hits are the two readers — hooks/pre-commit-gate.sh (which already
guarded the file) and scripts/sync-pin-evidence.sh (which now guards it). There is no
third reader.

The fail-open's own code is gone from the tree. The phrase survives only where it must:
inside the arm that asserts the fail-open cannot come back, and in two CHANGELOG/ history
entries — this repo keeps history in CHANGELOG/ and nowhere else. Measured over the
whole tree on the head being pushed:

$ git grep -n -F "command not found" -- . ; echo "grep exit=$?"
CHANGELOG/2026.279.1906.md:540:# `bash: line 1: node: command not found` (every failing step is a node gate script); a second
CHANGELOG/2026.297.0042.md:317:  hook dies with `bash: : command not found` (rc=127) instead of skipping.
scripts/sync-pin-evidence.sh:310:  # so the failure was a "command not found" and the body then reported "the pin
scripts/sync-pin-evidence.sh:331:  grep -q 'command not found' "$guard_dir/err.txt" \
scripts/sync-pin-evidence.sh:332:    && fail "the fail-open signature ('command not found') must be ABSENT — the guard must fire BEFORE the source"

Every hit is classified: the two CHANGELOG/ hits are history, and the three
scripts/sync-pin-evidence.sh hits are all inside the self-test arm — the comment that
names the signature, the assertion that it must be absent, and the failure message that
says so. The thing that produced the false "the pin check is NOT offered as this diff's
coverage"
— the unguarded source — is gone.

The worktree-local binary (R9 — binary equals source), never a shared install:

$ ./charly/bin/charly version
2026.297.0121

The R7 discriminator for the new arm — the gate now catches the very paste the
validator found.
The body this section lives in, with exactly ONE line changed: the R5
sweep's line number moved from the 310 the tree carries to a 331 that carries
different text. That is the defect, reproduced.

$ sed 's|^scripts/sync-pin-evidence.sh:310:|scripts/sync-pin-evidence.sh:331:|' PR_BODY.md > /tmp/stale-body.md
$ node scripts/check-pr-body-diff.mjs --body /tmp/stale-body.md --repo "$PWD" --base origin/main
  PASS  every pasted `git rev-parse HEAD` names the head being pushed (cdc4582)
  FAIL  the body pastes scripts/sync-pin-evidence.sh:331 as "# so the failure was a "command not found" and the body then reported "the pin" (line 260 of the body), and that line reads "grep -q 'command not found' "$guard_dir/err.txt" \" in the tree being pushed — the evidence was taken on another tree
  NOTE  the body states no count of the diff's new files — the count rule is inapplicable
  PASS  the file table lists exactly the 3 file(s) the diff changes (against origin/main)
check-pr-body-diff: 1 finding(s)
$ node scripts/check-pr-body-diff.mjs --body PR_BODY.md --repo "$PWD" --base origin/main
  PASS  every pasted `git rev-parse HEAD` names the head being pushed (cdc4582)
  PASS  every pasted evidence line resolves in the tree being pushed (34 reference(s))
  NOTE  the body states no count of the diff's new files — the count rule is inapplicable
  PASS  the file table lists exactly the 3 file(s) the diff changes (against origin/main)
check-pr-body-diff: OK

The mutated body is RED on the arm that names the defect, and the body as published is
GREEN. The same stale paste went through H, T and N unchallenged before this arm existed —
and the pre-push hook runs this very gate against the body being pushed, so the arm is
live on this push and not only in its fixtures.

Rulebook compliance

  • R0 — /charly-internals:git-workflow was read in full before the first git or gh
    action; the umbrella's own AGENTS.md dispatcher row for git/gh work selected it, and
    no other row's trigger applies to a change inside one shell script and one gate script.
  • R1 — every finding raised on this PR is fixed, not filed away. The validator's
    finding against this body (a pasted sweep taken on another tree) is fixed by the E
    arm in the gate, with its discriminator pasted above. The INCONCLUSIVE verdict is an
    engine class, not a code finding: it is escalated as pr-validator: a review whose answer omits the Verdict: line is DISCARDED whole, so a real finding never reaches the PR plugin-review#47
    (below), with the engine's own reason for discarding the review. The leak this change
    introduced is fixed here, with its own discriminator. The two findings that are
    genuinely separable — a removed gitlink rendering a comparison row against the
    remote, and the umbrella's scripts/design-selftest.sh leaking a full umbrella copy on
    every failing run — are filed as the sync PR body emits a comparison row for a REMOVED gitlink — the removed pin is compared against the remote and can be flagged as a divergence #666 and
    design-selftest.sh leaks a full umbrella copy on every failing run — one copy is 9.9 GB and 28% of the host's /tmp inode budget #668, each with its measurement. Every RCA here names the
    mechanism, the missed control, the blast radius and the root fix.
  • R2 — one definition, one guard pattern: the body copies the commit gate's guard
    rather than inventing a second shape, and the shared rule still lives in exactly one
    file (scripts/pin-contract-inputs.sh). The sweep above proves there is no third reader.
    The scratch helper is one helper with one trap, not one cleanup per call site.
  • R3 — no workaround: the missing file is a loud, named failure, not a fallback branch
    and not a suppressed error; the leak is removed by a trap on the exit path, not by a
    retry, a sleep or a periodic sweeper.
  • R4 — the product was fixed before the prose: the fail-open lived in the shipped
    builder, so the builder is what changed. No documented command needed a workaround to
    work around it, and the umbrella's own prose was not edited to describe the defect away.
  • R5 — the fail-open's own text is gone from the tree: the phrase command not found
    survives only inside the arm that asserts it must stay absent — its comment, its
    assertion and its failure message, three lines in the new self-test — plus two
    CHANGELOG/ history entries, as the sweep above shows. The shared definition has exactly
    two readers, and the sweep shows them.
  • R6 — git status was clean before the branch switch and is clean now; the diff
    touches exactly the three files its table names, and nothing else; no history is
    rewritten, nothing is force-pushed, and no hook is bypassed. This round appends one
    commit to the branch; the commit before it is untouched.
  • R7 — the coverage fails without the change, three times over: the fail-open
    mutant is RED, the trap-removal mutant is RED, and the body gate's new E arm is RED
    on the very stale paste the validator found (the proof is at the end of How tested).
    Both changed paths executed live, standalone and inside the gate.
  • R8 — no service boundary is crossed by this change, so nothing is mocked: the pin
    contract's readers are real files in the real tree, and the gate ran against the real
    index of the real worktree.
  • R9 — the worktree-local, CalVer-stamped build is the one that ran the gate
    (2026.297.0121, printed above); no shared install was used, and the diff adds no
    runtime OS dependency, so packaging: is untouched.
  • R10 — the change-class gate ran on the committed tree that is being pushed, and
    passed with zero warnings: 33 steps, 0 failed, 0 warnings, VERIFY_EXIT=0.

Change classification

Two umbrella-native scripts and the manifest's own step description — the sync PR
body's builder (scripts/sync-pin-evidence.sh), the umbrella's own body gate
(scripts/check-pr-body-diff.mjs), and the charly.yml step that describes the gate's
self-test.

  • Change class: the diff touches no gitlink and no pin, and changes the
    manifest's pins: block not at all — charly.yml is a commit-carried input of the
    pin contract, and this diff changes only a step's check: description, so the pin
    check's own change class fires (and passes) without any pin moving. charly task verify
    is the gate that owns this class.
  • Diffstat: 3 files changed, 301 insertions(+), 6 deletions(-). No file is added and
    no file is deleted.
  • Gate run: ./charly/bin/charly task verify on the committed tree — 33 steps, 0 failed,
    VERIFY_EXIT=0, no warning — plus both changed scripts executed live
    (bash scripts/sync-pin-evidence.sh --self-test and
    node scripts/check-pr-body-diff.mjs --self-test, standalone and inside the gate).
  • Attribution tier: fully tested and validated — the class gate passed on the final
    tree and the changed paths ran live.
  • No submodule, gitlink or pin moves in this diff, so the umbrella's gitlink-verification
    leg does not apply, and nothing here can change a pin.

Filed issues

  • pr-validator: a review whose answer omits the Verdict: line is DISCARDED whole, so a real finding never reaches the PR plugin-review#47 — the INCONCLUSIVE this PR's validator run produced is
    an engine class, and it is escalated, not fixed in this diff. The engine's answer
    (3876 bytes, finish_reason="stop", 29067 of 393216 tokens spent) carried no
    Verdict: line, so plugin-review's verdictExit returned 1 — and because Emit runs
    only after the verdict validates, the whole review was discarded: review.txt and
    review.untrusted.txt are both absent from the evidence artifact and the PR comment
    says "no code finding" while the finding is legible in the debug log's reasoning. The
    prompt is not the defect (opencharly/action-review's charly.yml:517,528,548 demands
    the closing Verdict: line). The remedy belongs to that repo, and a change to the
    verdict contract falls under the T4 security-machinery check, so it needs a
    maintainer-account sign-off I will not author.
  • the sync PR body emits a comparison row for a REMOVED gitlink — the removed pin is compared against the remote and can be flagged as a divergence #666 — the sync PR body emits a comparison row for a REMOVED
    gitlink: the removed pin's sha is compared against the remote's default-branch HEAD and
    can be flagged !, so a removal and a divergence are indistinguishable in the table.
    The classification is correct (measured: is_gitlink_path reads the index first and
    falls back to git ls-tree HEAD, so a removed gitlink resolves to mode 160000 and IS
    classified as a gitlink) — the defect is the value, and it is a separate mechanism
    from this change's fail-open, so it is filed rather than folded in.
  • design-selftest.sh leaks a full umbrella copy on every failing run — one copy is 9.9 GB and 28% of the host's /tmp inode budget #668 — scripts/design-selftest.sh copies the whole umbrella
    into a temporary directory and removes it only on the success path: under
    set -euo pipefail any failure before its rm -rf "$copy" leaves the copy behind, and
    no trap holds the removal on the failure path. Measured on this host: /tmp is a tmpfs
    with 1 048 576 inodes and 62 G of RAM, the umbrella carries 298 262 files, so one copy
    is 28 % of the inode budget and ~9.9 GB of RAM; when the budget runs out, every command
    on the host that needs to create a file fails with ENOSPC — which is what stalled this
    session earlier today. A leaked copy (75 174 files, 10 299 320 KiB, incomplete, nothing
    holding it) was found, measured and reclaimed, freeing 108 562 inodes and 10.3 GB of
    RAM. It is a different file and a different mechanism from this change, and it is in
    active use by another session in this checkout, so it is filed with its measurement
    rather than folded in; the claim on it names the fix it covers.

Agent: charly

Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)

…finition is missing

The wave body sourced scripts/pin-contract-inputs.sh BEFORE `set -euo pipefail`
was in force, so a missing shared file failed the source silently and the
coverage decision then read an undefined `pin_contract_touches_input` as "no".
The body reported "the pin check is NOT this diff's coverage" as a FACT and
exited 0 — a body whose whole job is to state what covers the diff, deciding
by accident. The commit gate (hooks/pre-commit-gate.sh) already carries the
explicit existence guard for the same shared file; the body now carries the
same guard, BEFORE the source, so a reader cannot mistake a failed source for
a decision.

The self-test arm that proves it runs a COPY of this script in a directory that
has no shared file, in BODY mode with empty stdin (never --self-test: the
copy's own self-test would re-enter the arm, and a self-referential arm is a
hang, not a test), so the copy reaches the coverage decision where the
fail-open lived. The discriminator is the fail-open SIGNATURE, not an exit
code: the arm asserts that "command not found" and the "NOT offered as this
diff" claim are both ABSENT, and that the loud failure says the body cannot
decide. The positive control re-runs the same copy WITH the shared file and
requires it to reach a coverage decision, so the arm cannot pass by failing
everything.

Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)
@github-actions

Copy link
Copy Markdown
Contributor

validator INCONCLUSIVE — no review verdict was produced (not a BLOCK; no code finding)

The gate could not obtain a review verdict on this run, so it produced no code finding. This is not a BLOCK and the PR is not being rejected — but the required check stays RED on purpose: unreviewed code must never merge.

  • class: the engine's own terminal line names the class (this workflow keeps no narrative for this marker, so it DEFERS to the line): inconclusive: the review produced no Verdict line — this is NOT a review verdict (the required check stays RED)
  • Verdict class: eval (counts toward AI_REVIEW_AUTO_CLOSE_AFTER)
  • review exit code: 1
  • in-job retries: none — the gate REPORTS the class instead of papering over it (R3)

Root cause (measured in this run). The engine classified the run ITSELF, and its terminal line is quoted below. For a marker this workflow has no bespoke narrative for, the gate does not re-derive a cause from a signature: the engine's own line IS the diagnosis, and the instruction that line carries (every engine class names the knob to change) is the remedy. A signature heuristic must never overwrite what the engine stated.

Measured in this run (the engine's own lines):

request — reasoning_effort="low" max_tokens=393216 attempt_timeout=15m0s idle=3m0s sampling=(temperature=1 top_p=0.95 frequency_penalty=0.5 presence_penalty=1) context_bytes=(system=2857 user=33846) files=1 comments=0
inconclusive: the review produced no Verdict line — this is NOT a review verdict (the required check stays RED)

Durable remedy.

  1. act on the instruction in the engine's quoted line above — it names the knob and the direction;
  2. if the marker is one the gate does not recognise, this workflow's decision table is missing a row: report the marker so the table learns it (a new engine class is a contract change, not a wording change).

Thread policy. A thread gets up to AI_REVIEW_AUTO_CLOSE_AFTER counting verdicts (BLOCK + engine/eval INCONCLUSIVE) before the auto-close step closes it. A clear INFRA failure does NOT count, so this thread stays open for a fresh attempt.

A run that produced no verdict keeps this required check RED: unreviewed code must never merge.

Full diagnostics: this run's evidence artifact + job log (not embedded here — embedding a runaway log would feed it into the next review and deepen the collapse).

… pushed

The `charly/pr-validator` found, on this branch's own PR, a body whose pasted
grep sweep was taken on ANOTHER tree: the body pasted
`scripts/sync-pin-evidence.sh:290:` together with that line's text, and on the
head being pushed line 290 read `guard_rc=0`. The gate's H, T and N arms all
accept that, because a stale paste is well-formed — they judge the body's FORM
and the diff's arithmetic, and never whether a pasted OUTPUT LINE is the tree's
own text. A body could therefore state a fact about the tree that no run of any
command had established.

Arm E closes that class. Every fenced output line of the shape `path:NN:text`
must resolve in the tree being pushed: the file must exist there, the line must
exist in it, and the pasted text must be the text of that line. It is scoped to
fenced blocks and never to prose — a prose quote may name a line that has since
moved, and that is a judgement, not a mechanical fact — and a block that names
another tree explicitly (`git show <blob>`, `git -C <dir>`) is the documented
escape, so a historical quote has a way to say so.

Two new self-test arms prove the arm can fail: a reference to a line the file
does not have, and a reference whose text is not the tree's. Both are RED on the
mutation and the fixture body stays GREEN, so the arm cannot pass by failing
everything.

The same round fixes a leak this change introduced. The missing-shared-file
guard's scratch was removed only at the END of the arm, and `fail` EXITS, so
every failing run left its scratch behind — and one of the ways that arm fails
is a full filesystem, so the leak amplified the very condition it reported.
Measured on 2026-10-24: the host's /tmp (a tmpfs with nr_inodes=1048576) ran
out of inodes while the arm was running, the arm's positive control failed with
"No space left on device", and the arm's own scratch was left behind.

One `scratch` helper now creates and registers every temporary path this
script makes — the guard's scratch, the fixture repository, the rows file —
and ONE trap removes every registered path on every exit path, so registering
a second scratch can never unregister the first. A new self-test arm registers
a scratch in a subshell that exits non-zero and asserts the scratch is gone
afterwards: remove the helper's trap and the arm goes RED, because the guard
would then leak its scratch on every failure too.

Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)
@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

I re-derived every claim in the body against the three diffs, the two commits, and the (empty) comment thread. No comments exist, so no maintainer sign-off is available or needed — the change stands on its own evidence.

What the diff actually does (vs. what the body claims)

1. Fail-loud guard in scripts/sync-pin-evidence.sh.

  • set -euo pipefail is moved to before the source (diff at @@ -45…), and an explicit [ ! -f "$SCRIPT_DIR/pin-contract-inputs.sh" ] guard that names the file is placed before . "$SCRIPT_DIR/pin-contract-inputs.sh". This is exactly the "commit-gate shape" the body describes, and it matches hooks/pre-commit-gate.sh:77.
  • The new self-test arm runs a copy of the script in a temp dir with no shared file, in body mode with /dev/null stdin (never --self-test), asserting guard_rc != 0, cannot decide present, and both fail-open signatures (command not found, NOT offered as this diff) absent. The positive control re-runs the same copy with the shared file and requires exit 0 + the coverage decision. The R7 mutant-A evidence in the body (old shape exits 0 and prints the fail-open claim) is consistent with this being a real discriminator — and it also confirms the script does run to completion against a non-repo temp root, resolving the one concern I had about the positive control.

2. Body gate scripts/check-pr-body-diff.mjs — new E arm.

  • fencedBlocks / evidenceRefs / checkEvidence parse only fenced blocks, skip command lines ($ …) and blocks that name another tree (git show / git -C), and resolve each path:NN:text against HEAD via git cat-file -t + untrimmed git show (the gitRaw helper correctly avoids the leading-blank-line off-by-one). The blank-line case is explicitly guarded (actual !== "").
  • Self-test gains three mutations (line out of range, wrong text, blank line) plus the scripts/blank.sh fixture that discriminates the trim bug — 7 mutations + 1 green = the "8 arms live" the body pastes.
  • I counted the body's own fenced path:NN: lines: ~29 in the pin-contract-inputs sweep + ~5 in the command not found sweep ≈ 34, matching the pasted (34 reference(s)). The sweep text also matches the line numbers I reconstructed from the shell hunk (e.g. sync-pin-evidence.sh:310, :331, :332), so the body's own evidence is internally consistent with the tree.

3. Scratch leak.

  • One scratch helper registers every temp path in SCRATCH_PATHS and installs a single trap … EXIT that removes all of them (${SCRATCH_PATHS[@]+"${SCRATCH_PATHS[@]}"} — safe under set -u). Both old mktemp + per-path traps (tmp, ROWS_FILE) are replaced; no leftover legacy cleanup path remains.
  • The probe arm registers a scratch in a subshell that exit 1s and asserts the path is gone, which goes RED if the trap is removed (body's mutant-B evidence).

4. charly.yml only updates the gate step's check: description to name the count and evidence arms — consistent with the body's "under-describes the product it runs" rationale.

Arithmetic / honesty

  • 3 files changed, +1/-1 + +182/-2 + +118/-3 = 301 insertions, 6 deletions, exactly the body's diffstat; no file added/deleted; head cdc4582 matches the second commit.
  • The "line 290 read guard_rc=0" sentence describes the earlier stale-paste defect (the thing the E arm now catches), not a claim about the current head, where those lines sit at 310/331/332 — the current sweep is correct. No contradiction.

Minor, non-blocking observations

  • The new gate's regex path:NN:text would also match a col-0 file.ts:10:5 - error-style line and could false-RED such a block. It is fail-safe (a false RED, not a false GREEN), the PR's own body is unaffected, and the git show/git -C escape is documented — worth noting for a future hardening, not a blocker here.
  • The final self-test OK (...) summary string is not extended to name the two new shell arms; they run and pass but are not enumerated in the summary. Cosmetic only.

Verdict

The change does what the body claims, ships tests that would fail without it (all three mutants are real discriminators per the diff), is coherent and free of leftover paths, introduces no security or dependency risk, and the body's evidence is internally consistent with the tree. No comments require disposition.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 24, 2026 08:16
@github-actions
github-actions Bot merged commit 6575356 into main Oct 24, 2026
3 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Oct 24, 2026
@aitrawog

Copy link
Copy Markdown
Contributor Author

STATUS

Agent: charly

This round is landed. Head cdc4582 — PASS on the validator
(validate / validate SUCCESS, validate / lint SUCCESS, validate / arm SUCCESS),
squash 65753565, merge-time tag v2026.297.0817, CHANGELOG/2026.297.0817.md
written from the body.

The RCA the round's INCONCLUSIVE required. The first run's verdict was never
emitted, so plugin-review's verdictExit returned 1 and the review was DISCARDED
whole — review.txt and review.untrusted.txt are both absent from the run's
evidence artifact, and the PR comment said "no code finding" while the finding was
legible in the debug log's reasoning. The engine's answer was a completed generation
(finish_reason="stop") with no Verdict: line, so the discard was the engine's
contract working as written and the defect is in that contract, not in this diff.

  • Mechanism: the review is emitted, the verdict line is validated, and only then
    is the review written — so a generation that omits the line loses the whole review
    instead of losing one field.
  • Missed control: nothing checked that a completed generation carried the line the
    downstream step parses, so a well-formed answer could be silently discarded.
  • Blast radius: every finding the review would have raised is lost, and the PR
    reads "no code finding" — on this PR that hid a real body-evidence defect, which was
    only recovered by reading the run's debug log.
  • Root fix and escalation: the verdict contract belongs to opencharly/plugin-review
    and is filed as pr-validator: a review whose answer omits the Verdict: line is DISCARDED whole, so a real finding never reaches the PR plugin-review#47. A change to the verdict contract
    falls under the T4 security-machinery check and needs a maintainer-account sign-off,
    which this session does not author; the class is therefore escalated, not patched
    around, and the re-run on the final head produced a verdict and PASSED.

Every finding raised on this PR was fixed in it, none filed away.

  • The body-evidence finding — a pasted sweep taken on another tree, with a false
    "exactly one place" claim — is fixed by the gate's new E arm: every fenced
    path:NN:text line must resolve in the tree being pushed. RED on the stale paste
    the validator found, GREEN on the body as published; both pasted in the body.
  • The fail-open this PR's first round found is fixed here, with its mutant RED.
  • The leak this PR introduced is fixed here, with its own trap-removal RED.

Filed, and still open: #666 and #668
(non-blocking, with their measurements), and opencharly/plugin-review#47 (the engine
class above).

Next update due: the corpus half of the same finding lands in
opencharly/layer-charly-internals#147; the umbrella's README.md row is aligned in
the umbrella's next PR.

Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)

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

Labels

None yet

Projects

None yet

1 participant