feat(types): add reward contract, certificate, and evidence receipt - #37
Merged
Conversation
RewardContractV1, RewardCertificateV1, and RewardEvidenceReceiptV1 give a trainer a verified terminal effect with a certified false-accept bound. RECONCILIATION_REQUIRED and FAILED_PLATFORM are unscored and never 0.0. certified requires oracle tier 2 or 3 plus a current certificate; tier 0 and 1 are development_only. The receipt has its own schema id and none of the Execute Seal fields. It is not an Execute Seal. Co-Authored-By: Claude Fable 5.1 <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.
Adds
openadapt_types/reward.py: three strict, versioned contracts for training a policy against a verified terminal effect, plus the purescore()helper, packaged JSON Schemas, tests, anddocs/REWARD.md.What it adds
RewardContractV1(openadapt.reward-contract/v1) binds task and environment by opaque id and digest, the required and forbidden effect contracts by digest, the independent oracle (anOracleChannelplus identity keys and an oracle contract digest), the reward components with weights, a scoring policy, and a certificate policy (epsilon,delta,threshold, calibration corpus digest, expiry in policy updates). Itsdigestis the canonical SHA-256 used elsewhere in this package; components sort by name so the digest does not depend on author order. The pinned digest intests/test_reward.pywill fail if the canonical form ever changes.RewardCertificateV1(openadapt.reward-certificate/v1) is the signed bound withissued_at_policy_updateandexpiry_policy_updates.is_current(policy_update)andstate_at()answer whether a trainer may still use it.satisfies(policy)checks it against the contract's certificate policy.RewardOutcomeV1has seven members, each with one scoring class inREWARD_SCORING_CLASS:verified(admitted positive),halted_before_effect,refused,rejected_policy,wrong_effect(zero or a declared penalty),reconciliation_requiredandfailed_platform(unscored).refusedis separate from a runtime halt so a trainer can weigh them apart.wrong_effectis the silent wrong action the certificate bounds.RewardEvidenceReceiptV1(openadapt.reward-evidence-receipt/v1) binds the contract digest, policy checkpoint and update number, episode id, oracle tier, evidence digest, component vector, scalar (absent when unscored), certificate reference and state, uncertainty state,certified,development_only, issuer, nonce, timestamp, and an ed25519 signature.score(outcome, tier, certificate, policy_update, *, scoring=DEFAULT_REWARD_SCORING)returns(scalar | None, certified, development_only).Rules the types enforce
score()returnsNone, the receipt refuses ascalar_rewardfor it, andRewardScoringPolicyV1fixesuncertain_episodesandplatform_failuresto the literal"unscored".certifiedis true only at oracle tier 2 or 3 with a certificate whose state iscurrentat the receipt'spolicy_update. A tier-0 or tier-1 receipt marked certified fails validation throughRewardCertificationRefused.development_onlymust equaloracle_tier < 2.verifiedscalar must be positive; a zero-or-penalty scalar must be at most zero;verifiedcannot carry an uncertainty state;reconciliation_requiredmust.Not an Execute Seal
The reward receipt states that OpenAdapt verified the terminal effect of one episode. It does not state that Flow governed the policy's actions. It has its own schema id and shares only generic plumbing with
ExecuteEvidenceReceiptV1(receipt_id,oracle_tier,evidence_digest,nonce,issued_at,schema_version).test_reward_receipt_is_not_an_execute_sealpins that shared set, asserts no Seal-specific field exists on the reward receipt, and checks that neither receipt validates as the other.Reviewer checks
uv run pytestis green locally (428 passed).uv buildplusscripts/check_source_boundary.py --require-distpass.openadapt_types/schemas/; the README count moves from thirty-one to thirty-four andtest_readme_claims.pyextends its number table.feat:squash commit, as with the previous releases in this repository.Preregistration this follows: openadapt-evals
docs/preregistrations/PREREGISTRATION_CERTIFIED_REWARD_RL_2026_08_25.md, section 3.6 and section 6.Opened by an agent session, not the founder.
🤖 Generated with Claude Code