Builds the target (PyTorch) from source so that A/B comparison later compares two builds of the same source tree, not a wheel. Copilot authors the build script; the pipeline executes it. ccache-backed for cheap incremental rebuilds in Phase 7.
- Workflow:
.github/workflows/phase-5-6-build-baseline.yml(called bycodeweave.yml) — Phase 5 is the first step in the combined build+baseline job. - Gate to enter: Phase 4 produced
integration-test/tests-complete.md.
Why combined with Phase 6. The build produces an editable
integration-test/.venv(pip install -e .) and a compiledsrc/tree that are not committed to git and whose editable install points atsrc/by absolute path. A job boundary here would re-clonesrc/and destroy them, so build and baseline share one job/workspace.
| Variable | Default | Meaning |
|---|---|---|
PHASE5_MODEL |
claude-opus-4.6 |
Model for the build-authoring/repair agent |
PHASE5_MAX_ITERATIONS |
3 |
Max author→build→validate attempts |
Build environment (set by the job): CCACHE_DIR=~/.ccache-codeweave,
CCACHE_MAXSIZE=15G, CMAKE_{C,CXX}_COMPILER_LAUNCHER=ccache.
Plus the global inputs.
work/5-build-source.md— instructs Copilot to authorbuild-source.shand updatesetup.sh; the agent must not run the build itself.
src/— cloned on the work branch with submodules (--recurse-submodules), since the build needsthird_party/.src/CONTRIBUTING.md,README.md,requirements.txt,docs/— read by Copilot to discover the build toolchain.integration-test/setup.sh— rewired to build from source.
Up to PHASE5_MAX_ITERATIONS attempts of author → build → validate:
- Author/repair (Copilot — does not run the build;
shell(git:*)denied) — writes/repairsintegration-test/build-source.shand updatessetup.shto invoke it. On a repair pass it readsbuild-error.md. - Build (pipeline) — runs
build-source.shwith output teed live to the job log (BUILD_TEST=0 USE_CUDA=0 USE_DISTRIBUTED=0 pip install --no-build-isolation -e .). - Validate (pipeline, deterministic) — confirms
torch.version.git_versionequalssrcHEAD. On success writes thebuild-source.mdgate; on failure writesbuild-error.mdand retries.
Gate: if the build fails after all attempts (Status: FAILED), the phase exits
non-zero — a baseline on a non-source build would be invalid for A/B.
build-source.sh— standalone idempotent build script (executed by the pipeline).setup.sh— updated to callbuild-source.shinstead of a wheel install..venv/— editable source build (workspace-only, not committed).reports/build-source.md— gate report (SUCCESS/FAILED, torch version, src HEAD).reports/build-discovery.md— what was discovered and the repair history.build-error.md— transient; present only between failed attempts.
5-build-source-N.md/5-build-source-session-N.md— authoring log / transcript (attempt N).5-build-output-N.log— live build output (attempt N).
Phase 6 runs in the same job, against the .venv and src/ this phase produced.