Skip to content

Battery on a fresh worktree re-runs every test and rebuilds every stage the layers' gates already built: the build/test cache is per-worktree, not keyed on inputs machine-wide #1899

Closed

Description

@ehartford

Stack #1898's battery (top 591d9c5, fresh worktree ~/.local/with-staging/spec-sealed) took >1 h although every layer had just passed :gate in its own worktree:

  • gate: 715 s — a full seed→stage1→stage2→release chain from an empty out/ (stage1 158 s, stage2 143 s, link-compiler 176 s), all of it already built byte-identically in the layers' worktrees minutes earlier.
  • battery-checks: behavior-tests 555 s (0 cached, 1489 ran), native-compile-error-tests 112 s (0 cached, 1536 ran), native-spec-tests 91 s (0 cached, 210 ran), drop-audit 263 s, debug-alloc-tests 107 s — every per-file result recomputed because the test graph's cache lives under the worktree's out/.

D49/D50 already say a green belongs to the sources (inputs), not to the worktree. The build and test caches should follow the same rule: a machine-wide content-addressed store keyed on the action's inputs (source digests + compiler digest + flags), so a battery over a tree whose files were all built and tested in other worktrees is mostly cache hits, and only the files a fold actually changed re-run. The .wo store (~/.local/with-wo) is the existing precedent for a machine-wide, digest-keyed artifact store.

Also a contributing factor this time (not the tool's fault): five agent worktrees were building concurrently on the same laptop.

Expected: a battery on an already-gated stack runs in minutes; [time] lines show cache hits for unchanged inputs. This is Eric's #1 priority class (build performance).

Activity

  1. ehartford commented on Sep 29, 2026

    @ehartford
    ContributorAuthor

    Measured on the stack #1898 battery (gate 715 s + checks 1864 s):

    • tools-tests 564 s — build/tools_lane.w builds 31 tools serially (~18 s each) on an 18-core host.
    • emit-c-smoke 424 s — build/selfhost.w run_emit_c_smoke_action runs ~12 independent emit + cc -O1 cases serially, and the target is not allow_parallel.
    • The per-file verdict cache is keyed on (compiler fp, file fp, target config) but stored per worktree, so a fresh worktree re-runs files already proven with a byte-identical compiler.
    • Five agent builds were running on the host during the battery (coordination fault, not a tool fault).

    Fix in progress on branch battery-speed (top of stack #1898): parallel windows inside both lanes, allow_parallel on every independent serial lane over 30 s, a machine-wide verdict store beside the .wo store. The build/*.w changes take effect on the next battery; the src/ (driver) changes at the next seed.

  2. ehartford commented on Oct 3, 2026

    @ehartford
    ContributorAuthor

    Fixed on main in 6572eab (PR #2008; seed-driven battery GREEN on e0f5510, tree identical to main).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions