reputation-ladder: make the dry-run readable (banner unit, pass summary) + harden the hooks-doctor gate trap #2951

Merged
hermes merged 2 commits from kb/ladder-dryrun-evidence into main 2026-11-25 19:32:05 -06:00
Collaborator

Why

The ladder shipped in #2949 runs, but its only readable evidence is the journal — the proposals file sits in a 0750 state dir owned by the service. Reading the journal showed two problems, and a third appeared in the merge run itself.

1. The banner re-labelled minutes as hours

reputation-ladder: dry-run, window 360m, slot 30m, half-life 720h, proposals -> ...

The unit passes --half-life-minutes 720 (12 h). 720h reads as a 30-day half-life to anyone diagnosing why an offender's history decayed — the exact question the 7-day dry-run exists to answer.

2. Silence after the first pass

One line per proposal, then nothing ever again. An idle tail and a stalled daemon look identical, which is fatal for a gate that is waiting seven days for a file it cannot read.

Now, one summary line per --summary-every passes (default 20 → every 10 min at the unit's 30 s interval):

reputation-ladder: pass 20, 74 rows ingested, 3 IPs tracked, 1 new proposals {4: 1}

Rows ingested proves the tail advanced; the rung tally says what would have been enforced. 0 disables it.

3. hermes-runtime-gates red on the merge of #2949 — cleanup, not a finding

Run 26267 (hermes-runtime-gates) ended:

ok   hermes-agent hooks-doctor gate (config-declared hook reads PENDING CONSENT; unpatched still says dead)
rm: cannot remove '/tmp/tmp.xllsueY2oQ/home-noconsent': Directory not empty
⚙️ [runner]: RUN exit status 1

Every assertion passed; the EXIT trap lost an ENOTEMPTY race against a doctor smoke-test child still writing into the fixture, and its non-zero became the job's status — so Gate summary failed too. The trap now retries briefly, then reports on stderr and leaves the directory to the runner's reaper. Cleanup can no longer decide the verdict: verified with a path that can never be removed (/proc/sys/kernel) — the script still exits 0 with the note.

Tests

22 checks (was 19), all passing; the suite runs in the derivation's checkPhase:

  ok   the banner labels the half-life in minutes, not hours
  ok   the daemon prints a pass summary (journal is the readable evidence)
  ok   the pass summary reports the rung tally of new proposals
all checks passed

Both new behaviours are load-bearing — mutation-tested and restored:

mutation result
banner back to 720h 🔴 1 check
summary branch disabled (if False:) 🔴 2 checks

Scope

  • packages/reputation-ladder/reputation_ladder.py — banner unit, --summary-every, pass tally
  • .forgejo/tests/test-reputation-ladder.py — 3 new checks
  • .forgejo/tests/test-hermes-agent-hooks-doctor-auto-accept.sh — trap hardening (the flake above)

No change to scoring bands, thresholds, exemptions or the --enforce refusal. Enforcement stay off; the 7-day dry-run gate (reproduce the same rung-4 IP set) is unchanged.

## Why The ladder shipped in #2949 runs, but its **only readable evidence is the journal** — the proposals file sits in a `0750` state dir owned by the service. Reading the journal showed two problems, and a third appeared in the merge run itself. ### 1. The banner re-labelled minutes as hours ``` reputation-ladder: dry-run, window 360m, slot 30m, half-life 720h, proposals -> ... ``` The unit passes `--half-life-minutes 720` (12 h). `720h` reads as a **30-day** half-life to anyone diagnosing why an offender's history decayed — the exact question the 7-day dry-run exists to answer. ### 2. Silence after the first pass One line per proposal, then nothing ever again. An idle tail and a stalled daemon look identical, which is fatal for a gate that is *waiting seven days* for a file it cannot read. Now, one summary line per `--summary-every` passes (default 20 → every 10 min at the unit's 30 s interval): ``` reputation-ladder: pass 20, 74 rows ingested, 3 IPs tracked, 1 new proposals {4: 1} ``` Rows ingested proves the tail advanced; the rung tally says what *would* have been enforced. `0` disables it. ### 3. `hermes-runtime-gates` red on the merge of #2949 — cleanup, not a finding Run 26267 (`hermes-runtime-gates`) ended: ``` ok hermes-agent hooks-doctor gate (config-declared hook reads PENDING CONSENT; unpatched still says dead) rm: cannot remove '/tmp/tmp.xllsueY2oQ/home-noconsent': Directory not empty ⚙️ [runner]: RUN exit status 1 ``` Every assertion passed; the `EXIT` trap lost an `ENOTEMPTY` race against a doctor smoke-test child still writing into the fixture, and its non-zero became the job's status — so `Gate summary` failed too. The trap now retries briefly, then reports on stderr and leaves the directory to the runner's reaper. **Cleanup can no longer decide the verdict**: verified with a path that can never be removed (`/proc/sys/kernel`) — the script still exits 0 with the note. ## Tests 22 checks (was 19), all passing; the suite runs in the derivation's `checkPhase`: ``` ok the banner labels the half-life in minutes, not hours ok the daemon prints a pass summary (journal is the readable evidence) ok the pass summary reports the rung tally of new proposals all checks passed ``` Both new behaviours are **load-bearing** — mutation-tested and restored: | mutation | result | |---|---| | banner back to `720h` | 🔴 1 check | | summary branch disabled (`if False:`) | 🔴 2 checks | ## Scope - `packages/reputation-ladder/reputation_ladder.py` — banner unit, `--summary-every`, pass tally - `.forgejo/tests/test-reputation-ladder.py` — 3 new checks - `.forgejo/tests/test-hermes-agent-hooks-doctor-auto-accept.sh` — trap hardening (the flake above) No change to scoring bands, thresholds, exemptions or the `--enforce` refusal. Enforcement stay off; the 7-day dry-run gate (reproduce the same rung-4 IP set) is unchanged.
The proposals file lives in a 0750 state dir, so the JOURNAL is the only evidence
anyone can read during the 7-day dry-run, and it said two misleading things:

- the banner printed --half-life-minutes as "720h" (a 30-day decay, not 12h), so a
  reader diagnosing why an offender's history decayed would draw the wrong number;
- the daemon never said what it was doing: one line per proposal and silence after,
  with no way to tell an idle tail from a stalled one.

Now: banner in minutes, and one summary line per --summary-every passes (default 20
= 10 min at the unit's 30s interval) with rows ingested, IPs tracked and the rung
tally of NEW proposals. Pinned by three new checks (22 total); both mutations
(banner back to h, summary disabled) go red.
hooks-doctor gate: cleanup must not decide the verdict
Some checks reported warnings
Policy Gates / Worker-scope reaper worker signature (mutation-tested) (pull_request) Successful in 8s
PR base guard / Base drift / conflict check (pull_request) Successful in 9s
Policy Gates / Kanban pool capacity knob (runtime override + clamp, mutation-tested) (pull_request) Successful in 4s
foremerge intent (advisory) 3 of 3 changed path(s) have no live foremerge intent: .forgejo/tests/test-hermes-agent-hooks-doctor-auto-accept.sh, .forgejo/tests/test-reputation-ladder.py, packages/reputation-ladder/reputation_ladder.py
Policy Gates / Sentinel pass budget contract (prompt forbids the full board walk, mutation-tested) (pull_request) Successful in 5s
Secret Scan / gitleaks scan (pull_request) Successful in 15s
Policy Gates / CI-scratch reaper class table (mutation-tested) (pull_request) Successful in 5s
Policy Gates / Fleet cache sweep class table (mutation-tested) (pull_request) Successful in 5s
NixOS Build Check / Scope changed deployable hosts (pull_request) Successful in 48s
NixOS Build Check / Flake input regression guard (pull_request) Successful in 6s
Policy Gates / foremerge accept-order contract (real binary) (pull_request) Successful in 1m17s
Policy Gates / Scheduled foremerge reap command line (mutation-tested) (pull_request) Successful in 5s
NixOS Build Check / Hermes runtime gates (one eval of vpn's runtime) (pull_request) Successful in 1m52s
Policy Gates / .forgejo/tests python suites (hermetic) (pull_request) Successful in 59s
Policy Gates / Fleet control ledger (sealed profile fails the build, mutation-tested) (pull_request) Successful in 21s
NixOS Build Check / Build changed host closures (per-host budget) (pull_request) Successful in 4m2s
NixOS Build Check / Gate summary (pull_request) Successful in 0s
Repo Gates / Repo gates (script-only battery) (pull_request) Successful in 5m29s
742247fef3
rm -rf lost the ENOTEMPTY race against a doctor smoke-test child still writing into
the fixture, and the EXIT trap's non-zero reded the whole gate with every assertion
green: merge of #2949 (run 26267, hermes-runtime-gates) ended
  'rm: cannot remove .../home-noconsent: Directory not empty' -> exit 1
after the final 'ok' line, and Gate summary failed on it.

Retry the removal briefly, then report it on stderr and leave the directory to the
runner's reaper; the exit status stays the assertions'. Verified: a cleanup that can
never succeed still exits 0 with the note.
Author
Collaborator

foremerge intent coverage (advisory) — 3 of 3 changed path(s) in ymrtech/nix-config#2951 have no live foremerge intent:

  • .forgejo/tests/test-hermes-agent-hooks-doctor-auto-accept.sh
  • .forgejo/tests/test-reputation-ladder.py
  • packages/reputation-ladder/reputation_ladder.py

Coverage was decided by reading the repo's foremerge ledger (16 in-flight intent(s) considered) against this PR's changed paths — no branch or session name is involved, so a force-push does not change the answer. Paths that legitimately need no claim (docs, .md, flake.lock) are excluded.

This is advisory and does not block the merge. To clear it, publish intent for the paths above (foremerge intent publish --agent <your agent id> --task <task> --summary <what and why> --scope file:<path>=modify), or ignore it if the work genuinely collides with nobody.

**foremerge intent coverage (advisory)** — 3 of 3 changed path(s) in ymrtech/nix-config#2951 have no live foremerge intent: - `.forgejo/tests/test-hermes-agent-hooks-doctor-auto-accept.sh` - `.forgejo/tests/test-reputation-ladder.py` - `packages/reputation-ladder/reputation_ladder.py` Coverage was decided by reading the repo's foremerge ledger (16 in-flight intent(s) considered) against this PR's changed paths — no branch or session name is involved, so a force-push does not change the answer. Paths that legitimately need no claim (docs, `.md`, `flake.lock`) are excluded. This is advisory and does **not** block the merge. To clear it, publish intent for the paths above (`foremerge intent publish --agent <your agent id> --task <task> --summary <what and why> --scope file:<path>=modify`), or ignore it if the work genuinely collides with nobody.
hermes merged commit 3fde99cd33 into main 2026-11-25 19:32:05 -06:00
hermes deleted branch kb/ladder-dryrun-evidence 2026-11-25 19:32:06 -06:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ymrtech/nix-config!2951
No description provided.