Skip to content

[anneal] Add ClaimAudit preflight, 2-phase audit, and cached .olean - #3969

Open
joshlf wants to merge 1 commit into
joshlf-anneal-cl3b-execsealfrom
joshlf-anneal-cl3b-claimaudit
Open

joshlf wants to merge 1 commit into
joshlf-anneal-cl3b-execsealfrom
joshlf-anneal-cl3b-claimaudit

Conversation

@joshlf

@joshlf joshlf commented Nov 20, 2026

Copy link
Copy Markdown
Member

Human review surface

Implement ClaimAudit specification preflight, 2-phase target-audit with sealed Spec/Captured environments, and once-per-Checker precompilation of staged TrustedBoundary.olean.

Layer 18 of 19 in the migrated Anneal verification stack under anneal/.

Public Anneal source checkpoint.

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

Implement ClaimAudit specification preflight, 2-phase target-audit with sealed Spec/Captured environments, and once-per-Checker precompilation of staged TrustedBoundary.olean.

Source: https://github.com/joshlf/anneal/tree/dfe5e02478ab99734150962bd67c3662b86bf33b
Agent-authored-by: AI agent acting on joshlf's behalf
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 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-20T15:44:55.279198Z 5dd8e06 PR opened
ℹ️ 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.

@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: 5dd8e066e1

ℹ️ 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".

Comment on lines +1438 to +1441
let args = vec![
"-j1".to_string(),
mem_limit,
"-R".to_string(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve mandatory Lean compilation flags

Add -DElab.async=false and -Ddebug.skipKernelTC=false to both new inspector-compilation argument lists. Every inspector invocation now consumes this cached .olean, but unlike the existing module compilation paths, both the direct and sandboxed branches omit the repository-required synchronous and kernel-checking flags, so the trusted inspector is no longer built under the fixed compilation contract.

AGENTS.md reference: anneal/AGENTS.md:L263-L268

Useful? React with 👍 / 👎.

Comment on lines +1943 to +1946
def preflightSpecs (j : Json) (foundation : Array Name) : IO Json := do
let libraries ← names j "libraries"
let sources ← field (α := Array (String × String)) j "sources"
let env ← importEnv j (foundation ++ libraries) true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep extension loading out of target spec preflight

Passing true here makes every spec-preflight call execute imported initializers and persistent-extension callbacks through enableInitializersExecution, creating a third loadExts := true mode even though the trusted-boundary policy restricts extension loading to the locked preflight and correspondence-preflight modes. This affects every target containing a specification and expands the executable TCB before target compilation; either avoid extension loading here or explicitly establish and review a replacement invariant for this new mode.

AGENTS.md reference: anneal/AGENTS.md:L263-L271

Useful? React with 👍 / 👎.

Comment on lines +1193 to +1198
/// `"headers"` rejects Lean 4 module-system headers (`module`), import
/// modifiers (`import all`, `public import`, `meta import`), and
/// `Lean.*`/`Lake.*` imports with exit code 1, while accepting omitted
/// `prelude` (synthetic non-meta + meta `Init` pair) in unpinned mode.
#[test]
fn headers_rejects_module_system_modifiers_and_lean_lake_and_allows_no_prelude() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add required guard-sensitivity tests

The new header, specification-preflight, and target-audit guards are covered only by additions to target_audit.rs; none of these tests disables its target guard to demonstrate that the negative case becomes accepted, and this commit does not update boundary_audit.rs. Consequently the new trust-boundary checks lack the required sensitivity evidence and could become vacuous or be disconnected without the mandated regression suite detecting it.

AGENTS.md reference: anneal/AGENTS.md:L272-L276

Useful? React with 👍 / 👎.

Comment on lines +1698 to +1701
if forbiddenSpecIdentifiers.contains val then
fail s!"disallowed identifier {val} in specification"
if forbiddenSpecRootNamespaces.contains val.getRoot then
unless allowedSystemPlatformDecls.contains val do

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Normalize root-qualified identifiers before admission checks

An explicitly rooted identifier such as _root_.autoParam or _root_.IO.println has _root_ as getRoot, so neither the exact forbidden-identifier check nor the forbidden-namespace check matches it. In particular, _root_.autoParam still resolves to the elaborator-recognized declaration and can execute a stored tactic script during specification elaboration, bypassing the new preflight guard; strip rootNamespace before applying both policies, as the later kernel checks already do.

AGENTS.md reference: anneal/AGENTS.md:L254-L271

Useful? React with 👍 / 👎.

Comment on lines +1125 to +1127
if imp.isMeta then
unless imp.module == `Init && hasNonMetaInit do
fail s!"meta import {imp.module} is unsupported in {context}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject explicitly authored meta imports of Init

When a source explicitly contains both import Init and meta import Init, hasNonMetaInit is true and this accepts the meta edge even though the exception is intended only for the synthetic pair produced when prelude is omitted. The same predicate is duplicated in the Rust admission path, so the authored modifier survives both checks; bind the exception to an omitted-prelude header or otherwise distinguish the synthetic edge from an explicit meta import.

AGENTS.md reference: anneal/AGENTS.md:L254-L262

Useful? React with 👍 / 👎.

Comment on lines +704 to +708
let spec_libraries: BTreeSet<String> = {
let adm = self.admitted()?;
let mut visited_mods: BTreeSet<String> = BTreeSet::new();
let mut libs: BTreeSet<String> = BTreeSet::new();
let mut queue: VecDeque<String> = spec_sources.iter().map(|(m, _)| m.clone()).collect();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Parse each specification against its own import closure

This builds one union closure starting from every specification module and then parses all of their sources in the resulting shared parser environment. When two specifications import different Init/Std libraries, parser extensions, scoped syntax, and namespace state reachable only from one module can therefore change how the other module is preflighted, rather than matching the environment used to compile that file. Compute and use a separate authenticated closure per specification (or group only identical closures).

AGENTS.md reference: anneal/AGENTS.md:L263-L271

Useful? React with 👍 / 👎.

@joshlf
joshlf added this pull request to stack #3976 November 20, 2026 17:58

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant