Repository navigation
fix(safe): each kernel build goes in a dir of its own, renamed into place whole - #1949
Merged
nicolas-abril merged 2 commits intoOct 29, 2026
Merged
Conversation
…lace whole --verdict built the kernel in ~/.bend/bendtt/<hash>/ itself, so runs that started together on an empty cache wrote over each other's bendtt.c: four at once failed a run in 3 of 5 tries (leanc: undefined symbol: main). And the cache took bendtt's existence as built, while leanc wrote it in place. kernel_bin now builds in a fresh build-XXXXXX dir under the cache dir and renames the finished bendtt into place, which is atomic; the build dir goes when the build ends, however it ends. Four at once: 20 of 20 runs check. Fixes bendlang#1948 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the kernel it renames into place Co-Authored-By: Claude Opus 5.5 <[email protected]>
nicolas-abril
force-pushed
the
fix/kernel-build-race
branch
from
October 29, 2026 18:50
d6fec0f to
f52edec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1948.
kernel_binbuilt the BendTT kernel in~/.bend/bendtt/<hash>/itself. So--verdictruns that started together on an empty cache wrote over each other'sbendtt.c, and one could fail to link. The cache also tookbendtt's existence as "built", whileleancwrote it in place.What
build-XXXXXXdirectory under the cache directory.bendttis renamed into place. The rename is atomic, sobin, once there, is a finished kernel. When two builds finish, the later rename replaces an identical file, and a run already executing the earlier one keeps its inode.finallydoes not run then) leaves itsbuild-XXXXXXdirectory behind, but nobendtt, so the next run builds normally. Leftover directories are not cleaned up: one could belong to a build still running.run's tool parameter isexe, so it no longer shadowsbin, the kernel path the rename writes.Checks
The tests point
HOMEat an empty directory that links to the real~/.elan, so each one starts from an empty cache.Four
--verdictruns at once on an empty cache:mainleanc: … undefined symbol: main)bendttis left in the cache directoryA build stopped 5 s in, by SIGKILL, SIGINT or SIGTERM: the next run builds and checks; the stopped build's directory stays.
No Lean on the PATH: the same "the kernel did not build" error as before, and the build directory is gone.
bun gates/_run.ts: repo 54 / 54, test 1782 / 1782, perf 124 / 124, ping 80 / 81 (pass). The gates use a prebuilt kernel, so they do not reach this code.safe.tsgoes from 23900 to 23993 ttok, under its 24000 cap.🤖 Generated with Claude Code