Expand permit decision binding coverage to v1/v2/v3/v4 (independent offline verification of MPP + delegation permits)#29
Merged
Conversation
Port the keel-api permit-binding canonical builders into keel-verifier and accept permit.decision.v1 canonical payloads for binding versions v1 through v4. Recompute v3 spend_scope_hash and v4 delegation_policy_hash from exported resource_attributes_json before accepting a signed permit decision, while preserving historical v1 semantic pins for old pinned packs. v3 source note: keel-api PR #239 commit 03bcd1d964c6f25f9c985850d1452a19ee771a5a shows v2 adds session/chain binding fields, v3 adds spend_scope_hash, and v4 adds delegation_policy_hash. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expands the
permit.decision.v1claim's binding-version pin from v1-only to v1/v2/v3/v4, so the publishedkeel-verifierpackage can independently verify offline:Before this PR,
pip install keel-verifier+ running it against any MPP/workflow-intent/delegation permit rejected with literal"binding_version must be v1". Runtime tamper-evidence in keel-api already covered v1-v4; this PR brings the external independent verifier to parity.What this ships
Binding coverage expansion (additive — no v1 behavior changes):
verifier.py:3566— pin loosened frombinding_version == "v1"to enum{v1, v2, v3, v4}data/semantics/permit/decision_v1.json—binding_versionfield is now{"enum": ["v1","v2","v3","v4"]}New verifier-side canonical builders (
keel_verifier/canonical/permit_binding.py— ported from keel-api, byte-identical):_canonical_json(UTF-8,ensure_ascii=False,sort_keys=True,separators=(",", ":"))canonical_binding_payload_v1/v2/v3/v4canonical_spend_scope_payload(v3 recompute input)canonical_delegation_policy_payload(v4 recompute input)Independent recompute + tamper detection:
spend_scope_hash, recompute fromresource_attributes_json, reject on mismatch with structured codepermit.binding.v3.spend_scope_hash_mismatchdelegation_policy_hash, structured codepermit.binding.v4.delegation_policy_hash_mismatchVersion + metadata:
pyproject.toml:3.0.1→3.1.0(additive minor)Important correction to spec
Dispatch prompt incorrectly stated
spend_scope_hashwas added in v2 binding. Codex code-grounded against keel-apipermit_binding.py:558and found the actual layout:spend_scope_hash(← MPP permits use v3, not v2)delegation_policy_hashReject codes are correctly named for v3 (spend_scope) and v4 (delegation_policy) per the actual binding versions, not the spec's incorrect naming.
Source-of-truth specs
keel-api/docs/_strategy/SPEC_PARENT_CHILD_VERB_DELEGATION_v4_PRB_VERIFIER_DESIGN_2026-06-03.md— verifier design (B2 path)keel-api/app/services/permit_binding.py— canonical builder source (mirrored byte-identically)Test plan
v3.1.0→ release.yml publishes to PyPIpip install keel-verifier==3.1.0+ run against a production MPP permit → PASS (not"binding_version must be v1")Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
🤖 Generated with Claude Code