<!-- informative -->

# Reviewer Brief: SPEND-Gate Re-Verification

## Mandate

Independently re-verify the SPEND gate on the current revision and re-issue its verdict. The original SPEND review returned
NO-GO with four reachable P1 falsifications; the implementer fixed them in `9e657e5` (and later batches added dependent
work), but unlike the EXECUTION, R08, and MEASUREMENT gates, the SPEND fixes have **never been independently re-verified**.
Self-verification is not a gate: re-run the original probes yourself and decide.

**Independence:** you must not be the author of `9e657e5` or of any commit touching the spend boundary
(`Ledger`, `ModelAdapter`, `spend.py`, the run-limit enforcement, the experiment spend gate). If you performed the
original SPEND review, re-running against a changed revision is still valid, but state that in the report.

## Target

- Repo: `/home/ruben/Projectos/meta-project/orchestrator`
- Revision reviewed: current `main` (`3533c41`).
- Original revision reviewed: `9e94357` (Batch 2). Fix commit: `9e657e5`. Later commits that touch the boundary:
  `97c1891` (token ceilings), `d24c505` (A1/A8 defect fixes: model actions require token ceilings; completion-units
  catalogue), and the Batch 5/6 commits.
- Work on a frozen revision:
  `git worktree add --detach /tmp/kilo/spend-reverify-3533c41 3533c41`
- Original report: `docs/research/spend-gate-adversarial-review.md` (findings F1–F11 and claim 5).
- Normative documents: `docs/budgets.md`, `docs/experiment.md`, `docs/executors.md`, `docs/tables/limits.yaml`,
  `docs/glossary.md` (budget dimensions and completion units).
- Baseline: `.venv/bin/python -m pytest -q` (expect 530 passed). A green suite is not a verdict.
- No network, no paid calls, synthetic clients only; probes under `/tmp/kilo/`; no source edits.

## What to re-verify (the original findings)

| Finding | Claim to re-check |
| --- | --- |
| F1 | Single-flight: one `(attempt_id, token)` invokes the priced client exactly once even when the completion fails post-call validation |
| F2 | Cancellation retains a dispatched/observed attempt's durable actual (no laundering to zero) |
| F3 | `Ledger.transfer` moves only unspent capacity, never already-spent budget |
| F4 | `ACCEPTANCE_AUTHORISED` requires admitted, node-owned, non-empty, all-passing evidence; a direct inline-checks event cannot mint acceptance |
| F5 | `run_trial` requires a spend ledger (no trial starts unreserved) |
| F6 | Token ceilings: **known residual** — an undeclared client `(0,0)` can overshoot the aggregate ceiling by one call before refusal |
| F7 | Completion units must be a catalogued monetary unit; token-shaped or unknown units are refused |
| F8 | The spend ledger takes an exclusive cross-process lock, reloads under it, and writes a per-process temp file; concurrent writers cannot lose a reservation or exceed the cap |
| F9 | Settlement accepts an actual within tolerance of the commitment instead of failing on a rounding boundary |
| F10 | Freeze normalisation canonicalises sets/frozensets and bytearrays so the frozen hash cannot drift |
| claim 5 | A dispatched prompt must carry a digest that describes exactly that prompt |

Also re-check the **gate/entry** guarantees: `run_experiment` requires an owner authorization; `run_pilots` and
`run_measured_comparison` require the ledger; the experiment-wide cap spans pilots, retries, and in-flight reservations
and is restart-safe; an over-cap trial cannot start.

## Method

- Re-run the original probes from `/tmp/kilo/spend_*.py`, adapted only for signature changes (for example, a probe that
  called a helper with an argument it no longer takes). Record any adaptation.
- Do not trust the fix commit message or the implementer's regression tests as evidence; read the diff, then reproduce.
- For each finding, attempt the original falsification, and additionally attempt a regression introduced by later
  batches (token ceilings, model-action ceiling requirement, units catalogue, R10/R14 changes touching `_accept` and
  recovery, which share the ledger).
- Attacks to include beyond the original: concurrent duplicate delivery under a validation failure; a token ceiling that
  is overshot by a client declaring `(0,0)` and by a client whose declared ceiling is below its reported usage; a
  non-monetary or unknown unit; an over-cap trial that must not create durable trial state; a restart that must not
  reset consumed capacity; a changed authorization on an existing experiment directory; two processes reserving against
  one workdir.
- For each attack record: exact commands, observed result, expected result, and whether the claim is violated.

## F6 — the decision this review must make

F6 was deferred: a client that declares `(0,0)` claims no token bound, so the aggregate run ceiling can be exceeded by
one call before the next request is refused. The shipped `ExperimentModelClient` does not declare per-call ceilings, and
the model-boundary fix (`d24c505`) now requires a model action to have *configured run token ceilings*, which bounds the
aggregate but not the final call. Decide and justify whether this blocks the SPEND gate for a **tiny, explicitly capped
owner-authorized smoke test**:
- if it blocks, state the minimal condition to close it (client-declared ceilings, or calibration headroom, both of
  which change the frozen calibration contract);
- if it does not block, state the residual exposure in cost terms and the cap under which the exposure is acceptable.

## Deliverable

1. **Verdict:** GO / NO-GO for the SPEND gate on `3533c41`, one sentence.
2. **Per-finding table:** original finding, re-verification method, observed result, open/closed.
3. **F6 decision** with justification and, if unresolved, the residual exposure.
4. **New findings**, each with severity, the invariant violated, a minimal reproducer, observed versus expected, and a
   proposed regression test.
5. **Regression check:** confirm no later commit re-opened an earlier SPEND finding.
6. **Residual unknowns** and what you did not cover.

## Exit criteria

- Every original finding is either re-falsified with a reproducer or explicitly "re-verified closed" with the method.
- No paid calls, no network, no source edits; host state left clean.
- Findings are reproducible from the report alone, against `3533c41`.
- The report states what it did not cover.

## Reproduce everything

List every probe command here so the verdict can be re-run against a further corrective revision.
