← Back to Pull requests

ci: fix docs build OOM and move back to the official docgen-action #519

Closed
unknown closed this pull request without merging on Nov 23, 2026 22:40 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 21:56 UTC
Author

What's broken

The Compile blueprint and documentation step has failed on every push to main since #506 (14 Nov). Last green run on main was #508 on 11 Nov. Three consecutive failures: 14 Nov, 21 Nov, 23 Nov.

The failure is always the same:

ℹ [7567/11316] Built «doc-gen4»/coreDocs (694s)
✖ [7569/11316] Running batteries:srcUri.github
error: resource exhausted (error code: 12, not enough memory)
error: build failed

PRs never caught this because Build project API documentation is gated on github.event_name == 'push' — API docs are only built on pushes to main.

Why it happens

doc-gen4 leaves a very large heap resident after building coreDocs. When Lake then forks git for the srcUri.github targets, the kernel's default overcommit heuristic refuses the fork.

This is the overcommit heuristic, not genuine exhaustion:

  • only the targets that spawn a subprocess fail — srcUri.github for each dependency;

  • no Lean elaboration target fails;

  • Lean itself is never OOM-killed (no exit 137).
  • Fix 1: give the docs build headroom to fork

    vm.overcommit_memory=1 makes the kernel allow the fork. The swapfile is belt-and-braces for real pressure, and lives on /mnt (the ~70 GB temp disk) so it doesn't compete with the docs build for space on /. The existing free-disk-space step already has swap-storage: false, so it isn't fighting this.

    There is no cleaner "use fewer jobs" knob: Lake 5.0 (Lean 4.36) has no -j flag and no LAKE_JOBS-style env var, and the action gives no way to pass lean -j/-M into doc-gen4's build.

    Fix 2: back to the official docgen-action

    Both fixes we needed from dwrensha/docgen-action are now upstream:

    | fork workaround | upstreamed as |
    |---|---|
    | user project after doc-gen4 in docbuild/lakefile.toml (the plausible version skew that forced full mathlib rebuilds) | docgen-action#32 |
    | force doc-gen4's HTML pass to re-run after a cache hit (the project-page 404s) | docgen-action#38 |

    scripts/build_docs.sh is otherwise identical between the two (comments plus a better-guarded sudo chown upstream), and dist/index.js is byte-identical, so the cached paths don't change and there's no forced cache-version miss.

    ruby-version: "3.1" preserves what the fork hardcoded — home_page/Gemfile uses the github-pages gem, which does not build on the official action's 3.4 default. Upstream also ungated the Jekyll steps from push, so the homepage build now runs on PRs too.

    Reviewer note: this PR's CI cannot prove the fix

    Build project API documentation is push-gated, so this PR will go green whether or not the OOM is fixed. Only the merge to main exercises it.

    What the PR run does confirm: the new step runs and free -h shows the 16 GB swapfile, and the Jekyll build now runs on PRs, confirming the Ruby 3.1 pin.

    Also note the docs cache is currently dead and cannot self-heal: the key is Docs-${{ hashFiles('lake-manifest.json', 'references.bib') }}, #510 moved it to 470e9af…, the only cache present is Docs-dd2ccf… from 5 Nov, and actions/cache is post-if: success() so a failing job never writes one. The first green run on main repopulates it and later runs drop from ~11.3k targets back to the cheap path.

    If it still OOMs after merge, the next lever is a one-off continue-on-error: true on the docgen step to force a partial cache save, then revert it.

    🤖 Generated with Claude Code

    Diff: 434 lines (+325 / -109) across 5 files Reviewer: seewoo5 Review duration: 44m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 434 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.363
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #519"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.2% (MEDIUM) · Higher = larger blast radius
    45.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.8% · Safe to merge
    17.8%