Skip to content

fix(gate): implement R5, drive verify.py through the real gate, correct receipt wording - #1

Open
MacFall7 wants to merge 1 commit into
mainfrom
fix/gate-r5-verify-real-path
Open

fix(gate): implement R5, drive verify.py through the real gate, correct receipt wording#1
MacFall7 wants to merge 1 commit into
mainfrom
fix/gate-r5-verify-real-path

Conversation

@MacFall7

Copy link
Copy Markdown
Owner

Closes the three P0 findings from the 2026-07-17 estate audit. Loom blocker: record after this merges, not before.

Findings closed

1. R5 promised, never implemented. policy.md and read_refund_policy() list R5 (refund equals order total); _evaluate() ran R1-R4 only. The gate now takes an optional requested_amount and denies under R5 when it differs from the order total. Exposed through propose_refund and the tool schema, so the "customer asks for more than they paid" case reaches the gate. This adds a demo beat: the model can be talked into requesting an inflated amount; the gate cannot.

2. verify.py partially tested itself. The unknown-order case hardcoded got = "ESCALATE" without calling the gate, and every other case re-derived the verdict via _evaluate instead of the real execution path. Every case now runs through propose_refund, including:

  • the approval mutation (order flips to refunded)
  • receipt hash recomputed and matched
  • R5 inflated-amount deny
  • repeat proposal after approval must deny under R3

6/6 becomes 8/8, and the count now means what it says.

3. Wording. propose_refund docstring claimed a "signed receipt"; it is an unsigned sha256 hash. Corrected. README already used the honest "Receipt (sha256)" phrasing.

Verification

python verify.py  →  8/8 scenarios correct, exit 0   (Python 3.10)

Receipt: tools.py sha256 cfe51364…, verify.py c35fae9f…, README.md c4bf7398… as pushed on this branch.

Authored by the Cowork executor from audit findings; adjudication basis UPLOADED_ARTIFACT (code read and executed in-session). Merge is Mac's gate.

…ct receipt wording

Audit findings (estate audit 2026-07-17) closed:

1. R5 was promised in policy.md and read_refund_policy() but never checked.
   _evaluate now takes an optional requested_amount; a request that differs
   from the order total is DENIED under R5. propose_refund and the tool
   schema expose it so an inflated customer ask reaches the gate.

2. verify.py hardcoded the ESCALATE expectation for unknown orders and
   re-derived verdicts via _evaluate, so the headline count partially
   tested the verifier, not the gate. Every case now runs through
   propose_refund — the real execution path — including the approval
   mutation, a receipt-hash recompute, an R5 inflated-amount deny, and a
   post-approval repeat proposal that must deny under R3. 6/6 → 8/8.

3. propose_refund docstring claimed a "signed receipt"; the receipt is a
   sha256 hash, unsigned. Wording corrected to match the code (README
   already said sha256).

Verified: python verify.py → 8/8, exit 0 (Python 3.10).
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.

1 participant