Repository navigation
Conversation
…every required fact When an agent runs out of steps without declaring DONE, it may have stopped mid-task. finalize_on_step_cap still had two ways to stamp VERIFIED that do not check the end state: a passing verification_frame on the last observation, and required facts the ledger picked up earlier in the run. Now the step-cap receipt is VERIFIED only when the episode made a save, no compiled obligation is open, every required fact is proven, and an attached Rung 3 or Rung 2 verifier passes on the final observation. Unproven facts settle the receipt as COMPLETED_UNVERIFIED before any verifier runs. Everything else is COMPLETED_UNVERIFIED with delivery_uncertain set.
Independent adversarial review: APPROVEFrom: Grok This tightens Local tests at this exact head. Generality gate. The production diff is only CI at this head. Limitations, not blockers for this PR.
A maintainer still has to merge this PR; I will not merge it. |
Problem
In a HealthAdminBench run (N=135, wrapped arm), 38 episodes hit the step cap without DONE and
finalize_on_step_capsettled them asVERIFIED. None of the 38 passed the official grader. Normal DONE episodes looked much better (VCR 5, SER 20).That run used
1574d5f53. Where the 38 came from:mainverified_commit_hold("Commit N was verified at step K and no state-changing action ran since")mainalso added the no-save guard (d9d39f2) and the open-obligations guard (0df6072) after that run. So 31 of the 38 are already fixed onmain. This PR does not change the 7 Rung 2 cases.What this PR changes
finalize_on_step_caponmainstill had two ways to returnVERIFIEDwithout checking the end state:verification_frameon the last observation.Both are removed from the step-cap path. A step-capped receipt is now
VERIFIEDonly when all of these hold:required_fact_idsentry is proven (new: checked first, and unproven facts settle the receipt without calling any verifier),Otherwise the receipt is
COMPLETED_UNVERIFIEDwithdelivery_uncertain=True. The reason says whether facts were unproven, the verifier did not hold, or no verifier was attached.ReceiptOutcomehas noUNCERTAINmember. The existing no-save path (COMPLETED_UNVERIFIED,commit_index=0,delivery_uncertain=True) already covers that case, so I did not add an enum value.verification_frameis still used on the normal DONE path (simplex_transducer.py). Nothing inopenadapt/relied on it at step cap.The 7 Rung 2 cases
The benchmark runner attaches its own DOM read-back Rung 2 verifier and passes no
required_facts. With this PR, a Rung 2 pass and no required facts still givesVERIFIED, so those 7 would still promote. To fix them, change the runner: passrequired_factsin the task, or make its Rung 2 check stricter. That is a separate change.Tests
New or rewritten in
tests/test_transducer_fact_ledger.py:test_step_cap_after_earlier_saves_with_unproven_facts_is_not_verified: the HealthAdminBench shape. Two saves are each verified mid-run, then the step cap hits with one required fact unproven. The test expectsCOMPLETED_UNVERIFIED, and Rung 2 must not be called at finalize.test_step_cap_facts_proven_without_an_end_state_verifier_are_not_verifiedtest_step_cap_ignores_a_passing_verification_frame_without_a_verifiertest_step_cap_verifies_when_rung2_holds_and_all_facts_are_proven(rewritten fromtest_step_cap_audit_accepts_facts_proven_on_the_final_view, which asserted the old behavior)test_step_cap_verifies_when_rung3_holds_and_all_facts_are_provenThe first three fail on
mainand pass with this change.Local results:
pytest tests/test_transducer_fact_ledger.py: 29 passedpytest tests/test_openadapt_wrap.py tests/test_simplex_transducer.py tests/test_transducer_*.py tests/test_wrap_command.py tests/test_evidence_pending_callers.py: 609 passed, 31 xfailedtests/: 3498 passed. The 31 failures and 8 errors (CLI smoke, quickstart, release artifacts, seal publish, browser fixture) fail the same way on unmodifiedmainin this environment.test_receipt_verify.pyandtest_wrap_receipt_trust.pycannot be collected here becauseopenadapt_flow.receipt_recordis missing.ruff check openadapt/andruff format --check openadapt/: cleanmypy openadapt/transducer_fact_ledger.py: no new errors in this file