Fix the first build on a fresh clone - #1
Merged
Conversation
`emit_status` writes .build-status.json into the target's source tree, but the init phase fires before the clone has created that directory. On any checkout that had never been built, `make build-pytorch` died instantly with `src/pytorch/.build-status.json.tmp: No such file or directory` — v0.1.0 was unbuildable for every new user, and only worked here because src/ already existed. Status emission now skips until the tree is a git repo, and never fails the build if the write does not land. Two reasons for the skip rather than an mkdir: the directory has to stay empty until the clone lands, because git refuses to clone into a directory that already has files in it, and a status write must never take down a build that has been running for hours. That also unbreaks the case where the destination exists but is empty — the old code seeded a status file into it and the clone then refused the now-non-empty directory. The pytorch preset was missing two build requirements behind that failure. Upstream builds through scikit-build-core now, and --no-build-isolation installs nothing on our behalf, so numpy and scikit-build-core have to be seeded into the venv alongside the rest of [build-system] requires. Without them the build fails at backend import, before a single file compiles. Verified against a local throwaway repo on all three paths: fresh clone, re-run/pull, and pre-existing empty destination. `make check` passes with the CI-pinned shellcheck 0.11.0.
TGPSKI
force-pushed
the
fix/fresh-clone-first-build
branch
from
August 4, 2026 07:24
8334d88 to
9bd2e4a
Compare
This was referenced Aug 4, 2026
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.
make build-pytorchfails instantly on any checkout that has never been built:emit_statuswrites.build-status.jsoninto the target's source tree, but theinitphase fires before the clone has created that directory. v0.1.0 was unbuildable for every new user; it only worked on the author's machine becausesrc/already existed.Changes
emit_statusskips until the tree is a git repo, and never fails the build if the write does not land. A skip rather than anmkdir, for two reasons: the directory has to stay empty until the clone lands (git refuses to clone into a directory that already has files in it), and a status write must never take down a build that has been running for hours. This also unbreaks the case where the destination exists but is empty — the old code seeded a status file into it and the clone then refused the now-non-empty directory.numpyandscikit-build-core. Upstream builds throughscikit-build-corenow, and--no-build-isolationinstalls nothing on our behalf, so every entry in pytorch's[build-system] requireshas to already be in the venv. Without these the build fails at backend import, before a single file compiles — the next failure waiting behind the first one.AGENTS.md:init/clonephases only appear on a re-run now, since the file cannot exist before the tree does.Verification
Reproduced the original failure against a throwaway local repo, then confirmed all three paths exit 0 with a well-formed status file and no leftover
.tmp: fresh clone, re-run/pull, and pre-existing empty destination.make checkpasses with the CI-pinned shellcheck 0.11.0.A full GPU build was not run — that is hours of compile the CI gate cannot cover either.