Skip to content

Fix the first build on a fresh clone - #1

Merged
TGPSKI merged 1 commit into
mainfrom
fix/fresh-clone-first-build
Aug 4, 2026
Merged

Fix the first build on a fresh clone#1
TGPSKI merged 1 commit into
mainfrom
fix/fresh-clone-first-build

Conversation

@TGPSKI

@TGPSKI TGPSKI commented Aug 4, 2026

Copy link
Copy Markdown
Owner

make build-pytorch fails instantly on any checkout that has never been built:

scripts/build-upstream.sh: line 63: src/pytorch/.build-status.json.tmp: No such file or directory
make: *** [Makefile:135: build-pytorch] Error 1

emit_status writes .build-status.json into the target's source tree, but the init phase 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 because src/ already existed.

Changes

  • emit_status skips until the tree is a git repo, and never fails the build if the write does not land. A skip rather than an mkdir, 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.
  • The pytorch preset seeds numpy and scikit-build-core. Upstream builds through scikit-build-core now, and --no-build-isolation installs nothing on our behalf, so every entry in pytorch's [build-system] requires has 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/clone phases 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 check passes 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.

`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
TGPSKI force-pushed the fix/fresh-clone-first-build branch from 8334d88 to 9bd2e4a Compare August 4, 2026 07:24
@TGPSKI
TGPSKI merged commit e4e4597 into main Aug 4, 2026
2 checks passed
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.

1 participant