feat(agent): keep older main bases within the disk budget, by commit and build options #96

Merged
HumanBean merged 1 commit from HumanBean/Beanstalk:feat/kept-bases into main 2026-11-18 20:00:25 +00:00
Owner

Why

A tester kept one main base per build-option set and rebuilt it in place whenever a job needed another main commit. With PRs on different main commits in the queue, the same PC rebuilt main back and forth. The ask: keep main builds by commit and build flags, share them across PRs, and optimize the cache within the disk space.

What changed

  • Keeping the old base: when main moves, the old base is kept whole as bases/main@<commit 12> (per build variant, bases/main-<variant>-<hash>@<commit>) if it fits. That's a rename, so nothing is copied. It fits when:
    • what's used plus that base again stays within disk_budget_gb;
    • the drive keeps 60 GB free besides it (Workspace.KeepBudgetBytes, KeepFreeBytes).
      Only a whole base is kept; an unfinished one is rebuilt in place as before.
  • The new base: starts from a copy of the kept base's work/, so only what changed compiles, and seeds its shader caches from the kept base's game/, read in place.
  • A job on a kept commit: that base becomes the active one again, with no build, and the one that was active is kept in its place.
  • A switch plan (baseline.ref = "pr", #95): uses any kept base in the PR's history.
  • Eviction: kept bases go oldest use first under the budget with the other folders, except the ones of the job about to start (KeptBasesOf).
  • Local runs: with no budget, nothing is kept, as before.
  • Docs: the agent README's data-folder table and Workspace's folder map.

Tests

  • Agent: 2023 checks passed. New checks cover:
    • the kept folders' names, per variant;
    • finding a whole kept base by commit (not one without base.json);
    • kept commits, most recently used first;
    • a job's kept base protected from eviction;
    • the swap itself through EnsureBaseAsync: the kept base becomes active with no build, and the old active one is kept.
  • Agent release build: 0 warnings.
  • Not tested: a real build that keeps a base and copies its work/. It happens on testers once main moves while they're on the next nightly.
## Why A tester kept one main base per build-option set and rebuilt it in place whenever a job needed another main commit. With PRs on different main commits in the queue, the same PC rebuilt main back and forth. The ask: keep main builds by commit and build flags, share them across PRs, and optimize the cache within the disk space. ## What changed - **Keeping the old base:** when main moves, the old base is kept whole as `bases/main@<commit 12>` (per build variant, `bases/main-<variant>-<hash>@<commit>`) if it fits. That's a rename, so nothing is copied. It fits when: - what's used plus that base again stays within `disk_budget_gb`; - the drive keeps 60 GB free besides it (`Workspace.KeepBudgetBytes`, `KeepFreeBytes`). Only a whole base is kept; an unfinished one is rebuilt in place as before. - **The new base:** starts from a copy of the kept base's `work/`, so only what changed compiles, and seeds its shader caches from the kept base's `game/`, read in place. - **A job on a kept commit:** that base becomes the active one again, with no build, and the one that was active is kept in its place. - **A switch plan (`baseline.ref = "pr"`, #95):** uses any kept base in the PR's history. - **Eviction:** kept bases go oldest use first under the budget with the other folders, except the ones of the job about to start (`KeptBasesOf`). - **Local runs:** with no budget, nothing is kept, as before. - **Docs:** the agent README's data-folder table and `Workspace`'s folder map. ## Tests - **Agent:** 2023 checks passed. New checks cover: - the kept folders' names, per variant; - finding a whole kept base by commit (not one without `base.json`); - kept commits, most recently used first; - a job's kept base protected from eviction; - the swap itself through `EnsureBaseAsync`: the kept base becomes active with no build, and the old active one is kept. - **Agent release build:** 0 warnings. - **Not tested:** a real build that keeps a base and copies its `work/`. It happens on testers once main moves while they're on the next nightly.
feat(agent): keep older main bases within the disk budget, by commit and build options
Some checks failed
CI / Conventional Commit title (pull_request) Successful in 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
CI / Coordinator tests (pull_request) Has been cancelled
CI / Agent build and checks (pull_request) Has been cancelled
CI / Coordinator image (pull_request) Has been cancelled
468458105b
A tester rebuilt its one main base in place whenever a job was on
another main commit, so PRs on two main commits rebuilt main back and
forth. When main moves, the old base is now kept whole as
bases/main@<commit> (a rename; per build variant, by its options) when
the disk budget and the drive allow it (what is used plus that base
again within disk_budget_gb, and 60 GB left free besides), and the new
base starts from a copy of its work folder (only what changed compiles)
and from its game folder's caches. A job on a kept commit makes that
base the active one again with no build, and a switch plan
(baseline.ref = "pr") uses any kept base in the PR's history. Kept
bases go oldest use first under the budget like other folders, except
the ones of the job starting. Without a budget (a local run) nothing
is kept, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean deleted branch feat/kept-bases 2026-11-18 20:00:30 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Beanstalk!96
No description provided.