Skip to content

P0: Lean/leanchecker must not overload lambda — narrow Mathlib imports, lake build vs leanchecker tiers, thread cap, no heavy kernel decide #4348

Closed
1 of 1 issue completed

Description

@noahgift

Operator, verbatim, 2026-09-25: "yes to all, p0" (answering the cop's 4 proposals below). Context, verbatim: "remember this host must be able to do other work, so never let it get overloaded"

Measured 2026-09-25 07:34Z on lambda:

  • leanchecker ProvableContracts (pvl-a, PID 614236) used 51 threads, about 9 cores, and 58 to 60 GB RSS.
  • Host load was 79 on 48 cores; memory was 99 of 125 GB.
  • Cause: the project does require mathlib (5.4 GB of compiled .olean files). leanchecker reloads and re-checks the whole imported environment. Our own 237 .lean files are a small share of that.

P0 — all four:

  1. Narrow the imports: no import Mathlib. Import only the specific Mathlib modules each file needs. Receipt: RSS and wall time before and after.
  2. Split the check tiers:
    • Day to day: lake build, which trusts Mathlib's compiled files and checks only our files.
    • Release gate only: leanchecker, run under systemd-run --user --scope -p MemoryMax=24G -p CPUQuota=800%, or on gx10 after checking disk space.
    • The pv discharge check --leanchecker call sites and CI must follow this split.
  3. Cap threads: at most 8 threads for Lean and leanchecker (-j8 / LEAN_NUM_THREADS=8 or its equivalent). Make it the default in the pv wrapper.
  4. Keep computation out of the kernel: for PVL: prove all 7 escape-allowlist axioms (DPO x3, f16 bound, NF4 x3) instead of confirming them #4347 (the NF4 table and the others), prefer norm_num, simp or rfl lemmas over heavy decide. Never use native_decide, because it adds an axiom.

Done when: a full pv discharge check --leanchecker runs within 24G and 800% CPU on lambda, and a regression guard fails if an unscoped leanchecker invocation appears in scripts or CI.

Folded sub-tickets (TRIAGE-100, 2026-10-14)

These open sub-tickets were folded here as checklist rows and closed as not planned so the open count stays at or under 100. Reopen one when its work resumes; an open PR for it reopens it.

Activity

  1. added this to the 0.70.0 milestone on Sep 25, 2026
  2. noahgift commented on Sep 25, 2026

    @noahgift
    MemberAuthor

    Already implemented on B3 (fold/b3-contracts-ont-docs, PR #4317): c2efb7f, 0a79b45 (the caps are ceilings: can be lowered, never raised) and 1498cf9 (guard self-exclusion), folded at 41488ee.
    All four asks are covered, per c2efb7f:

    • Narrowed imports, no bare import Mathlib.
    • pv discharge check --leanchecker and run default to LEAN_NUM_THREADS=8 inside a systemd-run --scope --slice=agent.slice -p MemoryMax=24G -p CPUQuota=800% scope.
    • build.sh runs lake build with 8 threads.
    • NF4 decide +kernel was measured light (2.15 s, 2.7 GB); native_decide is not used.

    Guard: scripts/check_leanchecker_scoped.sh (a 23-row case table).
    Done-when receipt: full-tree pv discharge check --leanchecker exits 0 in 162 s, with scope memory peak at the 24G cap and at most 11 threads. Before: 51 threads, 58–71 GB.
    Closes when #4317 lands. It carries no Fixes #4348.

  3. modified the milestones: 0.70.0, 0.70.1 on Sep 26, 2026
  4. added 4 commits that reference this issue on Sep 26, 2026
  5. 3 remaining items

  6. modified the milestones: 0.70.1, 0.71.0 on Oct 4, 2026
  7. noahgift commented on Oct 12, 2026

    @noahgift
    MemberAuthor

    Receipt on main @ 03d4af1: the done-when is met, and the fix is already on main. It landed through the B3 fold (#4655) after #4317 was closed.

    What is on main

    • pv discharge check --leanchecker caps the run at 8 threads (LEAN_NUM_THREADS) inside a user scope: MemoryMax=24G, CPUQuota=800%, agent.slice. The defaults are also the ceilings.
    • The staging build.sh exports LEAN_NUM_THREADS=8.
    • No bare import Mathlib is left. The imports are narrowed to modules such as Mathlib.Data.Real.Basic.
    • scripts/check_leanchecker_scoped.sh is wired through ci/sections.yml. It passes 27/27 case-table rows and scans 492 files with 0 unscoped.

    Measured run on the 48-core host, with the tree checked out at that sha:

    • Build: build.sh in a MemoryMax=24G CPUQuota=800% scope finished with rc 0 in 37.25 s, 4903 jobs, peak memory 3933M.
    • Check: pv discharge check crates/aprender-contracts-staging/lean --leanchecker --leanchecker-timeout 1500 finished with exit 0 in 1:41.80 wall time. It printed ok lake env leanchecker ProvableContracts (timeout 1500s, 8 threads, scope MemoryMax=24G CPUQuota=800%).
    • During the check:
      • The scope's memory.peak reached 24576M against memory.max 25769803776, so the cap held at its ceiling.
      • cpu.max read 800000 100000.
      • The highest 1-minute load was 16.01 on 48 cores, against about 14 just before the run.
      • Memory in use on the host was 29G of 125G before the run.

    No code is owed. Leaving the issue open for the closure call.

    🤖 Generated with Claude Code

  8. modified the milestones: 0.71.0, 0.72.0 on Oct 14, 2026
  9. noahgift commented on Oct 14, 2026

    @noahgift
    MemberAuthor

    Done-when evidence, re-read on main @ 8c3b19c8c1 (2026-10-14).

    • The measured receipt is the comment of 2026-10-12 above, taken on main @ 03d4af19f0. In it, pv discharge check --leanchecker exited 0 in 1:41.80. The run used 8 threads inside a MemoryMax=24G CPUQuota=800% scope. The scope's memory.peak reached the 24G ceiling, so the cap held. The highest 1-minute load was 16.01 on 48 cores.
    • Today's tree still holds every part of it:
      • The .lean files have 0 bare import Mathlib lines.
      • scripts/check_leanchecker_scoped.sh is still wired in ci/sections.yml, with its self-test and a bare run (2 lines).
    • Still open from the folded rows: pv discharge run: the Lean comparator arm is not memory-capped (51-72 GB RSS, OOM kills runners) #4638. The comparator and Axioms.lean arms of pv discharge run have only a wall-clock timeout and no memory cap. The fix is on fix/4638-lean-arms-scoped and has no PR yet. It is queued for a pull-request slot.

    This lane does not close the issue.

    🤖 Generated with Claude Code

  10. noahgift commented on Oct 14, 2026

    @noahgift
    MemberAuthor

    Closing on evidence (cop batch call, 2026-10-14): fix landed on main through the B3 fold, PR #4655 (merged 2026-10-02, 989cb01). Done-when is met per the measured receipt on main @ 03d4af1 (2026-10-12): pv discharge check --leanchecker exit 0 in 1:41.80, 8 threads, MemoryMax=24G CPUQuota=800% scope. Regression guard scripts/check_leanchecker_scoped.sh is wired in CI; 0 bare import Mathlib lines (re-read on main @ 8c3b19c). Folded row #4638 (comparator/Axioms arms, no memory cap) is tracked in its own issue and reopens with its PR. Evidence by laya-train comments above.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions