Skip to content

[anneal] Harden .olean replay keys, vacuity lints, and capture opts - #4262

Open
mdittmer wants to merge 1 commit into
mainfrom
trust-ux/pr2-olean-vacuity-guards
Open

mdittmer wants to merge 1 commit into
mainfrom
trust-ux/pr2-olean-vacuity-guards

Conversation

@mdittmer

@mdittmer mdittmer commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Complement #4176 with defense-in-depth TCB checks across capture, audit, spec vacuity linting, and guard-mutation coverage:

  • anneal-rustc-capture: pass and require -Zmir-opt-level=0 alongside -Zmir-preserve-ub in run and validate_profile_options, and document it in docs/{build-systems-and-receipts,alpha}.md and pass_order_sentinel.rs.
  • TrustedBoundary.lean:
    • enforce checked-environment key parity and non-anonymity at import (verifyCheckedEnvKeys in finalizeImportedEnv), reject intra-module duplicate or misindexed declarations via verifyModuleHeaderInventory, and reject anonymous declaration names in proofExport target inventories;
    • reject key mismatches, base-environment shadowing, and post-replay declaration omission alongside mutual all, constructor, and recursor invariants in validateReplayMap and replayKernelEnv (with hasNoDuplicateNames), and require full header parity across imports and alternates (sameConstantShape, RecursorVal.all, and shared sameUnsafeRecHeader);
    • check authority edges on both stored and ci for subsumed .foundation, .sysrootFoundation, and .source alternates across Pass 1, Pass 2, and targetAudit; under --allow-sorry-in-proof, record sorry-bearing .source .proof alternates in sorryDecls and axioms, keep their non-sorryAx dependencies in phase2Roots, verify every alternate theorem body (including sorryAx-bearing .source .proof alternates, plus phase2Roots when idx == 0) via checkAlternateProofs, and reject any sorry alternate reaching phase1Closure;
    • require every checked constant with .foundation or .sysrootFoundation provenance to appear in its origin module's inventory, require target .source and proofExport constants with .library provenance to appear in that library's inventory, reject repository constants shadowing vendor or sysroot declarations in correspondence-audit (replayCorrAndVendor) before the !replayRepo early return, and reject kernel declarations colliding with IR-only extraConstNames entries across Pass 1, Pass 2, and targetAudit (including proofExport).
  • inspectSpecVacuity / cargo-anneal: fix Trusted.MirSemantics.* and BitVec/Option/Exists/Fin (k + 1) domain matching, unify ordering checks on WHNF Nat.le (decideNatLe?), guard OfNat.ofNat on canonical Nat, fall back to body#<idx> when an unsafe Body has an empty identity string, emit explicit vacuity_check_truncated warnings with cause across Specs and SpecsV2 program/body extraction (registered in target.rs), and add unit and E2E coverage across target_audit, boundary_audit, and suite.
  • check_guard_mutation.py: add 12 audit_boundary guards covering spec-preflight and target-audit including foundation propext subsumption (96 total guards on top of main's 84), validate AuditBoundaryGuard.fixture_id statically in validate_catalog_invariants, pin LEAN_PATH="", Lean.Environment, and -j1/-M2048/-s16384 caps in run_lean_forge, add unit/survivor tests in test_check_guard_mutation.py, and align guard-mutation docs and workflow comments.

Authored by an AI agent acting on mdittmer's behalf.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T05:30:05.993033Z 7395a8d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@joshlf

joshlf commented Nov 24, 2026

Copy link
Copy Markdown
Member

Great defense-in-depth TCB hardening — especially enforcing -Zmir-opt-level=0, .olean key parity + header inventory validation, fixing inspectSpecVacuity's Trusted.MirSemantics.* domain matching (which also fixes a pre-existing Trusted.MirModel.Val typo), and adding 12 new audit_boundary guards.

Two quick coordination notes before Gate-2:

  1. Because this modifies anneal/trusted/ (TrustedBoundary.lean, capture.rs, target.rs), could you add a Human review surface summary comment (per anneal/AGENTS.md) so review tracking is bound cleanly to the commit tuple?
  2. Sequencing: This overlaps #4237 (Profile v2, which also touches TrustedBoundary.lean inspectSpecVacuity and check_guard_mutation.py) and #4147 (TrustedBoundary.lean / target_audit.rs). We'll slot #4262 into Gate-2 early in parallel with #4237/#4147 so whichever clears first lands cleanly and the remaining PRs rebase once cleanly on top.

Authored by an AI agent acting on joshlf's behalf.

@joshlf joshlf added the anneal Primary scope: Anneal verification stack (`anneal/` and `exocrate/`) label Nov 24, 2026
@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv) and rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory).
    • Validates mutual all lists and constructor/recursor invariants in
      validateReplayMap (with hasNoDuplicateNames), enforces full constant
      header parity across imports, alternates, and ._unsafe_rec pairs
      (sameConstantShape, RecursorVal.all, sameUnsafeRecHeader), reconciles
      Pass-2 .foundation and .sysrootFoundation inventories/alternates
      (checkSysrootAlternates), and verifies .foundation header inventories
      in targetAudit.
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, and emits explicit vacuity_check_truncated warnings with cause
      across extractCapturedBodies and inspectSpecVacuity.
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub in run and
      requires opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests).
  • TCB CLI target-audit schema & embedded bundle
    (anneal/trusted/cargo-anneal/src/target.rs,
    anneal/trusted/cargo-anneal/src/bundled_resources.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES and
      regenerates the embedded trusted/audit/TrustedBoundary.lean bundle entry.
  • CI guard-mutation harness & unit tests
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (60 total
      guards) covering spec-preflight
      (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
      target-audit (target_audit_reject_{expected_mismatch,theorem_type,
      proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
      unsafe_rec_type_mismatch,foundation_propext_hijack}), pins
      LEAN_PATH="" in run_lean_forge, and adds unit/survivor coverage in
      test_runner_audit_boundary_suite_checks_sanity_and_policy_flip.
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 9/9 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs.
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, .github/workflows/, governing docs, policy/skill files, stated
    user specs, and #[anneal::trusted] waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay invariants, anti-vacuity linting, and
    CI guard-mutation coverage).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple at push is
    (target_base = e05af9265ec8521e8c187dfde4e1bf5650b9d800, merge_base = e05af9265ec8521e8c187dfde4e1bf5650b9d800, head = 195fed2c9f2cb0128f1c0e6de901b72fee1bcf77), with
    parent_tree = d2b7645538b9231489250b7417572e4169a5ac33 and
    tree = 801702fbc218e5dc03ce7e744076d12c304bbabf (clean working tree,
    single linear commit; live main has since advanced to
    83562fd4b51bfa2f56876493f444e6f853da6f73 and will be rebased cleanly for
    Gate 4 once sequenced with #4237 / #4147).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling (ci/check_guard_mutation.py), and Pass 1
    audit/CLI test suites (tests/audit, tests/cargo-anneal). Executed full
    multi-round Pass 1 + Pass 2 (trust-review §§1, 3, 4, 5 and
    change-review, zero skipped steps) because .olean import/replay
    validation, MIR capture flags, and anti-vacuity lints guard the Stage 0
    soundness and diagnostic boundary.
  3. Grouped coverage: All 9/9 changed paths across
    e05af9265ec8..195fed2c9f2c (git diff --raw --no-renames) are
    inspected (0 inapplicable files, 0 blocked; Pass 2 §2
    trusted/lean/ MIR semantics untouched / inapplicable):
    • anneal/trusted/audit/TrustedBoundary.lean (inspected): verified
      verifyCheckedEnvKeys (finalizeImportedEnv),
      verifyModuleHeaderInventory, validateReplayMap +
      hasNoDuplicateNames, sameConstantShape + RecursorVal.all +
      sameUnsafeRecHeader, checkSysrootAlternates, targetAudit
      .foundation inventory check, extractBitVecLit?, decideNatLe?,
      canonical Nat guard on OfNat.ofNat, Trusted.MirSemantics.* +
      BitVec/Option/Exists/Fin (k + 1) domain checks, and
      vacuity_check_truncated reporting in extractCapturedBodies /
      inspectSpecVacuity.
    • anneal/trusted/rustc-capture/src/capture.rs (inspected): verified
      -Zmir-opt-level=0 emission in run, fail-closed check in
      validate_profile_options, and None/Some(1)/Some(2) rejection
      tests.
    • anneal/trusted/cargo-anneal/src/target.rs and
      anneal/trusted/cargo-anneal/src/bundled_resources.rs (inspected):
      verified "vacuity_check_truncated" registration in
      VALID_SPEC_WARNING_CODES and exact embedded TrustedBoundary.lean
      bundle parity.
    • anneal/ci/check_guard_mutation.py and
      anneal/ci/test_check_guard_mutation.py (inspected): verified all 12
      AuditBoundaryGuard specs (60/60 total guards), LEAN_PATH="" pinning
      in run_lean_forge, fail-closed mutant kill classification, and 10/10
      unit/survivor tests.
    • anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (inspected): verified forged-.olean key/inventory/replay/foundation
      propext-hijack rejections and positive/negative anti-vacuity and wide
      body truncation tests
      (rejects_forged_olean_keys_dups_replay_invariants_and_foundation_axiom_hijack,
      target_audit_rejects_key_mismatch_dup_library_and_unsafe_rec_type_mismatch,
      inspect_spec_vacuity_handles_bitvec_option_exists_le_and_fin0,
      inspect_spec_vacuity_checks_bitvec_lt_and_truncation,
      anti_vacuity_lint_reports_truncated_wide_unsafe_body).
  4. Realized capability and isolation: author_family: gemini; multi-round
    pre-push local Gate-1 trust-review and change-review converged across
    two distinct model families (gemini author plus independent fresh-context
    cross-family claude reviewers inspecting from outside the candidate
    worktree); holdout mode: none (zero exposed holdout cases, zero fallbacks
    or un-re-executed checks).
  5. Checks and probes: On frozen commit 195fed2c9f2c:
    • Deterministic preflight: clean tree, git diff --check (exit 0),
      ./ci/check_todo.sh and ./anneal/ci/check_todo.sh (exit 0),
      sha256sum --check --strict trusted/root-manifest.sha256 (4/4 OK), and
      python3 -B -m unittest discover -s ci -p 'test_check_guard_mutation.py'
      (10/10 passed).
    • Two-sided guard-mutation & TCB/E2E suites:
      python3 ci/check_guard_mutation.py (60/60 guards killed, 100.0%),
      cargo test -p anneal-audit-tests --test boundary_audit (58/58) and
      --test target_audit (41/41),
      cargo test -p cargo-anneal-tests --test suite (30/30),
      cargo test -p cargo-anneal (137/137),
      cargo test -p anneal-rustc-capture (44 + 23 + 60), cargo clippy
      (0 warnings), anneal-audit --require-correspondence (PASS: 12,361
      repo / 39,088 Miri / 2,680 correspondence declarations),
      python3 ci/verify_zerocopy.py (4/4), and green GitHub Actions CI on
      195fed2c9f2c (Anneal Tests and Build & Tests).
  6. Findings and blockers: All 3 pre-publication cross-family local review
    rounds resolved prior to push (0 open findings, 0 open trust questions);
    hosted Codex review (codex-review-state:v1 on 195fed2c9f2c) completed
    clean (0 findings); PR description aligned verbatim with the unwrapped
    commit body and prose authorship notice. Ready for Gate 2 review, Gate 4
    rebase sequencing with #4237 and #4147, and pending human approval
    (Gate 5)
    of the Human review surface above.

Authored by an AI agent acting on mdittmer's behalf.

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 1)

  • Identity: multi:a3bdc4f43ce3b993354526116e9269a3658dee5a:195fed2c9f2cb0128f1c0e6de901b72fee1bcf77 (base=a3bdc4f43ce3, head=195fed2c9f2c, tree=801702fbc218)
  • Separation: author_family=gemini vs. reviewer_family=claude
  • Coverage: 9 inspected, 0 inapplicable, 0 blocked (of 9 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed clean 0 657s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed clean 0 2108s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed findings 1 2909s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R1-01 P2 1 (seat3) static_verified anneal/trusted/audit/TrustedBoundary.lean:6275 inspectSpecVacuity emits an empty specWarnings.body string (rejected operationally by Rust report validators) when an unsafe Body carries identity := "".

G2-R1-01 [P2] (anneal/trusted/audit/TrustedBoundary.lean:6275, Pass 2 (trusted/audit/TrustedBoundary.lean <-> trusted/cargo-anneal/src/target.rs), static_verified): inspectSpecVacuity emits an empty specWarnings.body string (rejected operationally by Rust report validators) when an unsafe Body carries identity := "".

  • Invariant: TargetAuditReport validation and Receipt v3 extraction require any present specWarnings[].body field to be non-empty (anneal/trusted/cargo-anneal/src/target.rs:575-580 and anneal/trusted/cargo-anneal/src/verify.rs:2271-2280).
  • Evidence: extractCapturedBodies sets identityText := extractStringLit? env {} identityExpr (anneal/trusted/audit/TrustedBoundary.lean:6105-6109), which evaluates to some "" for a Body with empty identity (Body.identity defaults to "" in Trusted/MirAst/Body.lean:100). Line 6275 computes let bodyLabel := body.identityText.getD s!"body#{idx}", falling back only on none and leaving "" unchanged when some "". Lifting bodyLabel to feed both unsatisfiable_safety (line 6292) and the new wide-body vacuity_check_truncated check (argumentCount > 32, line 6302) emits "body": "" for unsafe empty-identity bodies (e.g., custom/unit TargetAuditRequest fixtures or allowSorryInProof = true targets where Proof does not discharge BodyStaticAdmitted), causing validate_target_audit_report (malformed specWarnings entry with empty body label) and extract_spec_warnings to fail with exit code 2 on an otherwise passing audit.

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R1-A01 [P3] (anneal/ci/check_guard_mutation.py:1092): After rebasing onto target_base, anneal/docs/testing-architecture.md (added after merge_base) still cites 48 guards (44 MirSemantics + 4 header guards) instead of 60 (44 + 4 + 12).
  • G2-R1-A02 [P3] (anneal/docs/alpha.md:76): The Profile v1 docs mention only -Zmir-preserve-ub as enforced during capture; capture now also requires -Zmir-opt-level=0. Similarly, docs/auditing-and-comparator.md does not describe the new boundary guard-mutation suite.
  • G2-R1-A03 [P3] (global): The guard-mutation step comment still describes only the MirSemantics UB guards and TrustedBoundary header-import guards; it does not mention the new audit_boundary suite that now runs under the default suite=all.

Executed Sandbox Probes

  • seat3 sha256sum --check --strict trusted/root-manifest.sha256 (in bwrap): outcome=exit 0; Cargo.toml, Cargo.lock, flake.nix, flake.lock OK
  • seat3 python3 -I -B -m unittest discover -s /work/anneal/ci -p test_check_guard_mutation.py -v (in bwrap): outcome=exit 0; 10/10 tests OK
  • seat3 python3 -I -B /work/anneal/ci/check_guard_mutation.py --anneal-root /work/anneal --list (in bwrap): outcome=exit 0; Total cataloged guards: 60; validate_catalog_invariants passed
  • seat3 rustc --edition 2024 harness including /work/anneal/trusted/cargo-anneal/src/bundled_resources.rs + SHA-256 comparison in bwrap: outcome=exit 0; all 23 BUNDLE entries and CORRESPONDENCE_PROVENANCE_JSON hashes match disk bytes
  • seat3 test_prebuild_bundled_oleans.py, test_check_bundle_tree.py, test_workflow_yaml.py, check_non_stable_version.sh (in bwrap): outcome=exit 0; 4/4 + 3/3 + 9/9 tests OK, version 0.2.0-alpha.10 valid pre-release
  • seat3 git diff --stat merge_base..head -- '.github/workflows/*' + check_actions.sh with mounted action-validator + test_check_guard_mutation workflow check against target_base .github/workflows/anneal-current.yml (in bwrap): outcome=0 workflow files touched in merge_base..head (permissions/triggers/secrets/environments/checkout-SHAs/script-injection/cache-trust/guard-relaxation checklist items 1-8 N/A as unmodified); check_actions.sh exit 0; target_base workflow satisfies guard_mutation step placement
  • seat3 Python probe verifying all 12 AUDIT_BOUNDARY_GUARDS anchors, fixture_id keys, and >80-col comment lines across pr.diff (in bwrap): outcome=exit 0; all 12 anchors & fixture_ids verified; 0 non-URL comment lines >80 cols
  • seat3 rustc + rustc_driver probe compiling toy lib and inspecting config.opts.unstable_opts.mir_opt_level (in bwrap): outcome=exit 0; confirmed -Zmir-preserve-ub alone yields mir_opt_level=None while adding -Zmir-opt-level=0 yields Some(0)
  • seat3 python3 -I -B -m unittest discover -s /work/anneal/ci -p test_ci_workflow.py -v (in bwrap, timeout 30s): outcome=exit 124; first 8 tests passed, timed out at 30s during test_root_override_paths_and_symlinks_fail_closed
  • seat3 bash anneal/ci/check_todo.sh / unittest test_check_todo.py (in bwrap): outcome=exit 127 (rg binary not installed on host); manual scan confirmed 0 TODO markers added in PR
  • seat3 lean -t0 inside bwrap bounded by prlimit --nproc=64: outcome=exit 1 (failed to create thread: Resource temporarily unavailable due to ~1650 active threads on host UID); Lean runtime execution not executed inside bwrap

@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from 195fed2 to 5f5cedd Compare November 24, 2026 20:31
@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv) and rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory).
    • Validates mutual all lists and constructor/recursor invariants in
      validateReplayMap (with hasNoDuplicateNames), enforces full constant
      header parity across imports, alternates, and ._unsafe_rec pairs
      (sameConstantShape, RecursorVal.all, sameUnsafeRecHeader), reconciles
      Pass-2 .foundation and .sysrootFoundation inventories/alternates
      (checkSysrootAlternates), and verifies .foundation header inventories
      in targetAudit (preserving #4229 module-mode target rules and #4236
      decoupled Anneal.MirWp.Canaries checks).
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, falls back to body#<idx> when an unsafe Body carries an empty
      identity string (G2-R1-01), and emits explicit
      vacuity_check_truncated warnings with cause across
      extractCapturedBodies and inspectSpecVacuity.
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub in run (covering
      both standard and #4217 --stdlib-crate capture paths) and requires
      opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests).
  • TCB CLI target-audit schema (anneal/trusted/cargo-anneal/src/target.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES
      (src/bundled_resources.rs stays deleted following #4244, with
      build.rs + trusted_bundle.rs embedding TrustedBoundary.lean from
      canonical workspace sources).
  • CI guard-mutation harness, workflow comment & architecture docs
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py,
    .github/workflows/anneal-current.yml,
    anneal/docs/auditing-and-comparator.md,
    anneal/docs/testing-architecture.md):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (60 total
      guards) covering spec-preflight
      (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
      target-audit (target_audit_reject_{expected_mismatch,theorem_type,
      proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
      unsafe_rec_type_mismatch,foundation_propext_hijack} with #4229
      "isModule": False expectations), pins LEAN_PATH="" in run_lean_forge,
      adds unit/survivor coverage in
      test_runner_audit_boundary_suite_checks_sanity_and_policy_flip, and
      aligns the 60-guard / audit_boundary descriptions across docs and the
      guard_mutation workflow comment (G2-R1-A01, G2-R1-A02, G2-R1-A03;
      anneal/docs/alpha.md is left untouched here to avoid conflicting with
      #4264).
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 11/11 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs.
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, workflow permissions/triggers/pins, governing docs, policy/skill
    files, stated user specs, and #[anneal::trusted] waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay invariants, anti-vacuity linting, and
    CI guard-mutation coverage).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple is
    (target_base = 6d09dbc2ff9845dd39409da1d84291d9683dca3a, merge_base = 6d09dbc2ff9845dd39409da1d84291d9683dca3a, head = 5f5ceddb176ca761729dffc2413406cb93451125), with
    parent_tree = 8aba60a35e1bb8620290aa54500f2c5ed244d038 and
    tree = 164ee02699d76049782b18d61029052733c9072d (clean working tree,
    single linear commit; also verified conflict-free git merge-tree against
    495a4d7cdb42acf9bc12881aa190a7ff840ef6cc and #4263).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling and workflow comment (ci/,
    .github/workflows/anneal-current.yml), and Pass 1 docs and audit/CLI test
    suites (docs/, tests/audit, tests/cargo-anneal). Executed full
    Pass 1 + Pass 2 (trust-review §§2, 3, 5 and change-review) across both
    initial authoring and the 6d09dbc2ff98 rebase + G2-R1-01 repair.
  3. Grouped coverage: All 11/11 changed paths across
    6d09dbc2ff98..5f5ceddb176c (git diff --raw --no-renames) are inspected
    (0 inapplicable files, 0 blocked; Pass 2 §1 trusted/lean/ and §4
    pinned manifests untouched / inapplicable):
    • anneal/trusted/audit/TrustedBoundary.lean (inspected): verified
      verifyCheckedEnvKeys (finalizeImportedEnv),
      verifyModuleHeaderInventory, validateReplayMap +
      hasNoDuplicateNames, sameConstantShape + RecursorVal.all +
      sameUnsafeRecHeader, checkSysrootAlternates, targetAudit
      .foundation inventory check + #4229 validateTargetImports merge,
      #4236 verifyMirWpCoreTheorems preservation, extractBitVecLit?,
      decideNatLe?, canonical Nat guard on OfNat.ofNat,
      Trusted.MirSemantics.* + BitVec/Option/Exists/Fin (k + 1) domain
      checks, G2-R1-01 empty-identity body#<idx> fallback, and
      vacuity_check_truncated reporting.
    • anneal/trusted/rustc-capture/src/capture.rs (inspected): verified
      -Zmir-opt-level=0 emission in run across standard and --stdlib-crate
      paths, fail-closed check in validate_profile_options, and
      None/Some(1)/Some(2) rejection tests.
    • anneal/trusted/cargo-anneal/src/target.rs (inspected): verified
      "vacuity_check_truncated" registration in VALID_SPEC_WARNING_CODES and
      #4244 build.rs bundle integration.
    • anneal/ci/check_guard_mutation.py,
      anneal/ci/test_check_guard_mutation.py, and
      .github/workflows/anneal-current.yml (inspected): verified all 12
      AuditBoundaryGuard specs (60/60 total guards, "isModule": False),
      LEAN_PATH="" pinning in run_lean_forge, 10/10 unit/survivor tests,
      and comment-only workflow update preserving all CI gates, permissions, and
      SHA pins.
    • anneal/docs/auditing-and-comparator.md,
      anneal/docs/testing-architecture.md,
      anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (inspected): verified 60-guard / audit_boundary doc alignment,
      forged-.olean key/inventory/replay/foundation propext-hijack
      rejections, G2-R1-01 empty-identity body#0/body#1 warning
      regression test, and wide-body truncation E2E coverage.
  4. Realized capability and isolation: author_family: gemini; local Gate-1
    trust-review and change-review converged across two distinct model
    families (gemini author plus independent fresh-context cross-family
    claude reviewer running read-only from the clean base checkout outside the
    candidate worktree); holdout mode: none (zero exposed holdout cases).
  5. Checks and probes: On frozen commit 5f5ceddb176c:
    • Deterministic preflight: clean tree, git diff --check (exit 0),
      ./ci/check_todo.sh and ./anneal/ci/check_todo.sh (exit 0),
      python3 -B ./ci/check_skills.py (exit 0),
      sha256sum --check --strict trusted/root-manifest.sha256 (4/4 OK), and
      non-yq anneal/ci/test_*.py unittests (149/149 passed, including
      10/10 in test_check_guard_mutation.py).
    • Two-sided guard-mutation & TCB/E2E suites:
      python3 -B ci/check_guard_mutation.py --jobs 4 (60/60 guards killed,
      100.0%), anneal-audit --require-correspondence (PASS: 19 Trusted,
      86 Theory, 14,982 replayed, 39,088 Miri, 2,680 correspondence
      declarations), cargo clippy --locked --all-targets -- -D warnings (0
      warnings), cargo check --locked -p cargo-anneal --no-default-features,
      cargo test --locked -p anneal-audit -p cargo-anneal --lib (12/12 +
      176/176), cargo test --locked -p anneal-rustc-capture -p anneal-rustc-capture-tests (48 + 23 + 7 + 60, including live
      stdlib_capture verbatim core), cargo test --locked -p anneal-audit-tests (cli_environment 4/4, target_audit 42/42,
      boundary_audit 61/61), and cargo test --locked -p cargo-anneal-tests
      (cli 28/28, harness 7/7, sandbox_escape 7/7, suite 30/30,
      support_* 35/35).
  6. Findings and blockers: Local cross-family review on 5f5ceddb176c
    completed with VERDICT: PASS (0 blocking, 0 substantive, 0 open
    trust questions). Gate 2 Round 1 finding G2-R1-01 [P2] is resolved in
    TrustedBoundary.lean (bodyLabel empty-string fallback to body#<idx>)
    with regression coverage in target_audit.rs
    (inspect_spec_vacuity_checks_bitvec_lt_and_truncation case 4), and P3
    advisories G2-R1-A01, G2-R1-A02 (auditing-and-comparator.md), and
    G2-R1-A03 are addressed (docs/alpha.md sequenced after #4264).
    Ready for Gate 2 re-review and pending human approval (Gate 5) of the
    Human review surface above.

Authored by an AI agent acting on mdittmer's behalf.

@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

Authored by an AI agent acting on mdittmer's behalf.

@codecov-commenter

codecov-commenter commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.99%. Comparing base (e7aab12) to head (b890614).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4262   +/-   ##
=======================================
  Coverage   92.99%   92.99%           
=======================================
  Files          16       16           
  Lines        2469     2469           
=======================================
  Hits         2296     2296           
  Misses        173      173           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 5f5ceddb17

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from 5f5cedd to 5b495af Compare November 24, 2026 23:10
@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv) and rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory).
    • Validates mutual all lists and constructor/recursor invariants in
      validateReplayMap (with hasNoDuplicateNames), enforces full constant
      header parity across imports, alternates, and ._unsafe_rec pairs
      (sameConstantShape, RecursorVal.all, sameUnsafeRecHeader), reconciles
      Pass-2 .foundation and .sysrootFoundation inventories/alternates
      (checkSysrootAlternates), and verifies .foundation header inventories
      in targetAudit (preserving #4229 module-mode target rules and #4236
      decoupled Anneal.MirWp.Canaries checks).
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, falls back to body#<idx> when an unsafe Body carries an empty
      identity string (G2-R1-01), and emits explicit
      vacuity_check_truncated warnings with cause across
      extractCapturedBodies and inspectSpecVacuity.
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub in run (covering
      both standard and #4217 --stdlib-crate capture paths) and requires
      opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests).
  • TCB CLI target-audit schema (anneal/trusted/cargo-anneal/src/target.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES
      (src/bundled_resources.rs stays deleted following #4244, with
      build.rs + trusted_bundle.rs embedding TrustedBoundary.lean from
      canonical workspace sources).
  • CI guard-mutation harness, workflow comment & architecture docs
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py,
    .github/workflows/anneal-current.yml,
    anneal/docs/auditing-and-comparator.md,
    anneal/docs/testing-architecture.md):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (60 total
      guards) covering spec-preflight
      (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
      target-audit (target_audit_reject_{expected_mismatch,theorem_type,
      proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
      unsafe_rec_type_mismatch,foundation_propext_hijack} with #4229
      "isModule": False expectations), pins LEAN_PATH="" in run_lean_forge,
      adds unit/survivor coverage in
      test_runner_audit_boundary_suite_checks_sanity_and_policy_flip, and
      aligns the 60-guard / audit_boundary descriptions across docs and the
      guard_mutation workflow comment (G2-R1-A01, G2-R1-A02, G2-R1-A03;
      anneal/docs/alpha.md is left untouched here to avoid conflicting with
      #4264).
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 11/11 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs.
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, workflow permissions/triggers/pins, governing docs, policy/skill
    files, stated user specs, and #[anneal::trusted] waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay invariants, anti-vacuity linting, and
    CI guard-mutation coverage).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple is
    (target_base = 3e6637aa447b340ba99a57c8fa05a266b9e0c699, merge_base = 3e6637aa447b340ba99a57c8fa05a266b9e0c699, head = 5b495af03a6e57b7ebf6ec416b18cbba65df20e4), with
    parent_tree = df8dc6fbcb8c3b0dc5da4204d4bc07ae1d073f7e and
    tree = 76a6a61398e02953da57cea11d4c1402d762cced (clean working tree,
    single linear commit rebased onto origin/main after #4079 and #4107).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling and workflow comment (ci/,
    .github/workflows/anneal-current.yml), and Pass 1 docs and audit/CLI test
    suites (docs/, tests/audit, tests/cargo-anneal). Executed full
    Pass 1 + Pass 2 (trust-review §§2, 3, 5 and change-review) on
    5f5ceddb176c plus a Class-2 range-diff review across the rebase onto
    3e6637aa447b (10/11 files hunk-identical to 5f5ceddb176c; only the
    adjacent Tier 2 context row in anneal/docs/testing-architecture.md
    updated for #4107).
  3. Grouped coverage: All 11/11 changed paths across
    3e6637aa447b..5b495af03a6e (git diff --raw --no-renames) are inspected
    (0 inapplicable files, 0 blocked; Pass 2 §1 trusted/lean/ and §4
    pinned manifests untouched / inapplicable):
    • anneal/trusted/audit/TrustedBoundary.lean (inspected): verified
      verifyCheckedEnvKeys (finalizeImportedEnv),
      verifyModuleHeaderInventory, validateReplayMap +
      hasNoDuplicateNames, sameConstantShape + RecursorVal.all +
      sameUnsafeRecHeader, checkSysrootAlternates, targetAudit
      .foundation inventory check + #4229 validateTargetImports merge,
      #4236 verifyMirWpCoreTheorems preservation, extractBitVecLit?,
      decideNatLe?, canonical Nat guard on OfNat.ofNat,
      Trusted.MirSemantics.* + BitVec/Option/Exists/Fin (k + 1) domain
      checks, G2-R1-01 empty-identity body#<idx> fallback, and
      vacuity_check_truncated reporting.
    • anneal/trusted/rustc-capture/src/capture.rs (inspected): verified
      -Zmir-opt-level=0 emission in run across standard and --stdlib-crate
      paths, fail-closed check in validate_profile_options, and
      None/Some(1)/Some(2) rejection tests.
    • anneal/trusted/cargo-anneal/src/target.rs (inspected): verified
      "vacuity_check_truncated" registration in VALID_SPEC_WARNING_CODES and
      #4244 build.rs bundle integration.
    • anneal/ci/check_guard_mutation.py,
      anneal/ci/test_check_guard_mutation.py, and
      .github/workflows/anneal-current.yml (inspected): verified all 12
      AuditBoundaryGuard specs (60/60 total guards, "isModule": False),
      LEAN_PATH="" pinning in run_lean_forge, 10/10 unit/survivor tests,
      and comment-only workflow update preserving #4079 + #4107 CI gates,
      anneal/ci/run_anneal_check.sh guard-mutation step compatibility,
      permissions, and SHA pins.
    • anneal/docs/auditing-and-comparator.md,
      anneal/docs/testing-architecture.md,
      anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (inspected): verified 60-guard / audit_boundary doc alignment and
      #4107 Tier 2 table merge, forged-.olean key/inventory/replay/
      foundation propext-hijack rejections, G2-R1-01 empty-identity
      body#0/body#1 warning regression test, and wide-body truncation E2E
      coverage.
  4. Realized capability and isolation: author_family: gemini; local Gate-1
    trust-review, change-review, and post-rebase range-diff verification
    converged across two distinct model families (gemini author plus
    independent fresh-context cross-family claude reviewer running read-only
    outside the candidate worktree); holdout mode: none (zero exposed holdout
    cases).
  5. Checks and probes:
    • Fresh Class-2 rebase delta checks on 5b495af03a6e57b7ebf6ec416b18cbba65df20e4:
      clean tree, git diff --check (exit 0), sha256sum --check --strict trusted/root-manifest.sha256 (4/4 OK), ./anneal/ci/check_actions.sh,
      ./ci/check_actions.sh, ./ci/scripts/check_shell_and_hooks.sh,
      ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, and python3 -B ./ci/check_skills.py (all exit 0), PYTHONPATH=anneal/ci python3 -B -m unittest test_ci_workflow test_run_anneal_check test_check_guard_mutation
      (34/34 OK), and cargo check --locked --workspace (exit 0).
    • Full two-sided guard-mutation & TCB/E2E suites bound to 5f5ceddb176c
      (git range-diff 6d09dbc2ff98..5f5ceddb176c 3e6637aa447b..5b495af03a6e
      alters zero Rust, Lean, Python, or workflow lines — only the adjacent
      Tier 2 table row in anneal/docs/testing-architecture.md from #4107):
      python3 -B ci/check_guard_mutation.py --jobs 4 (60/60 guards killed,
      100.0%), anneal-audit --require-correspondence (PASS: 19 Trusted,
      86 Theory, 14,982 replayed, 39,088 Miri, 2,680 correspondence
      declarations), cargo clippy --locked --all-targets -- -D warnings (0
      warnings), cargo check --locked -p cargo-anneal --no-default-features,
      cargo test --locked -p anneal-audit -p cargo-anneal --lib (12/12 +
      176/176), cargo test --locked -p anneal-rustc-capture -p anneal-rustc-capture-tests (48 + 23 + 7 + 60, including live
      stdlib_capture verbatim core), cargo test --locked -p anneal-audit-tests (cli_environment 4/4, target_audit 42/42,
      boundary_audit 61/61), and cargo test --locked -p cargo-anneal-tests
      (cli 28/28, harness 7/7, sandbox_escape 7/7, suite 30/30,
      support_* 35/35).
  6. Findings and blockers: Local cross-family review on 5b495af03a6e
    completed with VERDICT: PASS (0 blocking, 0 substantive, 0 open
    trust questions). Gate 2 Round 1 finding G2-R1-01 [P2] and advisories
    G2-R1-A01..A03 remain resolved across the rebase. Ready for Gate 2
    re-review and pending human approval (Gate 5) of the
    Human review surface above.

Authored by an AI agent acting on mdittmer's behalf.

@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 5b495af03a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 2)

  • Identity: one:df8dc6fbcb8c3b0dc5da4204d4bc07ae1d073f7e:76a6a61398e02953da57cea11d4c1402d762cced:677482dc7420d85288914581c4ff6e40ceb3e89236771848790bb7dd90fe0c44 (base=3e6637aa447b, head=5b495af03a6e, tree=76a6a61398e0)
  • Separation: author_family=gemini vs. reviewer_family=claude
  • Coverage: 11 inspected, 0 inapplicable, 0 blocked (of 11 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed clean 0 789s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed findings 2 1273s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed clean 0 1421s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R2-01 P1 1 (seat2) static_verified anneal/trusted/audit/TrustedBoundary.lean:6675 targetAudit's .foundation subsumesInfo alternate reconciliation checks TargetOrigin.edgeViolation? only on the unmodified foundation declaration ci, never on the overriding stored theorem.
G2-R2-02 P2 1 (seat2) static_verified anneal/trusted/audit/TrustedBoundary.lean:3818 Foundation and sysroot extraConstNames IR-helper collisions allow non-foundation modules to slip un-replayed ill-typed .thmInfo declarations past audit and misattribute proofExport constants to .foundation in targetAudit.

G2-R2-01 [P1] (anneal/trusted/audit/TrustedBoundary.lean:6675, Pass 2 §3 (trusted/audit), static_verified): targetAudit's .foundation subsumesInfo alternate reconciliation checks TargetOrigin.edgeViolation? only on the unmodified foundation declaration ci, never on the overriding stored theorem.

  • Invariant: TargetOrigin.edgeViolation? (lines 450-462) prohibits .foundation and .library declarations from referencing .source declarations and enforces TargetRole.allows across target roles; meaning-surface closures (expectedReached, subjectClosure, modelClosure, specClosure) must not pull in forbidden-role declarations through a hijacked .foundation entry.
  • Evidence: When a .library .olean (exempt from reservedKernelRoots) or a .source .olean (for a realized helper admitted by isRealizedOrCompilerHelper) exports a .thmInfo with the same header as a .foundation theorem (e.g., Iff.refl) and a differing proof body referencing a .source declaration (even a TargetRole::Proof constant from proofExport), Lean's finalizeImport keeps const2ModIdx mapped to .foundation while overwriting env.checked.get[name] with stored via subsumesInfo. targetAudit's new .foundation loop (lines 6488-6492) pushes (none, stored, ci) into pendingSourceAlternates. At lines 6671-6690, pendingSourceAlternates sets altOrigin := .foundation (line 6674) but runs declarationEdges and TargetOrigin.edgeViolation? only on ci (line 6675, the untouched .foundation copy), then enqueues stored's dependencies into phase2Roots at line 6701 with no edge check. In runTargetClosurePhase (lines 4813-4833), libraryExports compares lookup n (stored) against exportedCi (stored), so inventoryAlternates returns #[] and skips line 4827. In the post-closure loop (line 6753), role == .foundation skips edgeViolation? entirely. checkAlternateProofs then validates stored in replayed (which contains phase2Roots), so targetAudit exits 0 while violating TargetOrigin.edgeViolation? (and allowing .source overrides of realized foundation theorems to pollute subjectClosure/modelClosure/specClosure via lookup at lines 6745 and 6830-6832). Contrast with Pass 2's checkSysrootAlternates (lines 3788-3803), which checks both stored and ci.

G2-R2-02 [P2] (anneal/trusted/audit/TrustedBoundary.lean:3818, Pass 2 §3 (trusted/audit), static_verified): Foundation and sysroot extraConstNames IR-helper collisions allow non-foundation modules to slip un-replayed ill-typed .thmInfo declarations past audit and misattribute proofExport constants to .foundation in targetAudit.

  • Invariant: Every declaration serialized in an audited .repo or .source .olean must be inventoried and kernel-checked (via replay or checkAlternateProofs), and targetAudit's originOf must never misclassify a proofExport constant as .foundation.
  • Evidence: Lean v4.34.1 Init.* foundation modules record compiler IR-only helpers in data.extraConstNames that are absent from data.constants (1,911 non-reservedKernelRoots names in Init.Data.List.Basic's closure, such as mixHash._boxed in Init.Prelude). finalizeImport populates const2ModIdx with .foundation origin for extraConstNames while leaving env.checked.get.constants empty for those names. If a later .repo (Pass 1/Pass 2) or .source (targetAudit) .olean defines a .thmInfo (even an ill-typed False := True.intro) with such a name, finalizeImport inserts it into env.checked.get without collision while keeping const2ModIdx pinned to .foundation. The new Pass 2 extraConstNames checks (lines 3818-3821, 3839-3842, matching Pass 1 lines 3429-3432) only check origRole without rejecting (env.checked.get.find? n).isSome when n was absent from foundation/sysroot data.constants, and targetAudit's new .foundation loop (lines 6480-6492) does not check extraConstNames at all. Consequently, collectRepoModuleConstants (lines 2932-2947) and targetAudit's .source loop (lines 6545-6549) treat stored == ci as a matching realized theorem (inventoryAlternates returns #[]) and exit 0 without adding it to locals, specAllConsts, or alternateProofs. In targetAudit's proofExport loop (lines 6579-6602), a proof constant under such a name passes env.checked.get.find? == none and is then classified as .foundation by originOf (line 6596 checks env.getModuleIdxFor? before proofOrigins), skipping ensureReplayableConstant and TargetOrigin.edgeViolation? at line 6753 (bounded to P2 because fresh replay onto base still rejects any replayed theorem that references the missing constant).

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R2-A01 [P3] (anneal/trusted/audit/TrustedBoundary.lean:6485): The new targetAudit .foundation arm checks constants but not data.extraConstNames provenance, unlike the new correspondence .foundation and .sysrootFoundation arms.
  • G2-R2-A02 [P3] (anneal/trusted/rustc-capture/src/capture.rs:2106): The rewritten comment drops the base note that -Zmir-preserve-ub's help text claims to imply -Zmir-opt-level=0 (it does not), and the remove_place_mention citation does not support the new statement that MIR passes check mir_opt_level.

Executed Sandbox Probes

  • seat3 repo_hygiene_git_tree_and_modes: outcome=passed
  • seat3 workflow_checklist_1_permissions: outcome=passed
  • seat3 workflow_checklist_2_triggers: outcome=passed
  • seat3 workflow_checklist_3_secrets_containment: outcome=passed
  • seat3 workflow_checklist_4_release_env_protection: outcome=passed
  • seat3 workflow_checklist_5_checkout_and_sha_pinning: outcome=passed
  • seat3 workflow_checklist_6_script_injection: outcome=passed
  • seat3 workflow_checklist_7_cache_artifact_trust: outcome=passed
  • seat3 workflow_checklist_8_no_guard_relaxation: outcome=passed
  • seat3 bwrap_trusted_boundary_compile: outcome=passed
  • seat3 bwrap_python_unittest_check_guard_mutation: outcome=passed
  • seat3 bwrap_real_lean_audit_boundary_guard_mutation: outcome=passed
  • seat3 bwrap_vacuity_linter_11_probes: outcome=passed
  • seat3 bwrap_olean_replay_and_correspondence_18_probes: outcome=passed
  • seat3 bwrap_rustc_preserve_ub_probe: outcome=passed
  • seat3 docs_links_and_counts: outcome=passed

@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from 5b495af to b890614 Compare November 25, 2026 02:14
@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv) and rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory).
    • Validates mutual all lists and constructor/recursor invariants in
      validateReplayMap (with hasNoDuplicateNames), enforces full constant
      header parity across imports, alternates, and ._unsafe_rec pairs
      (sameConstantShape, RecursorVal.all, sameUnsafeRecHeader), checks
      authority edges on both stored and ci across Pass-1 .foundation
      alternates (verifyAndCollectLocals), Pass-2 .foundation and
      .sysrootFoundation alternates (checkSysrootAlternates), and Phase-4
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin), and
      rejects kernel declarations colliding with IR-only extraConstNames
      entries across Pass 1, Pass 2, and targetAudit (including proofExport,
      preserving #4229 module-mode target rules and #4236 decoupled
      Anneal.MirWp.Canaries checks).
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, falls back to body#<idx> when an unsafe Body carries an empty
      identity string, and emits explicit vacuity_check_truncated warnings
      with cause across extractCapturedBodies and inspectSpecVacuity.
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub in run (covering
      both standard and #4217 --stdlib-crate capture paths) and requires
      opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests).
  • TCB CLI target-audit schema (anneal/trusted/cargo-anneal/src/target.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES
      (src/bundled_resources.rs stays deleted following #4244, with
      build.rs + trusted_bundle.rs embedding TrustedBoundary.lean from
      canonical workspace sources).
  • CI guard-mutation harness, workflow comment & architecture docs
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py,
    .github/workflows/anneal-current.yml,
    anneal/docs/auditing-and-comparator.md,
    anneal/docs/testing-architecture.md):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (60 total
      guards) covering spec-preflight
      (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
      target-audit (target_audit_reject_{expected_mismatch,theorem_type,
      proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
      unsafe_rec_type_mismatch,foundation_propext_hijack} with #4229
      "isModule": False expectations), pins LEAN_PATH="" in run_lean_forge,
      adds unit/survivor coverage in
      test_runner_audit_boundary_suite_checks_sanity_and_policy_flip, and
      aligns the 60-guard / audit_boundary descriptions across docs and the
      guard_mutation workflow comment (anneal/docs/alpha.md is left untouched
      here to avoid conflicting with #4264).
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 11/11 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs.
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, workflow permissions/triggers/pins, governing docs, policy/skill
    files, stated user specs, and #[anneal::trusted] waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay/alternate/IR-helper invariants,
    anti-vacuity linting, and CI guard-mutation coverage).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple is
    (target_base = e7aab1236fe7b22b73bcc8b85bdb23e1c6064aa8, merge_base = e7aab1236fe7b22b73bcc8b85bdb23e1c6064aa8, head = b890614e31cf64cb22a041763c7ca9767ad05fa4), with
    parent_tree = ef02c5afdf766e45858a4a3afec971bac68e2365 and
    tree = 82457aba6141d47a65f1f1ce3e38cba74cc8f35e (clean working tree,
    single linear commit rebased onto origin/main after #4265, #4286, and
    #4260).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling and workflow comment (ci/,
    .github/workflows/anneal-current.yml), and Pass 1 docs and audit/CLI test
    suites (docs/, tests/audit, tests/cargo-anneal). Executed full
    Pass 1 + Pass 2 (trust-review §§2, 3, 5 and change-review) plus a
    dedicated cross-family delta review of the Round-2 TrustedBoundary.lean,
    target_audit.rs, and boundary_audit.rs updates (5b495af03a6e -> b890614e31cf).
  3. Grouped coverage: All 11/11 changed paths across
    e7aab1236fe7..b890614e31cf (git diff --raw --no-renames) are inspected
    (0 inapplicable files, 0 blocked; Pass 2 §1 trusted/lean/ and §4
    pinned manifests untouched / inapplicable):
    • anneal/trusted/audit/TrustedBoundary.lean (inspected): verified
      verifyCheckedEnvKeys (finalizeImportedEnv),
      verifyModuleHeaderInventory, validateReplayMap +
      hasNoDuplicateNames, sameConstantShape + RecursorVal.all +
      sameUnsafeRecHeader, (stored, ci) authority-edge checks across Pass-1
      verifyAndCollectLocals, Pass-2 checkSysrootAlternates, and
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin),
      extraConstNames IR-helper collision rejection across Pass 1, Pass 2, and
      targetAudit (including .source and proofExport), #4229
      validateTargetImports merge, #4236 verifyMirWpCoreTheorems
      preservation, extractBitVecLit?, decideNatLe?, canonical Nat guard
      on OfNat.ofNat, empty-identity body#<idx> fallback, and
      vacuity_check_truncated reporting.
    • anneal/trusted/rustc-capture/src/capture.rs (inspected): verified
      -Zmir-opt-level=0 emission in run across standard and --stdlib-crate
      paths, fail-closed check in validate_profile_options, and
      None/Some(1)/Some(2) rejection tests.
    • anneal/trusted/cargo-anneal/src/target.rs (inspected): verified
      "vacuity_check_truncated" registration in VALID_SPEC_WARNING_CODES and
      #4244 build.rs bundle integration.
    • anneal/ci/check_guard_mutation.py,
      anneal/ci/test_check_guard_mutation.py, and
      .github/workflows/anneal-current.yml (inspected): verified all 12
      AuditBoundaryGuard specs (60/60 total guards, "isModule": False),
      LEAN_PATH="" pinning in run_lean_forge, 10/10 unit/survivor tests,
      and comment-only workflow update preserving CI gates, permissions, and SHA
      pins.
    • anneal/docs/auditing-and-comparator.md,
      anneal/docs/testing-architecture.md,
      anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (inspected): verified 60-guard / audit_boundary doc alignment,
      forged-.olean key/inventory/replay/foundation propext-hijack
      rejections, .library and .source subsumesInfo foundation alternate
      edge rejections, Pass-1/Pass-2/targetAudit/proofExport
      extraConstNames IR-helper collision rejections, empty-identity
      body#0/body#1 warning regression test, and wide-body truncation E2E
      coverage.
  4. Realized capability and isolation: author_family: gemini; local Gate-1
    trust-review, change-review, and Round-2 delta verification converged
    across two distinct model families (gemini author plus independent
    fresh-context cross-family claude reviewer running read-only outside the
    candidate worktree); holdout mode: none (zero exposed holdout cases).
  5. Checks and probes:
    • Fresh verification on the Round-2 TrustedBoundary.lean + test tree
      (b890614e31cf64cb22a041763c7ca9767ad05fa4 rebased onto e7aab1236fe7,
      with identical TrustedBoundary.lean, target_audit.rs, and
      boundary_audit.rs blobs to the tested tree): clean tree, git diff --check (exit 0), sha256sum --check --strict trusted/root-manifest.sha256 (4/4 OK), ./anneal/ci/check_actions.sh,
      ./ci/check_actions.sh, ./ci/scripts/check_shell_and_hooks.sh,
      ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, and python3 -B ./ci/check_skills.py (all exit 0), PYTHONPATH=anneal/ci python3 -B -m unittest test_ci_workflow test_run_anneal_check test_check_guard_mutation
      (34/34 OK), cargo clippy --locked -p anneal-audit -p cargo-anneal -p anneal-audit-tests --all-targets -- -D warnings (0 warnings), cargo check --locked --workspace (exit 0), cargo test --locked -p anneal-audit-tests --test target_audit (42/42 OK, including all 9
      forged-.olean / subsumesInfo / extraConstNames cases), targeted
      boundary_audit .olean / alternate suites (rejects_forged_olean +
      validates_and_rejects_alternate_foundation_theorem_proofs OK), and
      live anneal-audit --require-correspondence (PASS: 19 Trusted, 86
      Theory, 14,982 replayed, 39,088 Miri, 3,005 correspondence
      declarations).
    • Unchanged capture, cargo-anneal, and full 60/60 guard-mutation suites
      bound to 5f5ceddb176c (capture.rs, target.rs, check_guard_mutation.py,
      and anti_vacuity_and_e2e.rs are 100% hunk-identical): python3 -B ci/check_guard_mutation.py --jobs 4 (60/60 guards killed, 100.0%),
      cargo test --locked -p anneal-rustc-capture -p anneal-rustc-capture-tests
      (48 + 23 + 7 + 60), and cargo test --locked -p cargo-anneal-tests
      (cli 28/28, harness 7/7, sandbox_escape 7/7, suite 30/30,
      support_* 35/35).
  6. Findings and blockers: Both Gate 2 Round 2 inline review threads
    (4688738900 and 4688738908) are resolved with non-vacuous .olean
    regression tests across target_audit.rs and boundary_audit.rs (0
    unresolved review threads). Local cross-family delta review on
    b890614e31cf completed with VERDICT: PASS (0 blocking, 0
    substantive, 0 open trust questions). Ready for Gate 2 re-review and
    pending human approval (Gate 5) of the Human review surface above.

Authored by an AI agent acting on mdittmer's behalf.

@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: b890614e31

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@joshlf

joshlf commented Nov 25, 2026

Copy link
Copy Markdown
Member

Authored by an AI agent acting on joshlf's behalf.

Heads-up: the PR hygiene pre-gate (anneal/ci/check_pr_hygiene.py) flags three comment lines in this head as over 80 columns, which keeps the next review round from starting:

  • anneal/tests/audit/tests/boundary_audit.rs:11719 (83 columns)
  • anneal/tests/audit/tests/boundary_audit.rs:11720 (81 columns)
  • anneal/tests/audit/tests/target_audit.rs:4015 (81 columns)

Rewrapping those comments is enough. This PR is sequenced to merge after #4237 and #4147 because they touch the same files (TrustedBoundary.lean, capture.rs, target.rs), so the rewrap can ride along with the rebase onto them.

@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from b890614 to 3250938 Compare November 25, 2026 05:20
@mdittmer
mdittmer requested a review from jswrenn as a code owner November 25, 2026 05:20
@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv) and rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory).
    • Validates mutual all lists and constructor/recursor invariants in
      validateReplayMap (with hasNoDuplicateNames), enforces full constant
      header parity across imports, alternates, and ._unsafe_rec pairs
      (sameConstantShape, RecursorVal.all, sameUnsafeRecHeader), checks
      authority edges on both stored and ci across Pass-1 .foundation
      alternates (verifyAndCollectLocals), Pass-2 .foundation and
      .sysrootFoundation alternates (checkSysrootAlternates), and Phase-4
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin), and
      rejects kernel declarations colliding with IR-only extraConstNames
      entries across Pass 1, Pass 2, and targetAudit (including proofExport,
      preserving #4229 module-mode target rules and #4236 decoupled
      Anneal.MirWp.Canaries checks).
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, falls back to body#<idx> when an unsafe Body carries an empty
      identity string, and emits explicit vacuity_check_truncated warnings
      with cause across extractCapturedBodies and inspectSpecVacuity.
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub in run (covering
      both standard and #4217 --stdlib-crate capture paths) and requires
      opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests).
  • TCB CLI target-audit schema (anneal/trusted/cargo-anneal/src/target.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES
      (src/bundled_resources.rs stays deleted following #4244, with
      build.rs + trusted_bundle.rs embedding TrustedBoundary.lean from
      canonical workspace sources).
  • CI guard-mutation harness, workflow comment & architecture docs
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py,
    .github/workflows/anneal-current.yml,
    anneal/docs/auditing-and-comparator.md,
    anneal/docs/testing-architecture.md):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (60 total
      guards) covering spec-preflight
      (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
      target-audit (target_audit_reject_{expected_mismatch,theorem_type,
      proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
      unsafe_rec_type_mismatch,foundation_propext_hijack} with #4229
      "isModule": False expectations), pins LEAN_PATH="" in run_lean_forge,
      adds unit/survivor coverage in
      test_runner_audit_boundary_suite_checks_sanity_and_policy_flip, and
      aligns the 60-guard / audit_boundary descriptions across docs and the
      guard_mutation workflow comment (anneal/docs/alpha.md is left untouched
      here to avoid conflicting with #4264).
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 11/11 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs.
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, workflow permissions/triggers/pins, governing docs, policy/skill
    files, stated user specs, and #[anneal::trusted] waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay/alternate/IR-helper invariants,
    anti-vacuity linting, and CI guard-mutation coverage).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple is
    (target_base = 5f003db450e7c5253fe3606f2ebbd3058a34b1b1, merge_base = 5f003db450e7c5253fe3606f2ebbd3058a34b1b1, head = 32509386c738267d0f4ae5609fed1a117d02db0e), with
    parent_tree = f5e443b33016cc299e74032b222282ddb094673b and
    tree = 3a3bcf8071646930e971820da99ba1aa792e8418 (clean working tree,
    single linear commit rebased onto origin/main 5f003db450e7 with comment
    and prose wrapping aligned to <= 80 columns).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling and workflow comment (ci/,
    .github/workflows/anneal-current.yml), and Pass 1 docs and audit/CLI test
    suites (docs/, tests/audit, tests/cargo-anneal). Executed full
    Pass 1 + Pass 2 (trust-review §§2, 3, 5 and change-review), dedicated
    cross-family delta review of the Round-2 TrustedBoundary.lean,
    target_audit.rs, and boundary_audit.rs updates (5b495af03a6e -> b890614e31cf), and rebase + comment-wrap verification (b890614e31cf -> 32509386c738, where git range-diff modifies only comment/prose line
    wrapping across boundary_audit.rs, target_audit.rs,
    check_guard_mutation.py, and testing-architecture.md).
  3. Grouped coverage: All 11/11 changed paths across
    5f003db450e7..32509386c738 (git diff --raw --no-renames) are inspected
    (0 inapplicable files, 0 blocked; Pass 2 §1 trusted/lean/ and §4
    pinned manifests untouched / inapplicable):
    • anneal/trusted/audit/TrustedBoundary.lean (inspected): verified
      verifyCheckedEnvKeys (finalizeImportedEnv),
      verifyModuleHeaderInventory, validateReplayMap +
      hasNoDuplicateNames, sameConstantShape + RecursorVal.all +
      sameUnsafeRecHeader, (stored, ci) authority-edge checks across Pass-1
      verifyAndCollectLocals, Pass-2 checkSysrootAlternates, and
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin),
      extraConstNames IR-helper collision rejection across Pass 1, Pass 2, and
      targetAudit (including .source and proofExport), #4229
      validateTargetImports merge, #4236 verifyMirWpCoreTheorems
      preservation, extractBitVecLit?, decideNatLe?, canonical Nat guard
      on OfNat.ofNat, empty-identity body#<idx> fallback, and
      vacuity_check_truncated reporting (blob identical to b890614e31cf).
    • anneal/trusted/rustc-capture/src/capture.rs (inspected): verified
      -Zmir-opt-level=0 emission in run across standard and --stdlib-crate
      paths, fail-closed check in validate_profile_options, and
      None/Some(1)/Some(2) rejection tests (blob identical to
      b890614e31cf).
    • anneal/trusted/cargo-anneal/src/target.rs (inspected): verified
      "vacuity_check_truncated" registration in VALID_SPEC_WARNING_CODES and
      #4244 build.rs bundle integration (blob identical to b890614e31cf).
    • anneal/ci/check_guard_mutation.py,
      anneal/ci/test_check_guard_mutation.py, and
      .github/workflows/anneal-current.yml (inspected): verified all 12
      AuditBoundaryGuard specs (60/60 total guards, "isModule": False),
      LEAN_PATH="" pinning in run_lean_forge, 10/10 unit/survivor tests,
      <= 80-column module docstring wrap, and comment-only workflow update
      preserving CI gates, permissions, and SHA pins.
    • anneal/docs/auditing-and-comparator.md,
      anneal/docs/testing-architecture.md,
      anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (inspected): verified 60-guard / audit_boundary doc alignment,
      <= 80-column comment wrapping in boundary_audit.rs and
      target_audit.rs, clean rebase onto #4219's modularized
      boundary_audit.rs, forged-.olean key/inventory/replay/foundation
      propext-hijack rejections, .library and .source subsumesInfo
      foundation alternate edge rejections, Pass-1/Pass-2/targetAudit/
      proofExport extraConstNames IR-helper collision rejections,
      empty-identity body#0/body#1 warning regression test, and wide-body
      truncation E2E coverage.
  4. Realized capability and isolation: author_family: gemini; local Gate-1
    trust-review, change-review, and Round-2 delta verification converged
    across two distinct model families (gemini author plus independent
    fresh-context cross-family claude reviewer running read-only outside the
    candidate worktree); holdout mode: none (zero exposed holdout cases).
  5. Checks and probes:
    • Rebase & comment-wrap delta checks on
      32509386c738267d0f4ae5609fed1a117d02db0e: clean tree, git diff --check
      (exit 0), sha256sum --check --strict trusted/root-manifest.sha256
      (4/4 OK), ./ci/check_todo.sh and ./anneal/ci/check_todo.sh (exit
      0), check_pr_hygiene.py (0 findings, 0 warnings), cargo check --locked --tests -p anneal-audit-tests -p cargo-anneal-tests -p anneal-audit -p cargo-anneal (exit 0), and PYTHONPATH=anneal/ci python3 -B -m unittest test_check_guard_mutation (10/10 OK).
    • Full Round-2 verification on identical logic (b890614e31cf):
      PYTHONPATH=anneal/ci python3 -B -m unittest test_ci_workflow test_run_anneal_check test_check_guard_mutation (34/34 OK), cargo clippy --locked -p anneal-audit -p cargo-anneal -p anneal-audit-tests --all-targets -- -D warnings (0 warnings), cargo test --locked -p anneal-audit-tests --test target_audit (42/42 OK, including all 9
      forged-.olean / subsumesInfo / extraConstNames cases), targeted
      boundary_audit .olean / alternate suites (rejects_forged_olean +
      validates_and_rejects_alternate_foundation_theorem_proofs OK), live
      anneal-audit --require-correspondence (PASS: 19 Trusted, 86
      Theory, 14,982 replayed, 39,088 Miri, 3,005 correspondence
      declarations), ci/check_guard_mutation.py --jobs 4 (60/60 guards
      killed, 100.0%), anneal-rustc-capture (48 + 23 + 7 + 60), and
      cargo-anneal-tests (cli 28/28, harness 7/7, sandbox_escape
      7/7, suite 30/30, support_* 35/35).
  6. Findings and blockers: All 3/3 Gate 2 review threads (4688738900,
    4688738908, and Round 1) are resolved (0 unresolved review threads), and
    the three > 80-column comment lines flagged by check_pr_hygiene.py are
    rewrapped cleanly. Ready for Gate 2 Round 3 review and pending human
    approval (Gate 5)
    of the Human review surface above.

Authored by an AI agent acting on mdittmer's behalf.

@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 32509386c7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from 3250938 to 1ae68cc Compare November 25, 2026 06:03
@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv) and rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory).
    • Validates mutual all lists and constructor/recursor invariants in
      validateReplayMap (with hasNoDuplicateNames), enforces full constant
      header parity across imports, alternates, and ._unsafe_rec pairs
      (sameConstantShape, RecursorVal.all, sameUnsafeRecHeader), checks
      authority edges on both stored and ci across Pass-1 .foundation
      alternates (verifyAndCollectLocals), Pass-2 .foundation and
      .sysrootFoundation alternates (checkSysrootAlternates), and Phase-4
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin),
      keeps all non-sorryAx dependencies of --allow-sorry-in-proof .source .proof alternates in phase2Roots (while tracking altSorryDecls and
      altSorryAxioms), and rejects kernel declarations colliding with IR-only
      extraConstNames entries across Pass 1, Pass 2, and targetAudit
      (including proofExport, preserving #4229 module-mode target rules and
      #4236 decoupled Anneal.MirWp.Canaries checks).
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, falls back to body#<idx> when an unsafe Body carries an empty
      identity string, and emits explicit vacuity_check_truncated warnings
      with cause across extractCapturedBodies and inspectSpecVacuity.
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub in run (covering
      both standard and #4217 --stdlib-crate capture paths) and requires
      opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests).
  • TCB CLI target-audit schema (anneal/trusted/cargo-anneal/src/target.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES
      (src/bundled_resources.rs stays deleted following #4244, with
      build.rs + trusted_bundle.rs embedding TrustedBoundary.lean from
      canonical workspace sources).
  • CI guard-mutation harness, workflow comment & architecture docs
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py,
    .github/workflows/anneal-current.yml,
    anneal/docs/auditing-and-comparator.md,
    anneal/docs/testing-architecture.md):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (60 total
      guards) covering spec-preflight
      (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
      target-audit (target_audit_reject_{expected_mismatch,theorem_type,
      proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
      unsafe_rec_type_mismatch,foundation_propext_hijack} with #4229
      "isModule": False expectations), pins LEAN_PATH="" in run_lean_forge,
      adds unit/survivor coverage in
      test_runner_audit_boundary_suite_checks_sanity_and_policy_flip, and
      aligns the 60-guard / audit_boundary descriptions across docs and the
      guard_mutation workflow comment (anneal/docs/alpha.md is left untouched
      here to avoid conflicting with #4264).
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 11/11 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs.
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, workflow permissions/triggers/pins, governing docs, policy/skill
    files, stated user specs, and #[anneal::trusted] waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay/alternate/IR-helper invariants,
    anti-vacuity linting, and CI guard-mutation coverage).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple is
    (target_base = 5f003db450e7c5253fe3606f2ebbd3058a34b1b1, merge_base = 5f003db450e7c5253fe3606f2ebbd3058a34b1b1, head = 1ae68cc4825c90f6336c50171dbd3c7171a89606), with
    parent_tree = f5e443b33016cc299e74032b222282ddb094673b and
    tree = 722d7af20f9aba4dae0462daea888a01bdeb9c60 (clean working tree,
    single linear commit on origin/main 5f003db450e7).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling and workflow comment (ci/,
    .github/workflows/anneal-current.yml), and Pass 1 docs and audit/CLI test
    suites (docs/, tests/audit, tests/cargo-anneal). Executed full
    Pass 1 + Pass 2 (trust-review §§2, 3, 5 and change-review) plus
    cross-family delta verification on the --allow-sorry-in-proof alternate
    dependency-closure fix (32509386c738 -> 1ae68cc4825c).
  3. Grouped coverage: All 11/11 changed paths across
    5f003db450e7..1ae68cc4825c (git diff --raw --no-renames) are inspected
    (0 inapplicable files, 0 blocked; Pass 2 §1 trusted/lean/ and §4
    pinned manifests untouched / inapplicable):
    • anneal/trusted/audit/TrustedBoundary.lean (inspected): verified
      verifyCheckedEnvKeys (finalizeImportedEnv),
      verifyModuleHeaderInventory, validateReplayMap +
      hasNoDuplicateNames, sameConstantShape + RecursorVal.all +
      sameUnsafeRecHeader, (stored, ci) authority-edge checks across Pass-1
      verifyAndCollectLocals, Pass-2 checkSysrootAlternates, and
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin),
      non-sorryAx phase2Roots seeding + altSorryDecls / altSorryAxioms
      tracking on --allow-sorry-in-proof .source .proof alternates
      (4690751319), extraConstNames IR-helper collision rejection across
      Pass 1, Pass 2, and targetAudit (including .source and proofExport),
      #4229 validateTargetImports merge, #4236 verifyMirWpCoreTheorems
      preservation, extractBitVecLit?, decideNatLe?, canonical Nat guard
      on OfNat.ofNat, empty-identity body#<idx> fallback, and
      vacuity_check_truncated reporting.
    • anneal/trusted/rustc-capture/src/capture.rs (inspected): verified
      -Zmir-opt-level=0 emission in run across standard and --stdlib-crate
      paths, fail-closed check in validate_profile_options, and
      None/Some(1)/Some(2) rejection tests.
    • anneal/trusted/cargo-anneal/src/target.rs (inspected): verified
      "vacuity_check_truncated" registration in VALID_SPEC_WARNING_CODES and
      #4244 build.rs bundle integration.
    • anneal/ci/check_guard_mutation.py,
      anneal/ci/test_check_guard_mutation.py, and
      .github/workflows/anneal-current.yml (inspected): verified all 12
      AuditBoundaryGuard specs (60/60 total guards, "isModule": False),
      LEAN_PATH="" pinning in run_lean_forge, 10/10 unit/survivor tests,
      and comment-only workflow update preserving CI gates, permissions, and SHA
      pins.
    • anneal/docs/auditing-and-comparator.md,
      anneal/docs/testing-architecture.md,
      anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (inspected): verified 60-guard / audit_boundary doc alignment,
      forged-.olean key/inventory/replay/foundation propext-hijack
      rejections, .library and .source subsumesInfo foundation alternate
      edge rejections, --allow-sorry-in-proof .source .proof alternate
      unapproved-axiom and tampered-helper rejections
      (target_audit_allow_sorry_alternate_keeps_non_sorry_deps_in_phase2),
      Pass-1/Pass-2/targetAudit/proofExport extraConstNames IR-helper
      collision rejections, empty-identity body#0/body#1 warning regression
      test, and wide-body truncation E2E coverage.
  4. Realized capability and isolation: author_family: gemini; local Gate-1
    trust-review, change-review, and Round-3 delta verification converged
    across two distinct model families (gemini author plus independent
    fresh-context cross-family claude reviewer running read-only outside the
    candidate worktree); holdout mode: none (zero exposed holdout cases).
  5. Checks and probes:
    • Fresh verification on 1ae68cc4825c90f6336c50171dbd3c7171a89606: clean
      tree, git diff --check (exit 0), sha256sum --check --strict trusted/root-manifest.sha256 (4/4 OK), ./ci/check_todo.sh and
      ./anneal/ci/check_todo.sh (exit 0), check_pr_hygiene.py (0
      findings, 0 warnings), cargo build --locked -p cargo-anneal (exit
      0), cargo test --locked -p anneal-audit-tests --test target_audit -- --exact target_audit_allow_sorry_alternate_keeps_non_sorry_deps_in_phase2
      (1/1 OK), cargo test --locked -p anneal-audit-tests --test target_audit -- --exact target_audit_phase2_allow_sorry_in_proof_tracks_multiple_helpers_and_isolates_phase1
      (1/1 OK), python3 -I -B ci/check_guard_mutation.py --suite audit_boundary --jobs 4 (12/12 guards killed, 100.0%), and
      PYTHONPATH=anneal/ci python3 -B -m unittest test_check_guard_mutation
      (10/10 OK).
    • Full suite baselines on unchanged capture, cargo-anneal, MirSemantics,
      and anneal-audit --require-correspondence surfaces (b890614e31cf):
      target_audit (42/42 OK), boundary_audit .olean/alternate suites
      (OK), anneal-audit --require-correspondence (PASS: 19 Trusted, 86
      Theory, 14,982 replayed, 39,088 Miri, 3,005 correspondence
      declarations), ci/check_guard_mutation.py --jobs 4 (60/60 killed,
      100.0%), anneal-rustc-capture (48 + 23 + 7 + 60), and
      cargo-anneal-tests (cli 28/28, harness 7/7, sandbox_escape
      7/7, suite 30/30, support_* 35/35).
  6. Findings and blockers: All 4/4 Gate 2 review threads (4688738900,
    4688738908, 4690751319, and Round 1) are resolved (0 unresolved review
    threads), and local cross-family delta review on 1ae68cc4825c completed
    with VERDICT: PASS (0 blocking, 0 substantive, 0 open trust
    questions). Ready for Gate 2 re-review and pending human approval
    (Gate 5)
    of the Human review surface above.

Authored by an AI agent acting on mdittmer's behalf.

@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 1ae68cc482

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from 1ae68cc to b8d85fb Compare November 25, 2026 06:09
@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 40d688341d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from 40d6883 to 525c6c1 Compare November 26, 2026 01:22
@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv), rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory), and rejects anonymous declaration names in
      proofExport target inventories.
    • Rejects key mismatches, base-environment shadowing, and post-replay
      declaration omission alongside mutual all, constructor, and recursor
      invariants in validateReplayMap and replayKernelEnv (with
      hasNoDuplicateNames and inline defense-in-depth invariant comments on
      caller-filtered branches), and enforces full header parity across
      imports, alternates, and ._unsafe_rec pairs (sameConstantShape,
      RecursorVal.all, and sameUnsafeRecHeader).
    • Checks authority edges on both stored and ci across Pass-1
      .foundation alternates (verifyAndCollectLocals), Pass-2 .foundation
      and .sysrootFoundation alternates (checkSysrootAlternates), and Phase-4
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin);
      under --allow-sorry-in-proof, records sorry-bearing .source .proof
      alternates in sorryDecls and axioms, keeps their non-sorryAx
      dependencies in phase2Roots, pushes every alternate theorem body
      (including sorryAx-bearing .source .proof alternates, since base
      already declares Init.Prelude.sorryAx, plus p.name into phase2Roots
      when idx == 0) for fresh kernel typechecking via checkAlternateProofs,
      and rejects any sorry alternate reaching phase1Closure.
    • Requires every checked constant with .foundation or .sysrootFoundation
      provenance to appear in its origin module's inventory, requires target
      .source and proofExport constants with .library provenance to appear
      in that library's inventory, rejects repository constants shadowing vendor
      or sysroot declarations in correspondence-audit (replayCorrAndVendor)
      before the !replayRepo early return (even when replayRepo = false),
      rejects kernel declarations colliding with IR-only extraConstNames entries
      across Pass 1, Pass 2, and targetAudit (including proofExport), and
      keeps #4330 Program.mk 6-field reduction checks
      (progArgs.size != 6 returning
      (#[], some "unreducible Captured.program constructor"), preserving
      #4229 module-mode target rules, #4236 decoupled
      Anneal.MirWp.Canaries checks, and #4237 Profile v2 SpecsV2 target
      claims).
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (isKnownInhabitedDomain with constructive
      inhabitance witness comments and extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, falls back to body#<idx> when an unsafe Body carries an empty
      identity string, and emits explicit vacuity_check_truncated warnings
      with cause across extractCapturedBodies and inspectSpecVacuity for both
      Specs and SpecsV2 (shape.specLabel).
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub,
      -Coverflow-checks={yes,no}, and #4359's -Zallow-features= in run
      (covering both standard and --stdlib-crate capture paths), cites the
      exact upstream mir_preserve_ub pass conditions in
      remove_place_mention.rs and simplify.rs (clarifying that
      -Zmir-preserve-ub does not force -Zmir-opt-level=0), and requires
      opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests
      rebased onto #4359's stdlib_crate signature).
  • TCB CLI target-audit schema (anneal/trusted/cargo-anneal/src/target.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES
      (src/bundled_resources.rs stays deleted following #4244, with
      build.rs + trusted_bundle.rs embedding TrustedBoundary.lean from
      canonical workspace sources alongside #4335's Trusted.Framework*
      registrations and #4215 inspect/verdict updates).
  • CI guard-mutation harness, workflow comment & architecture docs
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py,
    .github/workflows/anneal-current.yml,
    anneal/docs/auditing-and-comparator.md,
    anneal/docs/testing-architecture.md):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (96 total
      guards on top of #4266's 84: 80 mir_semantics + 4 audit_headers
      • 12 audit_boundary) covering spec-preflight
        (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
        target-audit (target_audit_reject_{expected_mismatch,theorem_type,
        proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
        unsafe_rec_type_mismatch,foundation_propext_hijack} with #4229
        "isModule": False expectations), validates AuditBoundaryGuard.fixture_id
        statically in validate_catalog_invariants (VALID_SPEC_BOUNDARY_FIXTURE_IDS
        and VALID_TARGET_BOUNDARY_FIXTURE_IDS with runtime parity checks), pins
        LEAN_PATH="", import Lean.Environment, and -j1 / -M2048 / -s16384
        resource caps in run_lean_forge, adds unit/survivor/catalog tests in
        test_check_guard_mutation.py, and aligns the 96-guard (80 + 4 +
        12) descriptions across docs and the guard_mutation workflow comment.
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 11/11 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs (keeping
      trusted_framework_pass1_replay_and_vetted_tier_isolation and
      canary_modules.len() >= 17), anneal/tests/audit/tests/target_audit.rs
      (adds 3 negative/positive kernel-typechecking regression subcases for
      sorryAx-bearing .source .proof alternates across .foundation and two
      Proof modules), and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs.
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, workflow permissions/triggers/pins, governing docs, policy/skill
    files, stated user specs, Trusted/Framework*.lean, and #[anneal::trusted]
    waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay/alternate/inventory/IR-helper
    invariants, anti-vacuity linting across Specs and SpecsV2, and CI
    guard-mutation coverage).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple is
    (target_base = f43546b35cb0b0a90ead160bc2c1fc0c750fed69, merge_base = f43546b35cb0b0a90ead160bc2c1fc0c750fed69, head = 525c6c1355e72508ac4d17bd484f13e4b837dd22), with
    tree = 04455645d64f31e752fdcdd1c76cb2ec8241a1bb (clean rebase onto
    origin/main f43546b35cb0 incl. #4215, #4354, #4357, and #4359;
    single linear commit, clean working tree).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling and workflow comment (ci/,
    .github/workflows/anneal-current.yml), and Pass 1 docs and audit/CLI test
    suites (docs/, tests/audit, tests/cargo-anneal). Clean conflict
    rebase of 40d688341de7 onto f43546b35cb0 (git range-diff shows only the
    3 localized capture.rs hunks merging -Zmir-opt-level=0 with #4359's
    -Zallow-features= and 5-arg validate_compiler_options, with zero changes
    to TrustedBoundary.lean, target.rs, ci/, or tests/).
  3. Grouped coverage: All 11/11 changed paths across
    f43546b35cb0..525c6c1355e7 (git diff --raw --no-renames) are inspected
    (0 inapplicable, 0 blocked):
    • anneal/trusted/rustc-capture/src/capture.rs (inspected): resolved
      merge conflict cleanly preserving both -Zmir-opt-level=0 and #4359's
      -Zallow-features= / stdlib_crate signature.
    • anneal/trusted/audit/TrustedBoundary.lean,
      anneal/trusted/cargo-anneal/src/target.rs, anneal/ci/*.py,
      .github/workflows/anneal-current.yml, anneal/docs/*.md,
      anneal/tests/audit/tests/*.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (inspected): zero diff drift relative to 40d688341de7 via git range-diff.
  4. Realized capability and isolation: author_family: gemini; prior
    joshlf Gate-2 R5 CLEAN (d56edd614a1d), Codex CLEAN on 40d688341de7
    (issuecomment-7178299394), and delta-proportional post-rebase checks
    verified directly on 525c6c1355e7; holdout mode: none.
  5. Checks and probes:
    • Directly on 525c6c1355e72508ac4d17bd484f13e4b837dd22:
      • check_pr_hygiene.py --base origin/main --pr-body-file ... --receipt-file ... --json
        -> ok: true, 0 findings, 0 warnings.
      • (cd anneal && sha256sum --check --strict trusted/root-manifest.sha256)
        (4/4 OK), ./ci/check_todo.sh, ./anneal/ci/check_todo.sh,
        python3 -I -B ci/check_skills.py, git diff --check origin/main ->
        all exit 0.
      • anneal-rustc-capture (cargo +nightly-2026-05-31 test --locked -p anneal-rustc-capture)
        -> 59 passed; 0 failed (0.01s).
      • anneal-rustc-capture-tests --test pass_order_sentinel (7 passed,
        123.23s) & --test stdlib_capture (7 passed, 93.98s).
      • cargo test --locked -p anneal-audit --lib -> 20 passed; 0 failed
        (0.69s).
      • cargo test --locked -p cargo-anneal --lib target::tests ->
        19 passed; 0 failed (0.06s), setup::tests -- --test-threads=1
        -> 26 passed; 0 failed (0.19s).
      • (cd anneal && PYTHONPATH=ci python3 -B -m unittest -v test_check_guard_mutation test_ci_workflow test_run_anneal_check test_workflow_yaml test_check_pr_hygiene test_verify_zerocopy)
        -> Ran 170 tests in 118.806s: OK.
    • On identical TrustedBoundary.lean / target_audit.rs / ci/ trees
      (40d688341de7 / 5198b9b9fb31, untouched by upstream commits):
      target_audit _allow_sorry (2/2, 181.19s), _alternate_ (3/3,
      172.72s), audit_boundary (12/12, 105.36s), boundary_audit
      (62/62, 1612.55s), target_audit (44/44, 934.08s),
      anti_vacuity (8/8, 232.61s).
  6. Findings and blockers: 7/7 prior review threads resolved (0
    unresolved). Triggering @codex review and awaiting CI + Gate 2 + human
    Gate 5.

Authored by an AI agent acting on mdittmer's behalf.

@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 525c6c1355

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv), rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory), and rejects anonymous declaration names in
      proofExport target inventories.
    • Rejects key mismatches, base-environment shadowing, and post-replay
      declaration omission alongside mutual all, constructor, and recursor
      invariants in validateReplayMap and replayKernelEnv (with
      hasNoDuplicateNames and inline defense-in-depth invariant comments on
      caller-filtered branches), and enforces full header parity across
      imports, alternates, and ._unsafe_rec pairs (sameConstantShape,
      RecursorVal.all, and sameUnsafeRecHeader).
    • Checks authority edges on both stored and ci across Pass-1
      .foundation alternates (verifyAndCollectLocals), Pass-2 .foundation
      and .sysrootFoundation alternates (checkSysrootAlternates), and Phase-4
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin);
      under --allow-sorry-in-proof, records sorry-bearing .source .proof
      alternates in sorryDecls and axioms, keeps their non-sorryAx
      dependencies in phase2Roots, pushes every alternate theorem body
      (including sorryAx-bearing .source .proof alternates, since base
      already declares Init.Prelude.sorryAx, plus p.name into phase2Roots
      when idx == 0) for fresh kernel typechecking via checkAlternateProofs,
      and rejects any sorry alternate reaching phase1Closure.
    • Requires every checked constant with .foundation or .sysrootFoundation
      provenance to appear in its origin module's inventory, requires target
      .source and proofExport constants with .library provenance to appear
      in that library's inventory, rejects repository constants shadowing vendor
      or sysroot declarations in correspondence-audit (replayCorrAndVendor)
      before the !replayRepo early return (even when replayRepo = false),
      rejects kernel declarations colliding with IR-only extraConstNames entries
      across Pass 1, Pass 2, and targetAudit (including proofExport), and
      keeps #4330 Program.mk 6-field reduction checks
      (progArgs.size != 6 returning
      (#[], some "unreducible Captured.program constructor"), preserving
      #4229 module-mode target rules, #4236 decoupled
      Anneal.MirWp.Canaries checks, and #4237 Profile v2 SpecsV2 target
      claims).
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (isKnownInhabitedDomain with constructive
      inhabitance witness comments and extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, falls back to body#<idx> when an unsafe Body carries an empty
      identity string, and emits explicit vacuity_check_truncated warnings
      with cause across extractCapturedBodies and inspectSpecVacuity for both
      Specs and SpecsV2 (shape.specLabel).
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub,
      -Coverflow-checks={yes,no}, and #4359's -Zallow-features= in run
      (covering both standard and --stdlib-crate capture paths), cites the
      exact upstream mir_preserve_ub pass conditions in
      remove_place_mention.rs and simplify.rs (clarifying that
      -Zmir-preserve-ub does not force -Zmir-opt-level=0), and requires
      opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests
      rebased onto #4359's stdlib_crate signature).
  • TCB CLI target-audit schema (anneal/trusted/cargo-anneal/src/target.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES
      (src/bundled_resources.rs stays deleted following #4244, with
      build.rs + trusted_bundle.rs embedding TrustedBoundary.lean from
      canonical workspace sources alongside #4335's Trusted.Framework*
      registrations and #4215 inspect/verdict updates).
  • CI guard-mutation harness, workflow comment & architecture docs
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py,
    .github/workflows/anneal-current.yml,
    anneal/docs/auditing-and-comparator.md,
    anneal/docs/testing-architecture.md):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (96 total
      guards on top of #4266's 84: 80 mir_semantics + 4 audit_headers
      • 12 audit_boundary) covering spec-preflight
        (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
        target-audit (target_audit_reject_{expected_mismatch,theorem_type,
        proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
        unsafe_rec_type_mismatch,foundation_propext_hijack} with #4229
        "isModule": False expectations), validates AuditBoundaryGuard.fixture_id
        statically in validate_catalog_invariants (VALID_SPEC_BOUNDARY_FIXTURE_IDS
        and VALID_TARGET_BOUNDARY_FIXTURE_IDS with runtime parity checks), pins
        LEAN_PATH="", import Lean.Environment, and -j1 / -M2048 / -s16384
        resource caps in run_lean_forge, adds unit/survivor/catalog tests in
        test_check_guard_mutation.py, and aligns the 96-guard (80 + 4 +
        12) descriptions across docs and the guard_mutation workflow comment
        (preserving #4288's anneal-itree-diff table text on main).
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 11/11 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs (keeping
      trusted_framework_pass1_replay_and_vetted_tier_isolation and
      canary_modules.len() >= 17), anneal/tests/audit/tests/target_audit.rs
      (adds 3 negative/positive kernel-typechecking regression subcases for
      sorryAx-bearing .source .proof alternates across .foundation and two
      Proof modules), and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs.
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, workflow permissions/triggers/pins, governing docs, policy/skill
    files, stated user specs, Trusted/Framework*.lean, and #[anneal::trusted]
    waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay/alternate/inventory/IR-helper
    invariants, anti-vacuity linting across Specs and SpecsV2, and CI
    guard-mutation coverage).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple is
    (target_base = 80bfd5e1fb29b96566018e9a1d4c216907e9e078, merge_base = 80bfd5e1fb29b96566018e9a1d4c216907e9e078, head = 1088025e122a4a6658a336e9655a3c1755e7e15f), with
    tree = 2d5e88549f4e4215a6200645c70995408f8bfbe5 (clean rebase onto
    origin/main 80bfd5e1fb29 incl. #4249 + #4288; single linear commit,
    clean working tree).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling and workflow comment (ci/,
    .github/workflows/anneal-current.yml), and Pass 1 docs and audit/CLI test
    suites (docs/, tests/audit, tests/cargo-anneal). Docs-only rebase of
    525c6c1355e7 onto 80bfd5e1fb29 (git range-diff shows only the 1-line
    Tier-1 table row in anneal/docs/testing-architecture.md merging #4288's
    anneal-itree-diff text with #4262's 96-guard note, with zero code,
    Lean, test, or workflow changes relative to 525c6c1355e7).
  3. Grouped coverage: All 11/11 changed paths across
    80bfd5e1fb29..1088025e122a (git diff --raw --no-renames) are inspected
    (0 inapplicable, 0 blocked):
    • anneal/docs/testing-architecture.md (inspected): resolved single-line
      table conflict keeping both #4288 (anneal-itree-diff) and #4262
      (96 guards).
    • anneal/trusted/{audit/TrustedBoundary.lean,rustc-capture/src/capture.rs,cargo-anneal/src/target.rs},
      anneal/ci/{check_guard_mutation,test_check_guard_mutation}.py,
      .github/workflows/anneal-current.yml, anneal/docs/auditing-and-comparator.md,
      anneal/tests/audit/tests/*.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (inspected): zero diff drift relative to 525c6c1355e7 via git range-diff.
  4. Realized capability and isolation: author_family: gemini; prior
    joshlf Gate-2 R5 CLEAN (d56edd614a1d), Codex CLEAN on 525c6c1355e7
    (issuecomment-7179762295) + full CI SUCCESS on 525c6c1355e7, and
    post-rebase checks verified directly on 1088025e122a; holdout mode: none.
  5. Checks and probes:
    • Directly on 1088025e122a4a6658a336e9655a3c1755e7e15f:
      • check_pr_hygiene.py --base origin/main --pr-body-file ... --receipt-file ... --json
        -> ok: true, 0 findings, 0 warnings.
      • (cd anneal && sha256sum --check --strict trusted/root-manifest.sha256)
        (4/4 OK), ./ci/check_todo.sh, ./anneal/ci/check_todo.sh,
        python3 -I -B ci/check_skills.py, git diff --check origin/main ->
        all exit 0.
      • cargo test --locked --no-run -p anneal-audit-tests --tests -> compiled
        cleanly (5.42s).
      • (cd anneal && PYTHONPATH=ci python3 -B -m unittest -v test_ci_workflow test_workflow_yaml test_check_pr_hygiene)
        -> Ran 123 tests in 107.175s: OK.
    • On identical code/Lean/workflow/test trees (525c6c1355e7, differing
      only in the single testing-architecture.md doc row): 59/59
      anneal-rustc-capture (0.01s), 7/7 pass_order_sentinel (123.23s),
      7/7 stdlib_capture (93.98s), 20/20 anneal-audit --lib (0.69s),
      19/19 cargo-anneal --lib target::tests (0.06s), 26/26 serial
      setup::tests (0.19s), and 170/170 6-module Python CI (118.806s).
    • On identical TrustedBoundary.lean / target_audit.rs / ci/ trees
      (40d688341de7 / 5198b9b9fb31): target_audit _allow_sorry (2/2,
      181.19s), _alternate_ (3/3, 172.72s), audit_boundary (12/12,
      105.36s), boundary_audit (62/62, 1612.55s), target_audit
      (44/44, 934.08s), anti_vacuity (8/8, 232.61s).
  6. Findings and blockers: 7/7 prior review threads resolved (0
    unresolved). Triggering @codex review and awaiting CI + Gate 2 + human
    Gate 5.

Authored by an AI agent acting on mdittmer's behalf.

@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from 525c6c1 to 1088025 Compare November 26, 2026 02:04
@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 1088025e12

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 7)

  • Identity: one:8df2a8d0b1e2077fec0d24d0027ae56d5c633026:2d5e88549f4e4215a6200645c70995408f8bfbe5:afbfed1c2e49d4cf145a27654ce98ae5f8b0d0356061c7aa3634fe8adf031461 (base=80bfd5e1fb29, head=1088025e122a, tree=2d5e88549f4e)
  • Separation: author_family=gemini vs. reviewer_family=claude
  • Coverage: 11 inspected, 0 inapplicable, 0 blocked (of 11 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed findings 1 694s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed clean 0 1274s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed clean 0 1030s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R7-01 P2 1 (seat1) static_verified anneal/docs/build-systems-and-receipts.md:153 The fixed capture-profile doc still says capture always passes and validates only -Copt-level=0, -Cdebug-assertions=no and -Zmir-preserve-ub; this PR now also always passes and requires -Zmir-opt-level=0.

G2-R7-01 [P2] (anneal/docs/build-systems-and-receipts.md:153, General (documentation review), companion to Pass 2 §2 (trusted/rustc-capture), static_verified): The fixed capture-profile doc still says capture always passes and validates only -Copt-level=0, -Cdebug-assertions=no and -Zmir-preserve-ub; this PR now also always passes and requires -Zmir-opt-level=0.

  • Invariant: AGENTS.md standing rule (docs-author): add or update affected docs in the same PR; the General pass checks documentation accuracy against the diff.
  • Evidence: trusted/rustc-capture/src/capture.rs:2740 adds "-Zmir-opt-level=0" to the fixed compiler_args, and capture.rs:1623-1628 makes validate_profile_options fail unless mir_opt_level == Some(0). docs/build-systems-and-receipts.md:153-160 lists the full injected and validated flag set without it, and the Phase 1 diagram at line 107 ('Injects -Zmir-preserve-ub') has the same omission. Neither is in the changed-file set. Impact is documentation accuracy only (the doc understates the checks); not a soundness defect.

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R7-A01 [P3] (anneal/tests/rustc-capture/tests/pass_order_sentinel.rs:238): Untouched seam-2 doc comment still describes the capture profile as '-Copt-level=0 -Zmir-preserve-ub', without the now-mandatory -Zmir-opt-level=0.
  • G2-R7-A02 [P3] (anneal/trusted/audit/TrustedBoundary.lean:3236): Several new defense-in-depth rejections have no negative test: validateReplayMap's recursor all-mismatch and missing-inductive branches, constructor-missing-from-inductive and expected-constructor branches; the 'uninventoried foundation/sysroot constant' final sweeps; and the targetAudit foundation-block 'target inventory origin mismatch' / 'IR helper provenance mismatch'.
  • G2-R7-A03 [P3] (anneal/trusted/audit/TrustedBoundary.lean:6431): Empty-identity fallback label body#<idx> indexes the extracted bodies array rather than the original Program.bodies index if an earlier body was skipped during truncated extraction.
  • G2-R7-A04 [P3] (anneal/trusted/rustc-capture/src/capture.rs:1623): Optional defense-in-depth parity: extract.rs and capture profile docs only name -Zmir-preserve-ub and do not yet mirror the new -Zmir-opt-level=0 requirement.
  • G2-R7-A05 [P3] (global): Pre-existing isCompilerGeneratedSpecDef filter omits Lean 4.34.1 compiler-generated *.ctorElimType and recursive *.brecOn.go auxiliaries, which can trigger false-positive advisory unused_spec_binding warnings if a specification defines a multi-constructor or recursive inductive (admitted by allowedSpecDeclarationKinds at lines 1498-1502).

Executed Sandbox Probes

  • seat2 lean_v4_34_1_sysroot_invariants: Verified across Init.Data.BitVec.Basic + Std.Data.HashMap.Basic on pinned Lean 4.34.1: 354/354 recursors satisfy iv.all == rv.all, 0 invalid defn/thm/opaque .al (rc=0)
  • seat2 bwrap_check_guard_mutation_unit_tests: python3 -I -B ci/check_guard_mutation.py --list printed 96 cataloged guards (80 mir_semantics + 4 audit_headers + 12 audit_boundary) and python3 -I -B -m unitte (rc=0)
  • seat3 workflow_checklist_1_permissions: outcome=passed
  • seat3 workflow_checklist_2_triggers: outcome=passed
  • seat3 workflow_checklist_3_secrets_containment: outcome=passed
  • seat3 workflow_checklist_4_release_environments: outcome=passed
  • seat3 workflow_checklist_5_checkout_and_sha_pins: outcome=passed
  • seat3 workflow_checklist_6_script_injection: outcome=passed
  • seat3 workflow_checklist_7_cache_artifact_trust: outcome=passed
  • seat3 workflow_checklist_8_guard_relaxation: outcome=passed
  • seat3 hygiene_and_root_manifest: outcome=passed
  • seat3 guard_mutation_catalog_and_unit_tests: outcome=passed
  • seat3 rustc_mir_opt_level_0_differential: outcome=passed
  • seat3 lean434_replay_and_subsumption_probes: outcome=passed
  • seat3 lean434_bitvec_whnf_and_zerocopy_specs: outcome=passed
  • seat3 lean434_unused_binder_inductive_edge_case: outcome=passed
  • seat3 heavy_cargo_and_full_tb_compile_and_missing_ci_bins: outcome=skipped

@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from 1088025 to b1f88b5 Compare November 26, 2026 03:50
@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv), rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory), and rejects anonymous declaration names in
      proofExport target inventories.
    • Rejects key mismatches, base-environment shadowing, and post-replay
      declaration omission alongside mutual all, constructor, and recursor
      invariants in validateReplayMap and replayKernelEnv (with
      hasNoDuplicateNames and inline defense-in-depth invariant comments on
      caller-filtered branches), and enforces full header parity across
      imports, alternates, and ._unsafe_rec pairs (sameConstantShape,
      RecursorVal.all, and shared sameUnsafeRecHeader).
    • Checks authority edges on both stored and ci across Pass-1
      .foundation alternates (verifyAndCollectLocals), Pass-2 .foundation
      and .sysrootFoundation alternates (checkSysrootAlternates), and Phase-4
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin);
      under --allow-sorry-in-proof, records sorry-bearing .source .proof
      alternates in sorryDecls and axioms, keeps their non-sorryAx
      dependencies in phase2Roots, pushes every alternate theorem body
      (including sorryAx-bearing .source .proof alternates, since base
      already declares Init.Prelude.sorryAx, plus p.name into phase2Roots
      when idx == 0) for fresh kernel typechecking via checkAlternateProofs,
      and rejects any sorry alternate reaching phase1Closure.
    • Requires every checked constant with .foundation or .sysrootFoundation
      provenance to appear in its origin module's inventory, requires target
      .source and proofExport constants with .library provenance to appear
      in that library's inventory, rejects repository constants shadowing vendor
      or sysroot declarations in correspondence-audit (replayCorrAndVendor)
      before the !replayRepo early return (even when replayRepo = false),
      rejects kernel declarations colliding with IR-only extraConstNames entries
      across Pass 1, Pass 2, and targetAudit (including proofExport), and
      keeps #4330 Program.mk 6-field reduction checks
      (progArgs.size != 6 returning
      (#[], some "unreducible Captured.program constructor"), preserving
      #4229 module-mode target rules, #4236 decoupled
      Anneal.MirWp.Canaries checks, and #4237 Profile v2 SpecsV2 target
      claims).
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (isKnownInhabitedDomain with constructive
      inhabitance witness comments and extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, falls back to body#<idx> when an unsafe Body carries an empty
      identity string, and emits explicit vacuity_check_truncated warnings
      with cause across extractCapturedBodies and inspectSpecVacuity for both
      Specs and SpecsV2 (shape.specLabel).
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub,
      -Coverflow-checks={yes,no}, and #4359's -Zallow-features= in run
      (covering both standard and --stdlib-crate capture paths), cites the
      exact upstream mir_preserve_ub pass conditions in
      remove_place_mention.rs and simplify.rs (clarifying that
      -Zmir-preserve-ub does not force -Zmir-opt-level=0), and requires
      opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests
      rebased onto #4359's stdlib_crate signature).
  • TCB CLI target-audit schema (anneal/trusted/cargo-anneal/src/target.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES
      (src/bundled_resources.rs stays deleted following #4244, with
      build.rs + trusted_bundle.rs embedding TrustedBoundary.lean from
      canonical workspace sources alongside #4335's Trusted.Framework*
      registrations and #4215 inspect/verdict updates).
  • CI guard-mutation harness, workflow comment & architecture/capture docs
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py,
    .github/workflows/anneal-current.yml,
    anneal/docs/{alpha,auditing-and-comparator,build-systems-and-receipts,testing-architecture}.md):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (96 total
      guards on top of #4266's 84: 80 mir_semantics + 4 audit_headers
      • 12 audit_boundary) covering spec-preflight
        (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
        target-audit (target_audit_reject_{expected_mismatch,theorem_type,
        proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
        unsafe_rec_type_mismatch,foundation_propext_hijack} with #4229
        "isModule": False expectations), validates AuditBoundaryGuard.fixture_id
        statically in validate_catalog_invariants (VALID_SPEC_BOUNDARY_FIXTURE_IDS
        and VALID_TARGET_BOUNDARY_FIXTURE_IDS with runtime parity checks), pins
        LEAN_PATH="", import Lean.Environment, and -j1 / -M2048 / -s16384
        resource caps in run_lean_forge, adds unit/survivor/catalog tests in
        test_check_guard_mutation.py, aligns the 96-guard (80 + 4 + 12)
        descriptions across docs and guard_mutation, and documents
        -Zmir-opt-level=0 alongside -Zmir-preserve-ub in
        anneal/docs/build-systems-and-receipts.md (G2-R7-01: Phase-1 diagram at
        line 108 and injected/validated option lists at lines 156, 161) and
        anneal/docs/alpha.md (G2-R7-A04: line 102).
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 14/14 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/audit/tests/target_audit.rs (3 negative/positive
      kernel-typechecking regression subcases for sorryAx-bearing .source .proof alternates),
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (interleaving cleanly with #4234 sharding), and
      anneal/tests/rustc-capture/tests/pass_order_sentinel.rs (updates seam-2
      doc comment at line 238 to list -Zmir-opt-level=0 alongside
      -Copt-level=0 -Zmir-preserve-ub, addressing G2-R7-A01).
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, workflow permissions/triggers/pins, governing docs, policy/skill
    files, stated user specs, Trusted/Framework*.lean, and #[anneal::trusted]
    waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay/alternate/inventory/IR-helper
    invariants, anti-vacuity linting across Specs and SpecsV2, CI
    guard-mutation coverage, and capture-profile documentation).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple is
    (target_base = f5cdaf76557c2efa8619c8f8e41ee94a1eb87387, merge_base = f5cdaf76557c2efa8619c8f8e41ee94a1eb87387, head = b1f88b5a3ba20a4d015e9387bfe1f869c2b97694), with
    tree = 08a8814697d83b0e701e4c5769e2b92542a90f10 (clean rebase onto
    origin/main f5cdaf76557c incl. #4234, #4252, #4356, plus Gate-2 R7
    doc & comment updates G2-R7-01 / A01 / A04; single linear commit, clean
    working tree).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling and workflow comment (ci/,
    .github/workflows/anneal-current.yml), and Pass 1 docs and audit/CLI/capture
    test suites (docs/, tests/{audit,cargo-anneal,rustc-capture}). Rebased
    cleanly atop f5cdaf76557c (git rebase 0 conflicts) and added
    -Zmir-opt-level=0 documentation in build-systems-and-receipts.md:108,156,161
    (G2-R7-01 [P2]), alpha.md:102 (G2-R7-A04), and
    pass_order_sentinel.rs:238 (G2-R7-A01), with zero code/Lean/CI diff
    drift relative to 1088025e122a / 525c6c1355e7.
  3. Grouped coverage: All 14/14 changed paths across
    f5cdaf76557c..b1f88b5a3ba2 (git diff --raw --no-renames) are inspected
    (0 inapplicable, 0 blocked):
    • anneal/docs/{build-systems-and-receipts,alpha}.md and
      anneal/tests/rustc-capture/tests/pass_order_sentinel.rs (inspected):
      added -Zmir-opt-level=0 to Phase-1 fixed capture profile diagram, option
      lists, and seam-2 doc comment; wrapped <= 80 columns and verified cleanly
      by check_pr_hygiene.py.
    • anneal/trusted/{audit/TrustedBoundary.lean,rustc-capture/src/capture.rs,cargo-anneal/src/target.rs},
      anneal/ci/{check_guard_mutation,test_check_guard_mutation}.py,
      .github/workflows/anneal-current.yml,
      anneal/docs/{auditing-and-comparator,testing-architecture}.md,
      anneal/tests/audit/tests/*.rs, and
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (inspected): zero diff drift relative to 1088025e122a via git range-diff.
  4. Realized capability and isolation: author_family: gemini; prior
    joshlf Gate-2 R5 CLEAN (d56edd614a1d), Codex CLEAN on 1088025e122a
    (issuecomment-7180485957), Gate-2 R7 (pullrequestreview-6068165621:
    seat2 clean, seat3 clean, seat1 single [P2] doc finding
    G2-R7-01 now resolved + non-blocking [P3] notes A01–A05), and fresh
    post-amend/post-rebase verification on b1f88b5a3ba2; holdout mode: none.
  5. Checks and probes:
    • Directly on b1f88b5a3ba20a4d015e9387bfe1f869c2b97694:
      • check_pr_hygiene.py --base origin/main --pr-body-file ... --receipt-file ... --json
        -> ok: true, 0 findings, 0 warnings.
      • (cd anneal && sha256sum --check --strict trusted/root-manifest.sha256)
        (4/4 OK), ./ci/check_todo.sh, ./anneal/ci/check_todo.sh,
        python3 -I -B ci/check_skills.py, git diff --check origin/main ->
        all exit 0.
      • cargo test --locked -p anneal-audit --lib -> 20 passed; 0 failed
        (0.81s); cargo test --locked -p cargo-anneal --lib target::tests ->
        19 passed; 0 failed (0.07s); cargo test --locked --no-run -p anneal-audit-tests --tests -> compiled cleanly (3.22s).
      • nightly-2026-05-31: cargo test --locked -p anneal-rustc-capture --lib
        -> 65 passed; 0 failed (0.01s); cargo test --locked -p anneal-rustc-capture-tests --test pass_order_sentinel -> 7 passed; 0 failed (120.40s).
      • cargo test --locked -p cargo-anneal-tests --test suite anti_vacuity_lint_reports_truncated_wide_unsafe_body -> 1 passed; 0 failed (57.55s) against #4234-rebased anneal-rustc-capture.
      • (cd anneal && PYTHONPATH=ci python3 -B -m unittest -v test_ci_workflow test_workflow_yaml test_check_pr_hygiene)
        -> Ran 123 tests in 218.535s: OK.
    • On identical capture.rs / TrustedBoundary.lean / ci/ code trees
      (525c6c1355e7 / 40d688341de7 / 5198b9b9fb31): 7/7 stdlib_capture
      (93.98s), 26/26 setup::tests (0.19s), 170/170 6-module Python
      CI (118.806s), 12/12 audit_boundary (105.36s), 62/62
      boundary_audit (1612.55s), 44/44 target_audit (934.08s), 8/8
      anti_vacuity (232.61s).
  6. Findings and blockers: G2-R7-01 [P2] (build-systems-and-receipts.md),
    G2-R7-A01 (pass_order_sentinel.rs:238), and G2-R7-A04 (alpha.md:102)
    resolved; 7/7 prior review threads resolved (0 unresolved). Triggering
    @codex review and awaiting CI + Gate 2 R8 + human Gate 5.

Authored by an AI agent acting on mdittmer's behalf.

@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: b1f88b5a3b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 8)

  • Identity: one:82ece4a7a030c7af15925fdb944d9f1848e8fe75:08a8814697d83b0e701e4c5769e2b92542a90f10:c0b69a552a4ba21a62a730690b5791821a715fb5ac6852ef0483f08007949041 (base=f5cdaf76557c, head=b1f88b5a3ba2, tree=08a8814697d8)
  • Separation: author_family=gemini vs. reviewer_family=claude
  • Coverage: 14 inspected, 0 inapplicable, 0 blocked (of 14 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed findings 1 662s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed clean 0 938s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed clean 0 2897s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R8-01 P2 1 (seat1) static_verified anneal/trusted/audit/TrustedBoundary.lean:3290 Several new auditor rejection checks have no negative test asserting their diagnostic: the validateReplayMap recursor all mismatch, missing recursor inductive, expected-constructor, constructor-missing-from-inductive, missing/anonymous inductive-for-constructor branches (lines 3272-3292), and the new correspondence .sysrootFoundation inventory-origin check (line 3886).

G2-R8-01 [P2] (anneal/trusted/audit/TrustedBoundary.lean:3290, Pass 2 §3 (trusted/audit) mandatory negative tests, static_verified): Several new auditor rejection checks have no negative test asserting their diagnostic: the validateReplayMap recursor all mismatch, missing recursor inductive, expected-constructor, constructor-missing-from-inductive, missing/anonymous inductive-for-constructor branches (lines 3272-3292), and the new correspondence .sysrootFoundation inventory-origin check (line 3886).

  • Invariant: Base anneal/AGENTS.md Pass 2 (lines 267-271) and trust-review §3 require a new or updated negative test in tests/audit/tests/boundary_audit.rs, asserting exit code and target diagnostic, for every added admission guard, verified to fail if the guard is disabled.
  • Evidence: No test in tests/audit/tests/.rs or ci/test_.py contains 'recursor ... all differs', 'missing inductive', 'expected constructor', 'missing from ', 'anonymous inductive on constructor', or any 'inventory origin mismatch' assertion. The only forged recInfo/ctorInfo tests cover 'points to' and 'missing constructor'. The recursor all check is the only guard against a forged recursor all, because Lean's Replay checkPostponedRecursors compares only rules. Deleting it or the sysroot origin check would leave every current test passing. The checks marked 'uninventoried foundation/sysroot constant' are documented as unreachable defense in depth and are excluded here.

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R8-A01 [P3] (anneal/trusted/rustc-capture/src/capture.rs:1623): Capture now enforces -Zmir-opt-level=0, but ir::Configuration records only mir_preserve_ub, so receipts and verify_zerocopy.py cannot attest the MIR opt level.
  • G2-R8-A02 [P3] (anneal/ci/check_guard_mutation.py:784): run_lean_forge copies the full ambient environment (os.environ.copy()) and clears only LEAN_PATH, so ambient LEAN_/LAKE_/LD_* variables reach the fixture-forging lean process.
  • G2-R8-A03 [P3] (anneal/trusted/audit/TrustedBoundary.lean:6431): Fallback body#<idx> labels in inspectSpecVacuity index the filtered bodies array rather than the original Program.bodies index if an earlier body was skipped due to unreducible metadata.
  • G2-R8-A04 [P3] (global): The doc states that Lean guard mutation reuses precompiled TrustedBoundary .oleans, whereas check_guard_mutation.py recompiles mutated TrustedBoundary.lean cleanly per guard for audit_headers and audit_boundary (reusing compiled baseline fixtures and BASE_TRUSTED_MODULES).

Executed Sandbox Probes

  • seat3 Verified clean git diff --raw over 14 :100644 M files, zero new symlinks/submodules/caches, zero bidi/invisible Unicode : outcome=passed
  • seat3 sha256sum --check --strict trusted/root-manifest.sha256 exited 0 (Cargo.toml, Cargo.lock, flake.nix, flake.lock all OK) : outcome=passed
  • seat3 python3 -I -B -m unittest discover -s ci -p test_check_guard_mutation.py -v ran 11 tests in 13.451s with OK inside bwrap: outcome=passed
  • seat3 python3 -I -B ci/check_guard_mutation.py --lean /lean/bin/lean --suite audit_headers --jobs 2 --timeout-sec 120 exited 0: outcome=passed
  • seat3 python3 -I -B ci/check_guard_mutation.py --lean /lean/bin/lean --suite audit_boundary --jobs 2 --timeout-sec 120 exited : outcome=passed
  • seat3 Compiled candidate TrustedBoundary.lean in bwrap (39.6s) and passed adv_probes.lean..adv_probes4.lean covering OfNat Nat: outcome=passed
  • seat3 rustc 1.98.0-nightly --emit=mir -Copt-level=0 -Cdebug-assertions=no -Zmir-opt-level=0 -Zmir-preserve-ub inside bwrap exi: outcome=passed
  • seat3 Verified all relative Markdown links across the 4 modified docs inside bwrap; 0 broken links.: outcome=passed
  • seat3 .github/workflows/anneal-current.yml and caller .github/workflows/anneal.yml both declare top-level permissions: {conte: outcome=passed`
  • seat3 .github/workflows/anneal-current.yml triggers solely on workflow_call; caller .github/workflows/anneal.yml triggers on: outcome=passed
  • seat3 Zero ${{ secrets.* }}orGITHUB_TOKENreferences appear in anneal-current.yml or anneal.yml;guard_mutation and te: outcome=passed
  • seat3 Neither anneal-current.yml nor anneal.yml defines a release/publish job; save_nix_cacheis gated strictly topush on: outcome=passed
  • seat3 All 4 actions/checkoutsteps in anneal-current.yml setpersist-credentials: false, and all 20 uses: entries in ann: outcome=passed
  • seat3 Scanned every run:block in anneal-current.yml inside bwrap; found zero${{ ... }} interpolations inside shell scrip: outcome=passed
  • seat3 Cache boundaries preserved: save_miri_olean_cachekeys onhashFiles(lean-toolchain, UPSTREAM_PIN.json), skips saving: outcome=passed
  • seat3 Diff in anneal-current.yml strengthens CI by dropping --suite mir_semanticsonguard_mutation to execute all 96 cata: outcome=passed

@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from b1f88b5 to 25a59f1 Compare November 26, 2026 04:49
@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv), rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory), and rejects anonymous declaration names in
      proofExport target inventories.
    • Rejects key mismatches, base-environment shadowing, and post-replay
      declaration omission alongside mutual all, constructor, and recursor
      invariants in validateReplayMap and replayKernelEnv (with
      hasNoDuplicateNames and inline defense-in-depth invariant comments on
      caller-filtered branches), and enforces full header parity across
      imports, alternates, and ._unsafe_rec pairs (sameConstantShape,
      RecursorVal.all, and shared sameUnsafeRecHeader).
    • Checks authority edges on both stored and ci across Pass-1
      .foundation alternates (verifyAndCollectLocals), Pass-2 .foundation
      and .sysrootFoundation alternates (checkSysrootAlternates), and Phase-4
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin);
      under --allow-sorry-in-proof, records sorry-bearing .source .proof
      alternates in sorryDecls and axioms, keeps their non-sorryAx
      dependencies in phase2Roots, pushes every alternate theorem body
      (including sorryAx-bearing .source .proof alternates, since base
      already declares Init.Prelude.sorryAx, plus p.name into phase2Roots
      when idx == 0) for fresh kernel typechecking via checkAlternateProofs,
      and rejects any sorry alternate reaching phase1Closure.
    • Requires every checked constant with .foundation or .sysrootFoundation
      provenance to appear in its origin module's inventory, requires target
      .source and proofExport constants with .library provenance to appear
      in that library's inventory, rejects repository constants shadowing vendor
      or sysroot declarations in correspondence-audit (replayCorrAndVendor)
      before the !replayRepo early return (even when replayRepo = false),
      rejects kernel declarations colliding with IR-only extraConstNames entries
      across Pass 1, Pass 2, and targetAudit (including proofExport), and
      keeps #4330 Program.mk 6-field reduction checks
      (progArgs.size != 6 returning
      (#[], some "unreducible Captured.program constructor"), preserving
      #4229 module-mode target rules, #4236 decoupled
      Anneal.MirWp.Canaries checks, and #4237 Profile v2 SpecsV2 target
      claims).
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (isKnownInhabitedDomain with constructive
      inhabitance witness comments and extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, falls back to body#<idx> when an unsafe Body carries an empty
      identity string, and emits explicit vacuity_check_truncated warnings
      with cause across extractCapturedBodies and inspectSpecVacuity for both
      Specs and SpecsV2 (shape.specLabel).
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub,
      -Coverflow-checks={yes,no}, and #4359's -Zallow-features= in run
      (covering both standard and --stdlib-crate capture paths), cites the
      exact upstream mir_preserve_ub pass conditions in
      remove_place_mention.rs and simplify.rs (clarifying that
      -Zmir-preserve-ub does not force -Zmir-opt-level=0), and requires
      opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests
      rebased onto #4359's stdlib_crate signature).
  • TCB CLI target-audit schema (anneal/trusted/cargo-anneal/src/target.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES
      (src/bundled_resources.rs stays deleted following #4244, with
      build.rs + trusted_bundle.rs embedding TrustedBoundary.lean from
      canonical workspace sources alongside #4335's Trusted.Framework*
      registrations and #4215 inspect/verdict updates).
  • CI guard-mutation harness, workflow comment & architecture/capture docs
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py,
    .github/workflows/anneal-current.yml,
    anneal/docs/{alpha,auditing-and-comparator,build-systems-and-receipts,testing-architecture}.md):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (96 total
      guards on top of #4266's 84: 80 mir_semantics + 4 audit_headers
      • 12 audit_boundary) covering spec-preflight
        (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
        target-audit (target_audit_reject_{expected_mismatch,theorem_type,
        proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
        unsafe_rec_type_mismatch,foundation_propext_hijack} with #4229
        "isModule": False expectations), validates AuditBoundaryGuard.fixture_id
        statically in validate_catalog_invariants (VALID_SPEC_BOUNDARY_FIXTURE_IDS
        and VALID_TARGET_BOUNDARY_FIXTURE_IDS with runtime parity checks), pins
        LEAN_PATH="", import Lean.Environment, and -j1 / -M2048 / -s16384
        resource caps in run_lean_forge, adds unit/survivor/catalog tests in
        test_check_guard_mutation.py, aligns the 96-guard (80 + 4 + 12)
        descriptions across docs and guard_mutation, and documents
        -Zmir-opt-level=0 alongside -Zmir-preserve-ub in
        anneal/docs/build-systems-and-receipts.md (G2-R7-01: Phase-1 diagram at
        line 108 and injected/validated option lists at lines 156, 161) and
        anneal/docs/alpha.md (G2-R7-A04: line 102).
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 14/14 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs (closes G2-R8-01 inside
      rejects_forged_olean_keys_dups_replay_invariants_and_foundation_axiom_hijack
      with 7 negative diagnostic assertions covering validateReplayMap
      expected constructor ... for ..., constructor ... missing from ...,
      missing inductive ... for ..., recursor ... \all` differs from ..., missing inductive ... for recursor ..., .vendorMiri anonymous inductive on constructor ..., and Pass-2 .sysrootFoundation inventory origin mismatch ...), anneal/tests/audit/tests/target_audit.rs(3 negative/positive kernel-typechecking regression subcases forsorryAx-bearing .source
      .proofalternates),anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs(interleaving cleanly with[anneal] Add Tarjan SCC .olean sharding and BinChunkTree proof bridge #4234sharding), andanneal/tests/rustc-capture/tests/pass_order_sentinel.rs(updates seam-2 doc comment at line238to list-Zmir-opt-level=0alongside-Copt-level=0 -Zmir-preserve-ub, addressing G2-R7-A01`).
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, workflow permissions/triggers/pins, governing docs, policy/skill
    files, stated user specs, Trusted/Framework*.lean, and #[anneal::trusted]
    waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay/alternate/inventory/IR-helper
    invariants, anti-vacuity linting across Specs and SpecsV2, CI
    guard-mutation coverage, negative audit regression coverage, and
    capture-profile documentation).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple is
    (target_base = f5cdaf76557c2efa8619c8f8e41ee94a1eb87387, merge_base = f5cdaf76557c2efa8619c8f8e41ee94a1eb87387, head = 25a59f1674e35e539035c3d1aad7174fa1052170), with
    tree = f88b4d02a2832cae2219e90922214f04b09cc774 (29d3435578e5 +
    comment-wrap cleanup on boundary_audit.rs closing Gate-2 R8 G2-R8-01;
    single linear commit, clean working tree).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling and workflow comment (ci/,
    .github/workflows/anneal-current.yml), and Pass 1 docs and audit/CLI/capture
    test suites (docs/, tests/{audit,cargo-anneal,rustc-capture}). Relative
    to b1f88b5a3ba2 (which cleared CI SUCCESS + Codex CLEAN
    IC_kwDOH9mcF88AAAABrBZYfg + Gate-2 R8 seat2/seat3 clean), ONLY
    anneal/tests/audit/tests/boundary_audit.rs changed to add the 7 negative
    regression subcases requested by G2-R8-01 [P2] (0 changes to
    TrustedBoundary.lean, capture.rs, target.rs, ci/, or docs).
  3. Grouped coverage: All 14/14 changed paths across
    f5cdaf76557c..25a59f1674e3 (git diff --raw --no-renames) are inspected
    (0 inapplicable, 0 blocked):
    • anneal/tests/audit/tests/boundary_audit.rs (inspected): added
      negative tests in
      rejects_forged_olean_keys_dups_replay_invariants_and_foundation_axiom_hijack
      for expected constructor, constructor ... missing from, missing inductive (constructor and recursor), recursor ... \all` differs, .vendorMiri anonymous inductive on constructor, and Pass-2 .sysrootFoundation inventory origin mismatch`.
    • anneal/trusted/{audit/TrustedBoundary.lean,rustc-capture/src/capture.rs,cargo-anneal/src/target.rs},
      anneal/ci/{check_guard_mutation,test_check_guard_mutation}.py,
      .github/workflows/anneal-current.yml,
      anneal/docs/{alpha,auditing-and-comparator,build-systems-and-receipts,testing-architecture}.md,
      anneal/tests/audit/tests/target_audit.rs,
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs, and
      anneal/tests/rustc-capture/tests/pass_order_sentinel.rs (inspected):
      zero diff drift relative to b1f88b5a3ba2 via git range-diff.
  4. Realized capability and isolation: author_family: gemini; prior
    joshlf Gate-2 R5 CLEAN (d56edd614a1d), Codex CLEAN on b1f88b5a3ba2
    (IC_kwDOH9mcF88AAAABrBZYfg), Gate-2 R8 (pullrequestreview-6068640877:
    seat2 clean, seat3 clean, seat1 single [P2] missing-test finding
    G2-R8-01 now closed + non-blocking [P3] notes A01–A04), and fresh
    verification directly on 25a59f1674e3; holdout mode: none.
  5. Checks and probes:
    • Directly on 25a59f1674e35e539035c3d1aad7174fa1052170:
      • check_pr_hygiene.py --base origin/main --pr-body-file ... --receipt-file ... --json
        -> ok: true, 0 findings, 0 warnings.
      • (cd anneal && sha256sum --check --strict trusted/root-manifest.sha256)
        (4/4 OK), ./ci/check_todo.sh, ./anneal/ci/check_todo.sh,
        python3 -I -B ci/check_skills.py, git diff --check origin/main ->
        all exit 0.
      • cargo test --locked -p anneal-audit-tests --test boundary_audit rejects_forged_olean_keys_dups_replay_invariants_and_foundation_axiom_hijack
        -> 1 passed; 0 failed (54.45s).
      • (cd anneal && PYTHONPATH=ci python3 -B -m unittest -v test_check_pr_hygiene)
        -> Ran 98 tests in 16.101s: OK.
    • On identical TrustedBoundary.lean / capture.rs / target.rs / ci/ /
      docs (b1f88b5a3ba2, 525c6c1355e7, 40d688341de7, 5198b9b9fb31):
      20/20 anneal-audit --lib (0.81s), 19/19 cargo-anneal --lib target::tests (0.07s), 65/65 anneal-rustc-capture --lib (0.01s),
      7/7 pass_order_sentinel (120.40s), 7/7 stdlib_capture (93.98s),
      26/26 setup::tests (0.19s), 1/1
      anti_vacuity_lint_reports_truncated_wide_unsafe_body (57.55s),
      123/123 test_{ci_workflow,workflow_yaml,check_pr_hygiene} (218.535s),
      170/170 6-module Python CI (118.806s), 12/12 audit_boundary
      (105.36s), 62/62 boundary_audit (1612.55s), 44/44 target_audit
      (934.08s), 8/8 anti_vacuity (232.61s).
  6. Findings and blockers: G2-R8-01 [P2] resolved inline (PRRT_kwDOH9mcF868OB-h);
    8/8 review threads resolved (0 unresolved). Triggering @codex review
    and awaiting CI + Gate 2 R9 + human Gate 5.

Authored by an AI agent acting on mdittmer's behalf.

@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 25a59f1674

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 25a59f1674

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 9)

  • Identity: multi:24e6e7250c69c8f4df12f7520a8ee2e02d4b1f74:25a59f1674e35e539035c3d1aad7174fa1052170 (base=24e6e7250c69, head=25a59f1674e3, tree=f88b4d02a283)
  • Separation: author_family=gemini vs. reviewer_family=claude
  • Coverage: 14 inspected, 0 inapplicable, 0 blocked (of 14 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed findings 1 506s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed findings 1 698s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed findings 1 1139s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R9-01 P1 2 (seat2, seat3) probe_confirmed anneal/trusted/rustc-capture/src/capture.rs:3035 New -Zmir-opt-level=0 unit test calls validate_compiler_options with None, failing to compile on the target_base merge ref where the 5th parameter is FeaturePolicy<'_>.
G2-R9-02 P2 1 (seat1) static_verified anneal/trusted/audit/TrustedBoundary.lean:6916 The new targetAudit admission check that rejects sorry-bearing source-proof alternates whose names are in the Phase 1 closure has no negative test and no guard-mutation entry, and it reuses the Phase 1 closure's error message, so removing it would not fail any test.

G2-R9-01 [P1] (anneal/trusted/rustc-capture/src/capture.rs:3035, Pass 2 §2 (trusted/rustc-capture), probe_confirmed): New -Zmir-opt-level=0 unit test calls validate_compiler_options with None, failing to compile on the target_base merge ref where the 5th parameter is FeaturePolicy<'_>.

  • Invariant: PR changes must compile cleanly when merged onto target_base (24e6e7250c69c8f4df12f7520a8ee2e02d4b1f74) and pass CI without type mismatches.
  • Evidence: In head (25a59f1674e35e539035c3d1aad7174fa1052170, branched from merge_base f5cdaf76557c2efa8619c8f8e41ee94a1eb87387), anneal/trusted/rustc-capture/src/capture.rs:3026-3039 adds for mir_opt in [None, Some(1), Some(2)] calling validate_compiler_options(&mir_opts, ir::CrateType::Lib, ir::PanicStrategy::Unwind, false, None). On target_base (24e6e7250c69c8f4df12f7520a8ee2e02d4b1f74, #4374), validate_compiler_options at anneal/trusted/rustc-capture/src/capture.rs:1813-1819 takes features: FeaturePolicy<'_> and all surrounding test calls at lines 3175-3208 pass FeaturePolicy::Normal(&[]). git merge-tree --write-tree merges cleanly (tree 6e107017df2600414fa9e8c1b4fd1bdaf2dc6400) with zero textual conflict, leaving a type error at merged line 3227 that breaks anneal-rustc-capture test compilation on the PR merge commit. Rebase onto target_base and pass FeaturePolicy::Normal(&[]).

G2-R9-02 [P2] (anneal/trusted/audit/TrustedBoundary.lean:6916, Pass 2 §3 (trusted/audit), static_verified): The new targetAudit admission check that rejects sorry-bearing source-proof alternates whose names are in the Phase 1 closure has no negative test and no guard-mutation entry, and it reuses the Phase 1 closure's error message, so removing it would not fail any test.

  • Invariant: Pass 2 §3 mandatory negative tests: every added or modified admission guard needs a negative test asserting exit code 1 and its diagnostic, verified to fail if the guard is disabled (base AGENTS.md Code Review Rules; trust-review Pass 2 §3).
  • Evidence: TrustedBoundary.lean:6916-6918 (for n in altSorryDecls do if phase1Closure.contains n then fail "unapproved axiom sorryAx from Init.Prelude") is new. This is the only place a sorry-bearing alternate is rejected under allow_sorry_in_proof: runTargetClosurePhase follows lookup (the stored, sorry-free body), and the alternates loop (TrustedBoundary.lean:6855-6907) allows sorryAx for .source .proof alternates. The case is reachable: a Proof module redeclares, with a well-typed sorryAx body, a theorem that a Spec/Model/Expected constant references (for example a proof term inside a spec definition). Existing tests do not cover it. target_audit.rs:2606-2617 and 2876-2909 put sorry directly in Spec/Capture/Model/Expected, so the older Phase 1 closure check rejects them with the same message. The new target_audit_allow_sorry_alternate_keeps_non_sorry_deps_in_phase2 cases (target_audit.rs:4242-4520) use flip.eq_1 and Proof-only helpers outside the Phase 1 closure, and its positive control expects acceptance. No AUDIT_BOUNDARY_GUARDS entry anchors this check. Because the message is identical, a regression test would also need a fixture whose stored copy is sorry-free so that only this check can fire.

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R9-A01 [P3] (anneal/docs/build-systems-and-receipts.md:139): The linked capture-profile section in anneal/docs/trust-model.md#capture-profile-and-the-binary-seam still omits -Zmir-opt-level=0 (and -Zmir-preserve-ub) from the fixed capture profile list.
  • G2-R9-A02 [P3] (anneal/trusted/audit/TrustedBoundary.lean:3481): The 'uninventoried foundation constant' and 'uninventoried sysroot constant' checks (lines 3481, 3986, 3990) and the targetAudit .foundation inventory origin/IR-helper checks have no tests. Their comments describe them as unreachable defense in depth.
  • G2-R9-A03 [P3] (anneal/trusted/audit/TrustedBoundary.lean:6706): The new targetAudit library-inventory checks in the source-module loop (line 6706) and the proofExport loop (line 6749) reuse the runTargetClosurePhase message and have no dedicated test. The existing test (target_audit.rs:1113) passes through the older closure check, so these checks can be removed without failing it.
  • G2-R9-A04 [P3] (anneal/trusted/rustc-capture/src/capture.rs:2935): The receipt's target_base (f5cdaf7) is two commits behind the current target_base (24e6e72). Those commits also touch capture.rs, docs/alpha.md and pass_order_sentinel.rs. The merge is clean, but CI should be confirmed on the merged result.

Executed Sandbox Probes

  • seat1 Reviewer-authored Lean v4.34.1 snippet with or-pattern | .defnInfo v | .thmInfo v | .opaqueInfo v => v.all over ConstantInfo (no diff-derived code): outcome=pass
  • seat3 repo_hygiene_and_root_manifest: outcome=passed
  • seat3 python_ci_unit_suites: outcome=passed
  • seat3 python_ci_workflow_suite: outcome=partial_timeout
  • seat3 rustc_merge_skew_compile_repro: outcome=failed_confirmed_bug
  • seat3 rustc_mir_opt_level_0_semantics: outcome=passed
  • seat3 lean_vacuity_bitvec_fin_probe: outcome=passed
  • seat3 workflow_check_1_least_privilege_permissions: outcome=passed
  • seat3 workflow_check_2_untrusted_pr_triggers: outcome=passed
  • seat3 workflow_check_3_secret_containment: outcome=passed
  • seat3 workflow_check_4_release_environment_protection: outcome=passed
  • seat3 workflow_check_5_checkout_and_action_pinning: outcome=passed
  • seat3 workflow_check_6_no_shell_interpolation_injection: outcome=passed
  • seat3 workflow_check_7_cache_and_artifact_trust: outcome=passed
  • seat3 workflow_check_8_no_guard_relaxation: outcome=passed

Complement #4176 with defense-in-depth TCB checks across capture,
audit, spec vacuity linting, and guard-mutation coverage:

- `anneal-rustc-capture`: pass and require `-Zmir-opt-level=0` alongside
  `-Zmir-preserve-ub` in `run` and `validate_profile_options`, and
  document it in `docs/{build-systems-and-receipts,alpha}.md` and
  `pass_order_sentinel.rs`.
- `TrustedBoundary.lean`:
  - enforce checked-environment key parity and non-anonymity at import
    (`verifyCheckedEnvKeys` in `finalizeImportedEnv`), reject
    intra-module duplicate or misindexed declarations via
    `verifyModuleHeaderInventory`, and reject anonymous declaration
    names in `proofExport` target inventories;
  - reject key mismatches, base-environment shadowing, and post-replay
    declaration omission alongside mutual `all`, constructor, and
    recursor invariants in `validateReplayMap` and `replayKernelEnv`
    (with `hasNoDuplicateNames`), and require full header parity across
    imports and alternates (`sameConstantShape`, `RecursorVal.all`, and
    shared `sameUnsafeRecHeader`);
  - check authority edges on both `stored` and `ci` for subsumed
    `.foundation`, `.sysrootFoundation`, and `.source` alternates across
    Pass 1, Pass 2, and `targetAudit`; under `--allow-sorry-in-proof`,
    record sorry-bearing `.source .proof` alternates in `sorryDecls` and
    `axioms`, keep their non-`sorryAx` dependencies in `phase2Roots`,
    verify every alternate theorem body (including `sorryAx`-bearing
    `.source .proof` alternates, plus `phase2Roots` when `idx == 0`) via
    `checkAlternateProofs`, and reject any sorry alternate reaching
    `phase1Closure`;
  - require every checked constant with `.foundation` or
    `.sysrootFoundation` provenance to appear in its origin module's
    inventory, require target `.source` and `proofExport` constants with
    `.library` provenance to appear in that library's inventory, reject
    repository constants shadowing vendor or sysroot declarations in
    `correspondence-audit` (`replayCorrAndVendor`) before the
    `!replayRepo` early return, and reject kernel declarations colliding
    with IR-only `extraConstNames` entries across Pass 1, Pass 2, and
    `targetAudit` (including `proofExport`).
- `inspectSpecVacuity` / `cargo-anneal`: fix `Trusted.MirSemantics.*`
  and `BitVec`/`Option`/`Exists`/`Fin (k + 1)` domain matching, unify
  ordering checks on WHNF `Nat.le` (`decideNatLe?`), guard
  `OfNat.ofNat` on canonical `Nat`, fall back to `body#<idx>` when an
  `unsafe` `Body` has an empty `identity` string, emit explicit
  `vacuity_check_truncated` warnings with cause across `Specs` and
  `SpecsV2` program/body extraction (registered in `target.rs`), and add
  unit and E2E coverage across `target_audit`, `boundary_audit`, and
  `suite`.
- `check_guard_mutation.py`: add 12 `audit_boundary` guards covering
  `spec-preflight` and `target-audit` including foundation `propext`
  subsumption (96 total guards on top of `main`'s 84), validate
  `AuditBoundaryGuard.fixture_id` statically in
  `validate_catalog_invariants`, pin `LEAN_PATH=""`,
  `Lean.Environment`, and `-j1`/`-M2048`/`-s16384` caps in
  `run_lean_forge`, add unit/survivor tests in
  `test_check_guard_mutation.py`, and align guard-mutation docs and
  workflow comments.

Agent-authored-by: AI agent acting on mdittmer's behalf
@mdittmer
mdittmer force-pushed the trust-ux/pr2-olean-vacuity-guards branch from 25a59f1 to 7395a8d Compare November 26, 2026 05:27
@mdittmer

Copy link
Copy Markdown
Collaborator Author

Human review surface

  • TCB boundary & anti-vacuity inspector
    (anneal/trusted/audit/TrustedBoundary.lean):
    • Enforces checked-environment key parity and non-anonymity at .olean
      import (verifyCheckedEnvKeys in finalizeImportedEnv), rejects
      intra-module duplicate or misindexed declarations
      (verifyModuleHeaderInventory), and rejects anonymous declaration names in
      proofExport target inventories.
    • Rejects key mismatches, base-environment shadowing, and post-replay
      declaration omission alongside mutual all, constructor, and recursor
      invariants in validateReplayMap and replayKernelEnv (with
      hasNoDuplicateNames and inline defense-in-depth invariant comments on
      caller-filtered branches), and enforces full header parity across
      imports, alternates, and ._unsafe_rec pairs (sameConstantShape,
      RecursorVal.all, and shared sameUnsafeRecHeader).
    • Checks authority edges on both stored and ci across Pass-1
      .foundation alternates (verifyAndCollectLocals), Pass-2 .foundation
      and .sysrootFoundation alternates (checkSysrootAlternates), and Phase-4
      targetAudit pendingSourceAlternates (storedOrigin + ciOrigin);
      under --allow-sorry-in-proof, records sorry-bearing .source .proof
      alternates in sorryDecls and axioms, keeps their non-sorryAx
      dependencies in phase2Roots, pushes every alternate theorem body
      (including sorryAx-bearing .source .proof alternates, since base
      already declares Init.Prelude.sorryAx, plus p.name into phase2Roots
      when idx == 0) for fresh kernel typechecking via checkAlternateProofs,
      and rejects any sorry alternate reaching phase1Closure.
    • Requires every checked constant with .foundation or .sysrootFoundation
      provenance to appear in its origin module's inventory, requires target
      .source and proofExport constants with .library provenance to appear
      in that library's inventory, rejects repository constants shadowing vendor
      or sysroot declarations in correspondence-audit (replayCorrAndVendor)
      before the !replayRepo early return (even when replayRepo = false),
      rejects kernel declarations colliding with IR-only extraConstNames entries
      across Pass 1, Pass 2, and targetAudit (including proofExport), and
      keeps #4330 Program.mk 6-field reduction checks
      (progArgs.size != 6 returning
      (#[], some "unreducible Captured.program constructor"), preserving
      #4229 module-mode target rules, #4236 decoupled
      Anneal.MirWp.Canaries checks, and #4237 Profile v2 SpecsV2 target
      claims).
    • Fixes Trusted.MirSemantics.* and BitVec / Option / Exists /
      Fin (k + 1) domain matching (isKnownInhabitedDomain with constructive
      inhabitance witness comments and extractBitVecLit?), unifies ordering
      checks on WHNF Nat.le (decideNatLe?), guards OfNat.ofNat on canonical
      Nat, falls back to body#<idx> when an unsafe Body carries an empty
      identity string, and emits explicit vacuity_check_truncated warnings
      with cause across extractCapturedBodies and inspectSpecVacuity for both
      Specs and SpecsV2 (shape.specLabel).
  • TCB MIR capture driver (anneal/trusted/rustc-capture/src/capture.rs):
    • Passes -Zmir-opt-level=0 alongside -Zmir-preserve-ub,
      -Coverflow-checks={yes,no}, and #4374's FeaturePolicy /
      -Zallow-features= in run (covering both standard and --stdlib-crate
      capture paths), cites the exact upstream mir_preserve_ub pass conditions
      in remove_place_mention.rs and simplify.rs (clarifying that
      -Zmir-preserve-ub does not force -Zmir-opt-level=0), and requires
      opts.unstable_opts.mir_opt_level == Some(0) fail-closed in
      validate_profile_options (with negative unit tests in capture::tests
      updated onto #4374's FeaturePolicy::Normal(&[]) 5th argument, closing
      G2-R9-01).
  • TCB CLI target-audit schema (anneal/trusted/cargo-anneal/src/target.rs):
    • Registers "vacuity_check_truncated" in VALID_SPEC_WARNING_CODES
      (src/bundled_resources.rs stays deleted following #4244, with
      build.rs + trusted_bundle.rs embedding TrustedBoundary.lean from
      canonical workspace sources alongside #4335's Trusted.Framework*
      registrations and #4215 inspect/verdict updates).
  • CI guard-mutation harness, workflow comment & architecture/capture docs
    (anneal/ci/check_guard_mutation.py,
    anneal/ci/test_check_guard_mutation.py,
    .github/workflows/anneal-current.yml,
    anneal/docs/{alpha,auditing-and-comparator,build-systems-and-receipts,testing-architecture}.md):
    • Adds AuditBoundaryGuard and 12 audit_boundary guards (96 total
      guards on top of #4266's 84: 80 mir_semantics + 4 audit_headers
      • 12 audit_boundary) covering spec-preflight
        (spec_preflight_reject_{auto_implicit,bang_ident,dbg_trace,uv_open}) and
        target-audit (target_audit_reject_{expected_mismatch,theorem_type,
        proof_sorry,compiler_override,transitive_spec_dbg,dup_library,
        unsafe_rec_type_mismatch,foundation_propext_hijack} with #4229
        "isModule": False expectations), validates AuditBoundaryGuard.fixture_id
        statically in validate_catalog_invariants (VALID_SPEC_BOUNDARY_FIXTURE_IDS
        and VALID_TARGET_BOUNDARY_FIXTURE_IDS with runtime parity checks), pins
        LEAN_PATH="", import Lean.Environment, and -j1 / -M2048 / -s16384
        resource caps in run_lean_forge, adds unit/survivor/catalog tests in
        test_check_guard_mutation.py, aligns the 96-guard (80 + 4 + 12)
        descriptions across docs and guard_mutation, and documents
        -Zmir-opt-level=0 alongside -Zmir-preserve-ub in
        anneal/docs/build-systems-and-receipts.md (G2-R7-01: Phase-1 diagram at
        line 108 and injected/validated option lists at lines 156, 161) and
        anneal/docs/alpha.md (G2-R7-A04: line 102, rebased cleanly with #4374).
  • Non-TCB regression & E2E test suites (outside trusted/ and ci/, listed
    for full 14/14 git diff-tree accounting):
    • anneal/tests/audit/tests/boundary_audit.rs (closes G2-R8-01 inside
      rejects_forged_olean_keys_dups_replay_invariants_and_foundation_axiom_hijack
      with 7 negative diagnostic assertions),
      anneal/tests/audit/tests/target_audit.rs (adds 4 negative/positive
      subcases in target_audit_allow_sorry_alternate_keeps_non_sorry_deps_in_phase2
      including Case 6 closing G2-R9-02: sorry-free .foundation flip.eq_1
      in Phase-1 Spec.specs overridden in Proof.olean via proofExport,
      uniquely rejected at post-Phase-1 altSorryDecls gate with exit code 1
      and "unapproved axiom sorryAx from Init.Prelude"),
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs
      (interleaving cleanly with #4234 sharding), and
      anneal/tests/rustc-capture/tests/pass_order_sentinel.rs (seam-2 doc
      comment listing -Zmir-opt-level=0 alongside #4374's seam_4b).
  • Unchanged Human review surfaces: anneal/trusted/root-manifest.sha256,
    lockfiles, workflow permissions/triggers/pins, governing docs, policy/skill
    files, stated user specs, Trusted/Framework*.lean, and #[anneal::trusted]
    waivers are untouched.
  • Intentional policy relaxations: none (pure tightening across MIR
    capture flags, .olean import/replay/alternate/inventory/IR-helper
    invariants, anti-vacuity linting across Specs and SpecsV2, CI
    guard-mutation coverage, negative audit regression coverage, and
    capture-profile documentation).

Review Receipt

  1. Comparison tuple: Reviewed commit tuple is
    (target_base = 24e6e7250c69c8f4df12f7520a8ee2e02d4b1f74, merge_base = 24e6e7250c69c8f4df12f7520a8ee2e02d4b1f74, head = 7395a8d5497fc1be825b36f38b452f624aa12179), with
    tree = 0e5fc5289ca0c57c4e24f35c3452aeb15c487202 (clean rebase onto
    origin/main 24e6e7250c69 incl. #4258 + #4374, closing Gate-2 R9
    G2-R9-01 [P1] and G2-R9-02 [P2]; single linear commit, clean working
    tree).
  2. Risk and refinement rationale: Touches Pass 2 TCB surfaces
    (trusted/audit, trusted/rustc-capture, trusted/cargo-anneal), Pass 2
    §5 CI guard-mutation tooling and workflow comment (ci/,
    .github/workflows/anneal-current.yml), and Pass 1 docs and audit/CLI/capture
    test suites (docs/, tests/{audit,cargo-anneal,rustc-capture}). Relative
    to 25a59f1674e3 (which cleared CI SUCCESS + Codex CLEAN
    IC_kwDOH9mcF88AAAABrCO23A + b1f88b5a3ba2 R8 seat2/seat3 clean),
    rebased cleanly onto 24e6e7250c69 (#4374), updated the -Zmir-opt-level=0
    unit test call at capture.rs:3227 to pass FeaturePolicy::Normal(&[])
    (G2-R9-01), and added Case 6 in target_audit.rs (G2-R9-02).
  3. Coverage accounting: All 14/14 changed paths across
    24e6e7250c69..7395a8d5497f (git diff --raw --no-renames) are inspected
    (0 inapplicable, 0 blocked):
    • anneal/trusted/rustc-capture/src/capture.rs (inspected): -Zmir-opt-level=0
      unit test updated for #4374 FeaturePolicy::Normal(&[]) parameter (G2-R9-01).
    • anneal/tests/audit/tests/target_audit.rs (inspected): Case 6
      (f_sorry_phase1_alt) added to
      target_audit_allow_sorry_alternate_keeps_non_sorry_deps_in_phase2
      exercising TrustedBoundary.lean:6916-6918 (G2-R9-02).
    • anneal/trusted/{audit/TrustedBoundary.lean,cargo-anneal/src/target.rs},
      anneal/ci/{check_guard_mutation,test_check_guard_mutation}.py,
      .github/workflows/anneal-current.yml,
      anneal/docs/{alpha,auditing-and-comparator,build-systems-and-receipts,testing-architecture}.md,
      anneal/tests/audit/tests/boundary_audit.rs,
      anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs, and
      anneal/tests/rustc-capture/tests/pass_order_sentinel.rs (inspected):
      cleanly preserved atop #4374 with zero logic drift relative to
      25a59f1674e3.
  4. Realized capability and isolation: author_family: gemini; prior
    joshlf Gate-2 R5 CLEAN (d56edd614a1d), Codex CLEAN on 25a59f1674e3
    (IC_kwDOH9mcF88AAAABrCO23A) + CI SUCCESS on 25a59f1674e3, Gate-2 R9
    (pullrequestreview-6068860870: G2-R9-01 + G2-R9-02 now both closed),
    and fresh verification directly on 7395a8d5497f; holdout mode: none.
  5. Checks and probes:
    • Directly on 7395a8d5497fc1be825b36f38b452f624aa12179:
      • check_pr_hygiene.py --base origin/main --pr-body-file ... --receipt-file ... --json
        -> ok: true, 0 findings, 0 warnings.
      • (cd anneal && sha256sum --check --strict trusted/root-manifest.sha256)
        (4/4 OK), ./ci/check_todo.sh, ./anneal/ci/check_todo.sh,
        python3 -I -B ci/check_skills.py, git diff --check origin/main ->
        all exit 0.
      • cargo test --locked -p anneal-audit --lib -> 20 passed; 0 failed
        (0.70s); cargo test --locked -p cargo-anneal --lib target::tests ->
        19 passed; 0 failed (0.06s).
      • nightly-2026-05-31: cargo test --locked -p anneal-rustc-capture --lib
        -> 68 passed; 0 failed (0.01s); cargo test --locked -p anneal-rustc-capture-tests --test pass_order_sentinel -> 8 passed; 0 failed (121.05s).
      • cargo test --locked -p anneal-audit-tests --test target_audit target_audit_allow_sorry_alternate_keeps_non_sorry_deps_in_phase2 ->
        1 passed; 0 failed (204.29s, incl. new Case 6 G2-R9-02).
      • (cd anneal && PYTHONPATH=ci python3 -B -m unittest -v test_ci_workflow test_workflow_yaml test_check_pr_hygiene)
        -> Ran 123 tests in 222.486s: OK.
    • On prior identical TrustedBoundary.lean / boundary_audit.rs /
      target.rs / ci/ / docs (25a59f1674e3, b1f88b5a3ba2, 525c6c1355e7,
      40d688341de7, 5198b9b9fb31):
      rejects_forged_olean_keys_dups_replay_invariants_and_foundation_axiom_hijack
      (1/1, 54.45s), 7/7 stdlib_capture (93.98s), 26/26 setup::tests
      (0.19s), 1/1 anti_vacuity_lint_reports_truncated_wide_unsafe_body
      (57.55s), 170/170 6-module Python CI (118.806s), 12/12
      audit_boundary (105.36s), 62/62 boundary_audit (1612.55s),
      44/44 target_audit (934.08s), 8/8 anti_vacuity (232.61s).
  6. Findings and blockers: Both G2-R9-01 [P1] (PRRT_kwDOH9mcF868OdK7)
    and G2-R9-02 [P2] (PRRT_kwDOH9mcF868OdK_) resolved inline; 10/10
    review threads resolved (0 unresolved). Triggering @codex review and
    awaiting CI + Gate 2 R10 + human Gate 5.

Authored by an AI agent acting on mdittmer's behalf.

@mdittmer

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 7395a8d549

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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

anneal Primary scope: Anneal verification stack (`anneal/` and `exocrate/`)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants