Skip to content

fix(verdict): verify Lean version and invalidate unversioned kernel caches - #1339

Merged
Lorenzobattistela merged 2 commits into
bendlang:mainfrom
oxura:fix/kernel-toolchain-cache
Oct 5, 2026
Merged

Lorenzobattistela merged 2 commits into
bendlang:mainfrom
oxura:fix/kernel-toolchain-cache

Conversation

@oxura

@oxura oxura commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #1332.

Pin the compiler check and cache namespace to Lean 4.34.0. A cache miss checks lean --version before any compilation, then builds the kernel. The key includes the pinned release and source; source-only legacy caches are ignored. Verified versioned caches still work without an installed Lean, and an explicit BENDTT override is unchanged.

Local end-to-end verification:

  • Downloaded the actual Lean 4.34.0 release and built BendTT from this checkout in an isolated HOME. CLI --verdict returns ALL PROOFS CHECK.
  • A PATH Lean reporting 4.32.0, with an old source-only cache already present, is rejected with found/required versions. Invocation log contains only --version, never compilation.
  • The verified new cache works when PATH instead contains that incompatible compiler, without invoking it again.
  • Explicit BENDTT still passes with the incompatible compiler on PATH.
  • CHANGELOG.md updated. No language, gate, cap, or cluster changes.

@oxura

oxura commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Joint local verification of #1337–#1341 against main 565d7fd, including the constructor-model correction in #1338:

  • Combined repository gate: PASS 50 / 50; original caps/core-language/gates unchanged.
  • Actual Lean 4.34.0 BendTT kernel accepts all six positive new proof fixtures, existing vec_safe_lookup, Base's Type-model control and compact 9000 Nat control. The 4097 regression uses an independent 2^12+1 structural value oracle.
  • User-defined parameterized/def Unit remains explicitly out of elaboration scope (no model for idt~A), not a claimed kernel success.
  • Versioned kernel cache works with no Lean on PATH. The earlier incompatible 4.32/source-only-cache and explicit BENDTT controls were also exercised.
  • Combined emitted HTTP JS retains ABC across fragmented headers and six receives. Individual HTTP smoke additionally used actual TCP under Bun/native C and an exact 65536-character response split into 65536 one-character receives.
  • Combined generated CUDA C reports cuInit(0) failed: CUDA_ERROR_UNKNOWN when forced under fault injection; automatic CPU fallback prints 2147450880 without diagnostics.
  • Code changes merge automatically. Only additive Unreleased CHANGELOG entries needed combining in the local integration checkout.

No physical GPU, macOS/Metal runtime, or mini-cluster gate was exercised. Separate PR source branches remain independent; the integration branch is local verification only.

@Lorenzobattistela Lorenzobattistela left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, this fixes #1332 the right way: the Lean version is now in the cache key, and lean --version is checked before anything is compiled. I ran it against the toolchains here and it does what the description says. Two changes before merge:

  1. The version regex needs the m flag (bend2/safe.ts, the version.match(...) line)

run_read returns stdout and stderr as one text, and /^Lean (version .../ only matches at the very start of it. When lean on the PATH is elan's launcher, elan can print lines like info: syncing channel updates… or info: downloading component 'lean' to stderr before Lean's banner. The match then fails, and a real 4.34.0 is rejected with "the kernel did not build". Running it a second time works.

I reproduced it with an empty HOME and a lean on the PATH that prints an info: line before the real 4.34.0 banner:

  • As the PR stands, it's rejected: the kernel did not build (lean --version: info: syncing channel updates for 'leanprover/lean4:v4.34.0' / Lean (versi
  • With /^Lean (version ([^,\s)]+)/m, the kernel builds and the verdict gives ALL PROOFS CHECK.
  • With the same setup but 4.34.1, it's stirsion is run.
-  if (version.match(/^Lean \(version ([^,SION) {
+  if (version.match(/^Lean \(version ([^,\s)]+)/m)?.[1] !== LEAN_VERSION) {
  1. Please remove the CHANGELOG change entirely. We don't keep an Unreleased section; the release notes are written when a release is cut.

@Lorenzobattistela Lorenzobattistela self-assigned this Oct 5, 2026
@Lorenzobattistela
Lorenzobattistela merged commit 1a2e5cd into bendlang:main Oct 5, 2026
1 check passed
@oxura

oxura commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Confirmed the merged kernel builder uses multiline banner matching (/m) and leaves CHANGELOG.md unchanged. I built the current main kernel with real Lean 4.34.0 and used it for the new proof regressions. Thanks for the elan-first-launch case; future cache/toolchain changes must preserve that banner handling.

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.

--verdict: the cached kernel is reused whatever Lean built it, and the PATH fallback never checks the Lean version (2.0.35)

2 participants