Skip to content

feat(ladder): one check-level ladder and evidence-scope receipts on every path - #2495

Open
abrichr wants to merge 7 commits into
mainfrom
claude/nodb-ladder
Open

abrichr wants to merge 7 commits into
mainfrom
claude/nodb-ladder

Conversation

@abrichr

@abrichr abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member

What this does

Makes openadapt_types/check_level.py the only source of check levels and gives every receipt one word for its evidence.

  • One ladder. verify-run, the runtime report, the tx engine and Execute v1 build their tier and strength tables from check_level. A separate-session read is level 3 on every path. It counts as VERIFIED with basis separate_session when the contract's minimum is independent_session. Before this change, verification.py and verify_run.py disagreed about it. The default minimum (independent_system_of_record) is unchanged.

  • Receipt words. outcome_word(level, basis) returns VERIFIED only for levels 3 and 4, and only with a basis (separate_session, system_api, activity_log, db_frame, owned_connection). A same-screen or reopened check is SHOWN, a counterparty check is CONFIRMED, an operator's confirmation is ATTESTED, and anything else is RECORDED. VERIFIED means "as of the read-back time, the read-back showed X", not "persisted".

  • Evidence scope. openadapt_types/evidence_scope.py adds openadapt.evidence-scope/v1. It records the check level, the word, the basis, the wire scope (the channel watched and the protocols parsed), the read-back time, the recheck window and not_covered. not_covered always lists server_side_async_effects and outbound_effects.

    • verify-run receipts carry the block, and so do tx receipts and their results.
    • So do run receipts (record/run/v1). There it is an additive, optional predicate field. When the field is absent, wire() leaves it out, so older receipts keep their canonical bytes and still verify. All existing shared vectors are byte-identical after regeneration. Two new vectors were added: valid-evidence-scope and evidence-scope-disagrees.
    • A run report has no per-read time, so a run receipt lists read_back_time in not_covered instead of guessing one.
    • A run receipt whose saves were checked below level 3 is UNKNOWN with reason below_verified_level. It is never VERIFIED, and no built-in profile produces such a run.
  • tx without SQLite authority. tx/lens.py no longer caps every verdict at UNCERTAIN. A post-commit update read is CONFIRMED with basis system_api (tx/api_readback.py) when all of these hold:

    • the read was sent with cache-bypass headers;
    • the response shows no sign of a cache (no Age, cache-status or Warning 11x headers, and the status is not 304);
    • the record's integer version is exactly one past the before-image's;
    • no concurrent modification was reported.

    Anything else is still UNCERTAIN. Undo still requires the row authority.

The new code is in new modules: evidence_scope.py, evidence_basis.py and tx/api_readback.py. No size or import budget was raised.

Compatibility with #2476 (verdict kernel)

git merge-tree against claude/fail-open-general conflicts only in packages/flow/CHANGELOG.md, and the verify_run.py hunks are disjoint. I ran #2476's check_verdict_folds.py on the merged tree, and this branch adds no folds. The only increase is says_success in hooks/cli.py and hooks/engine.py. That code is already on main, so #2476 needs to refresh its baseline either way.

Tests

Run with the CPU slot runner:

  • packages/types/tests: 845 passed.
  • packages/flow/tests, the tx, hooks, execute, receipt, seal, countersign, verify-run, one-ladder, readback and check-level files: 1166 passed, 8 skipped, 3 failed.
    • Two of the failures are in test_hooks_e2e.py (invalid_write_evidence from receipt_record._write_lines). They fail the same way on a clean origin/main (e754d56).
    • The third, test_tx_atomic_authority.py::test_http_redirects_cannot_change_endpoint_method_or_forward_credentials, was a connection reset under load. It passed 3 of 3 times when rerun.
  • Launcher: tests/test_cli_seal.py, test_quickstart.py, test_quickstart_lifecycle.py and test_quickstart_command.py: 117 passed, 2 skipped.
  • ruff check passed and ruff format --check was clean.

tests/test_one_ladder.py checks that the same evidence gets the same level, word and basis on every path: the runtime report, verify-run, tx, Execute v1 and the run receipt. Tests that expected UNCERTAIN for a version-checked API read now expect CONFIRMED with basis system_api. test_oracle.py now expects an Execute receipt that opted in to independent_session to validate as verified at tier 1. It still can't mint a production Seal.

Not in this PR

  • Provenance grading for local file, PDF and email checks.
  • The wording in THREAT_MODEL.md.
  • Website copy.

The Cloud and website TypeScript receipt verifiers must accept the optional predicate.evidence_scope (shared vectors) before a release ships receipts that carry it.

# Conflicts:
#	CAPABILITIES.md
#	llms-full.txt
#	packages/flow/CHANGELOG.md
…adder

Run receipts (record/run/v1) carry the optional evidence_scope block; a
receipt without it keeps its canonical bytes and still verifies. A run
receipt never says VERIFIED below check level 3. Fake-verifier verify-run
tests now take a baseline so the frame is judged. tx tests that expected
UNCERTAIN for a cache-bypassed, version-checked API read now expect
CONFIRMED with basis system_api; undo still needs the row authority.
# Conflicts:
#	packages/flow/openadapt_flow/receipt_record.py
#	packages/types/openadapt_types/receipt.py
@abrichr

abrichr commented Nov 22, 2026 •

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 6140966

Gemini run on 6140966 (gemini-3.1-pro-preview). Header corrected: this review was produced by Gemini, not Codex.

Note: the Codex CLI stopped before reviewing because its account hit a usage limit (retry possible from Nov 27). As the review procedure allows, the review was run on Gemini (gemini-3.1-pro-preview) instead. Gemini had no repository access. It received the full diff against origin/main (without llms-full.txt) and the complete post-change text of every changed non-test Python file. It was asked for blockers only: correctness, fail-open paths, security, broken or vacuous tests, and claims not backed by code. Everything else was out of scope.

Summary of the review

Gemini found no blockers:

  • The single ladder in check_level.py maps evidence to the right word and basis.
  • A tx API read-back gives basis system_api only with a cache bypass and a version exactly one past the before-image. Anything else stays UNCERTAIN.
  • ExecuteEvidenceReceiptV1 validation still enforces the tier-2 floor. The only exception is a contract that opts into an independent_session minimum, which then yields separate_session.
  • The fallback and downgrade paths fail closed.

The review was short and gave no file-level findings.

VERDICT: APPROVE

This branch has not been deployed

No deployments
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