Repository navigation
Stop every gate step from rebuilding stage2 and relinking the compiler (#1157) - #1185
Merged
Merged
Conversation
added 2 commits
September 18, 2026 13:13
The Install kind's freshness check tested its output path literally, so '$HOME/.local/with-wo/...' never existed and every bundle install target was permanently stale (--explain: 'stale: output missing: $HOME/...'). The stage compiles depended on the bundle group that carries those installs, so each invocation re-ran them, rewrote out/stage/lib/embedded_objects.o with identical content and a new mtime, and rebuilt stage2 and link-compiler: ~142 s in each of :fixpoint, :test, :move-audit, :drop-audit and :last-green. The install operation and the freshness check now share one path expansion (BuildGraphSupport). That takes effect once a seed carrying it is pinned, so the build layer also moves the dependency now: stage compiles and the embedded blobs depend on <name>-wo-build, whose out/wo/ outputs are all they read, and the store installs hang off the millisecond stamp step. Measured under the pinned seed after a build: :fixpoint 250 s -> 104 s, :move-audit 175 s -> 11 s, zero stage2/link-compiler rebuilds. #1157
…ocation drop-audit is flagged allow_parallel (it writes only out/drop-audit), and the group lists the audits before the tests so they share the behaviour tests' pooled run instead of queueing behind the repo lock as separate invocations. #1157
ehartford
added a commit
that referenced
this pull request
Sep 20, 2026
…s which part changed (#1225) Every action's signature carried the fingerprint of the binary orchestrating the build (:WITH:). Our workflow alternates orchestrators all day: the iterate tier uses the installed compiler, the battery the pinned seed, corpus promotion the release compiler. With the seed held fixed (WITH=src/main) and only the orchestrator changed, --explain reported stage1, stage2, link-compiler, the runtime objects and the bundle builds all "stale: action signature changed": a full compiler rebuild, about 4.5 minutes, per switch. (:zlib-promote spent 270 s rebuilding stage1, stage2 and link-compiler right after a build had produced them.) The orchestrator produces a target's output only when it compiles it itself: the compile kinds, and an action with no `compiler=` (a workspace compile runs in the driver's compiler). An action that names its compiler is produced by that compiler; a tree compiler is already hashed by the stage-target block and `compiler=seed` is the seed WITH names. Such an action now keys on the seed (build_cache_producer_fingerprint). Go, Zig and Rust all key on the producing tool, never on the build driver. With WITH=src/main driven by src/main the signature text is unchanged, so seed-driven batteries stay warm. The state file held the signature as one hash, so "signature changed" could not say what changed. It now records each component's hash (target, producer, action-code or build-graph, compiler-source, compiler) and the stale reason names the ones that differ; WITH_BUILD_CACHE_TRACE=<target> prints them. Evidence, two binaries with different sha256 (release 32543048…, stage2 0dbd11f3…) over one seed, after a build orchestrated by the first: stage1, stage2, link-compiler, rt-core-object and zlib-wo-build are fresh under both. libc-surface-check (no compiler=, so the driver is its producer) is fresh under the first and "stale: action signature changed (producer)" under the second. The pinned seed (v0.15.2.0) still disagrees with a current compiler: it predates #1151/#1185/#1191's changes to this code and records no component hashes; that ends at the next seed. Co-authored-by: Eric Hartford <[email protected]>
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.
Closes #1157.
Root cause
Every seed-driven gate step rebuilt stage2 and relinked the compiler that
buildhad just produced (~142 s in each of:fixpoint,:test,:move-audit,:drop-audit,:last-green).with build --explain pcre2-wo-install-o:The
Installkind's freshness check tested its output path literally, while the install operation expands$HOME. The file exists; the check could never see it, so all twelve bundle install targets were permanently stale. The stage compiles depended on the bundle group, which carries those installs, so each invocation re-ran them and rewroteout/stage/lib/embedded_objects.owith identical content (same sha256) and a new mtime, which made stage2 and link-compiler stale. Found by hashing stage2's 305 declared inputs before and after one gate step: that file was the only one that moved.Fix
BuildGraphSupport/Cache/Ops): onebuild_graph_expand_install_path, used by both the install operation and the freshness check. Takes effect when a seed carrying it is pinned — the pinned seed's build-graph code is frozen.<name>-wo-build, whoseout/wo/outputs are all they read (the compiler never reads the store; it is a cross-tree cache for the bundle build). The store installs hang off the millisecondbuildstamp step.:test-with-audits: the tests and both ownership audits in one invocation.drop-auditis flaggedallow_parallel(it writes onlyout/drop-audit), and the group lists the audits before the tests so they share the behaviour tests' pooled run. Separate invocations cannot overlap: the repo lock serializes them.Measured (pinned seed v0.15.2.0, darwin arm64)
:fixpointafterbuild:move-audit:drop-audit:last-green:test-with-auditsA/B on one commit, identical cold prep (test pass records cleared, the audits' outputs removed, no forced actions; stage2 rebuilt in neither arm; behaviour tests0 cached, 1041 ranin both): sequential 888 s, combined 803 s. One sample each; the saving (85 s, ~10%) is near run-to-run noise because the audits and the behaviour tests compete for the same cores.Two earlier attempts at that A/B were discarded: one served the tests from cache, one used
WITH_BUILD_ACTION_FORCE=1, which forces every Action in the chain and rebuilt the stages per invocation.Battery
build,:fixpoint,:test,:move-audit,:drop-audit,:test-green,:last-greenall rc=0 on the compiler change;:test-with-audits,:fixpoint,:test-green,:last-greenrc=0 on the final commit.Not in this PR
About ten
:testtargets are not flagged parallel and drain the worker pool (emit-c-smoke101 s, the four bundle drift checks, the C-migrator suites,selfcheck;stdlib-complexityis serial on purpose). Last-green evidence is keyed on the stamped binary, so a squash merge of a byte-identical tree still needs a full battery. The pinned seed compiles the compiler in ~289 s where a current compiler takes ~72 s.