Skip to content

Build: with build :gate, live-red battery, seed-change runtime cleanup, and the native runner linked from this seed's bootstrap root (#1797) - #1795

Merged
ehartford merged 6 commits into
mainfrom
build-gate
Sep 27, 2026
Merged

ehartford merged 6 commits into
mainfrom
build-gate

Conversation

@ehartford

@ehartford ehartford commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Eric (2026-09-27): "how can we prevent this from happening for future agents" / "fix it" (#1797).

Verified: :gate green (549.7 s); live-red/fail-fast in a scratch rig; #1797 fix with stage1 as driver (:abi-hash-check --no-deps compiles the runner; :stage2 green with the runner compiled after the root is prepared); the battery's seed-change path executed for real on this branch's battery (a wrong digest pre-written). Battery verdict posted below when done. Still needed after merge: cut and pin a darwin seed after #1720 (the 0926 local nightly has no darwin asset).

Eric Hartford added 5 commits September 27, 2026 10:29
…plus every test target the last battery measured under 60 s (Eric, 2026-09-27)

A 6-layer stack took hours to land because the pre-battery gate was a
checklist an agent remembered, and an 18 s target (deep-debug-tool-tests)
was only ever run by the 25-minute battery. The gate is now one target:
build, selfcheck (the stage2 self-check of src/main.w; no stage1 variant
exists), reseed-check-build-w (which checks build.w and, through the fresh
release binary's embedded stdlib, lib/std/build.w), abi-hash-check,
unit-return-review, spec-inventory-check, examples-tests,
c-migrator-basic-tests, deep-debug-tool-tests, user-programs-safe, plus
every test lane the last battery measured under 60 s, then a gate-shape
line naming the measured members.

Test lanes are the non-Group targets reached from `test` through Group
targets only, minus test-green and seed-driver; a lane's own deps are
prerequisites, never tests. The measurements are the ledger
out/.build-state/battery-times.tsv that tools/battery.w merges from its
gate and checks runs (the driver's build-times.tsv is per invocation, so a
:dev in between would erase the battery's numbers). build.w is evaluated
once per build-source hash, so the battery deletes the evaluated-graph
cache when it rewrites the ledger. A fresh worktree has no ledger and runs
the fixed list.

The fixed list is built by push, not a collection literal: the pinned
seed's evaluator cannot take .len() of a literal (the #1122 class).
…ast (Eric, 2026-09-27)

A red known at minute 1 was read at minute 20: the battery wrote its
verdict only at the end, and the pre-battery gate was a checklist. Now the
battery runs `src/main build :gate` (the release build plus the fixed gate
and every lane the last battery measured under 60 s) before the 25-minute
checks; a red gate writes `RED (gate): <targets>` and stops. Both steps run
the child on an OS thread (std.thread; std.process has no non-blocking wait)
while the main thread polls the log once a second and appends
`RED: <target>` to out/battery/status.txt the moment a target fails; the
run still collects every red. `--fail-fast` is passed through to the driver
for the repair loop. The final RED/GREEN, BATTERY_DONE, logs and wall-time
lines are unchanged.

failed_targets now reads every failure spelling the driver has (test
target failed:, '<x>' failed, survey: skipping, the closing failed: list);
it used to match only the quoted build.w form.

After each step the driver's per-invocation build-times.tsv is merged into
out/.build-state/battery-times.tsv, the ledger build.w's gate reads (latest
measurement per target wins), and the evaluated-graph cache is removed so
the next build re-reads it.

Verified in a scratch git rig with fake gate/checks scripts: the RED line
was in status.txt while the child still ran; the ledger merged and sorted;
the flag reached the child. `with check` cannot verify the file: it rejects
every implicit-main script (filed separately).
…per-file-class checks for stack layers; the battery reports its first red live (Eric, 2026-09-27)

The gate was a checklist in an agent's memory, so steps were skipped and a
6-layer stack took hours to land. It is now one line — `src/main build
:gate`, the fixed list plus every test target the last battery measured
under 60 s — and every stack layer runs it before it reports done. A change
under src/Mir*.w, src/MirLower.w, src/MirValidate*.w or any validator runs
:deep-debug-tool-tests --no-deps and :drop-audit first; a change under
build/ or to build.w checks build.w and lib/std/build.w with the fresh
release binary. Agents read one existing behaviour test before writing a
fixture. The battery paragraph says the battery runs :gate first and writes
RED: <target> to status.txt live, with --fail-fast for repair loops.

The agents section no longer forbids :drop-audit and a full src/main build:
the gate is a full build, and the MIR rule requires the drop audit.
…ows is the VM on eric-5090 then `ssh win10` (Eric, 2026-09-27)
…t is this seed's generation; a seed change clears the checkout's runtime objects; the runner-compile fallback is loud (#1797)

The pinned darwin seed (nightly-20260925, 607a52f) predates #1720's D30
check, so in a checkout whose out/lib held 2026-09-22 objects it linked the
native build runner against that stale runtime, died on the undefined
with_vec_free_buffer_drop_origin, printed a warning, fell back to comptime
evaluation, could not evaluate embedded-clang-resource-source there, and
was red before stage1 — while the 09-22 out/release/bin/with stayed in
place. Reproduced in a scratch worktree from the 09-22 tree and its seed.

- src/main.w: the runner is compiled only once out/bootstrap-lib is this
  compiler's generation — prepare-bootstrap-link-root completed in this run,
  or its rt_core.o byte for byte the embedded one (Link.w's D30 check, now
  pub) — and with WITH_OUT_DIR naming the build's root, exactly as stage1
  links. File existence said nothing about which generation built them.
  The fallback message is an error naming the cause and the cure.
- build.w: embedded-clang-resource-source runs in the runner (the seed's
  evaluator cannot run it), so it is ordered after the root is prepared.
- tools/battery.w: the driving seed's digest is recorded
  (out/.build-state/battery-seed.sha256); when it changed, out/lib,
  out/bootstrap-lib and out/tmp/with_runtime are removed before :gate.

Verified with stage1 as the driver: `:abi-hash-check --no-deps` compiles
the runner (root already this generation), `:stage2` is green with the
runner compiled after the root is prepared (a first cut that waited only
for completion went red: the resource action ran before the root).
@ehartford ehartford changed the title Build: with build :gate is the pre-battery gate; the battery runs it first and reports its first red live Build: with build :gate, live-red battery, seed-change runtime cleanup, and the native runner linked from this seed's bootstrap root (#1797) Sep 27, 2026
…er generation's — an absent out/lib or out/bootstrap-lib is nothing to mistrust (#1797 follow-up)

The first cut waited for prepare-bootstrap-link-root or a byte-identical
out/bootstrap-lib, so a project with neither (behav_build_early_cutoff's
two-target build, every user project) never compiled the runner and its
actions fell to the evaluator: behavior-tests red on the branch battery.
Readiness is now: the root was prepared in this run, or no complete
out/lib / out/bootstrap-lib (Link.w's cimport_stubs.o probe) holds another
generation's rt_core.o. Verified: the test passes against a stage2 built
from this rule; :abi-hash-check --no-deps compiles the runner; :stage2
green with the resource action after the prepared root.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on 62a8b3eb (with run tools/battery.w): :gate rc=0 in 531 s, :battery-checks (seed-driver, fixpoint, test-with-audits incl. drop/move audits and every test, user-programs-safe, last-green) rc=0 in 911 s — the checks ran in 15 min because the gate had already built and run the cheap targets. Run 1 (ba51cf38) was red on one behavior test (behav_build_early_cutoff: the first readiness rule never compiled the runner for a project without a bootstrap root); fixed in 62a8b3eb. The seed-change cleanup path executed for real on run 1 (wrong digest pre-written: removed out/lib, out/bootstrap-lib, out/tmp/with_runtime; rebuilt under the current old seed). Ready to merge: gh pr merge 1795 --squash.

@ehartford
ehartford marked this pull request as ready for review September 27, 2026 18:13
@ehartford
ehartford merged commit 9993935 into main Sep 27, 2026
@ehartford
ehartford deleted the build-gate branch September 27, 2026 18:14
ehartford pushed a commit that referenced this pull request Sep 27, 2026
… carries #1720 and #1797 (Fixes #1797)

Cut from main 9993935 after #1795 merged: that tree's seed-driven battery
is green, :install-user verified the binary against last-green, and its
reseed gate compiled the native build runner natively. The previous seed
(nightly-20260925, 607a52f) predates #1720's D30 rule and linked the
runner against whatever out/lib a checkout held; in one with 2026-09-22
objects it died on an undefined runtime symbol and fell back to comptime
evaluation, which cannot run this tree's actions (#1797). Workflow pins
by `with run tools/bump_seed_pins.w`; the old seed fetched and verified
the asset (`src/main build :seed`, digest cffa4a40…). This branch's
battery runs driven by the new seed.
ehartford pushed a commit that referenced this pull request Sep 27, 2026
… carries #1720 and #1797 (Fixes #1797)

Cut from main 9993935 after #1795 merged: that tree's seed-driven battery
is green, :install-user verified the binary against last-green, and its
reseed gate compiled the native build runner natively. The previous seed
(nightly-20260925, 607a52f) predates #1720's D30 rule and linked the
runner against whatever out/lib a checkout held; in one with 2026-09-22
objects it died on an undefined runtime symbol and fell back to comptime
evaluation, which cannot run this tree's actions (#1797). Workflow pins
by `with run tools/bump_seed_pins.w`; the old seed fetched and verified
the asset (`src/main build :seed`, digest cffa4a40…). This branch's
battery runs driven by the new seed.
ehartford pushed a commit that referenced this pull request Sep 28, 2026
… carries #1720 and #1797 (Fixes #1797)

Cut from main 9993935 after #1795 merged: that tree's seed-driven battery
is green, :install-user verified the binary against last-green, and its
reseed gate compiled the native build runner natively. The previous seed
(nightly-20260925, 607a52f) predates #1720's D30 rule and linked the
runner against whatever out/lib a checkout held; in one with 2026-09-22
objects it died on an undefined runtime symbol and fell back to comptime
evaluation, which cannot run this tree's actions (#1797). Workflow pins
by `with run tools/bump_seed_pins.w`; the old seed fetched and verified
the asset (`src/main build :seed`, digest cffa4a40…). This branch's
battery runs driven by the new seed.
ehartford added a commit that referenced this pull request Sep 28, 2026
… carries #1720 and #1797 (Fixes #1797) (#1801)

Cut from main 9993935 after #1795 merged: that tree's seed-driven battery
is green, :install-user verified the binary against last-green, and its
reseed gate compiled the native build runner natively. The previous seed
(nightly-20260925, 607a52f) predates #1720's D30 rule and linked the
runner against whatever out/lib a checkout held; in one with 2026-09-22
objects it died on an undefined runtime symbol and fell back to comptime
evaluation, which cannot run this tree's actions (#1797). Workflow pins
by `with run tools/bump_seed_pins.w`; the old seed fetched and verified
the asset (`src/main build :seed`, digest cffa4a40…). This branch's
battery runs driven by the new seed.

Co-authored-by: Eric Hartford <[email protected]>
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