WIP: feat(agent): build Longshot commits of both builders, make_game.py's and longshot-builder's (Longshot #2286) #143
No reviewers
Labels
No labels
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Beanstalk!143
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Beanstalk:feat/longshot-builder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Longshot is replacing
nx2/make_game.pywithlongshot-builder, one Rust program built frombuilder/(Longshot #2286). For a while the farm will see commits of both kinds, so the agent builds and tests both, like the Longshot Launcher.It works before and after #2286 merges. Commits that still have
nx2/make_game.py(today'smain, the nightlies) are built exactly as on Beanstalk'smain: that code is unchanged and its checks pass unchanged. Commits withbuilder/crates/longshot-buildergo through the new flow.It matches Longshot #2286 at
xnrvuytn: the root Cargo workspace,longshot-builder dev toolsin place ofscripts/tools.py, the error codes of itsbuild-events.md,dev.py packs' farm mode and its upscaler variables.How the kind is picked
After the fetch, the agent reads each side's tree from git (
BuilderKinds.Of,Workspace.KindOfAsync):builder/crates/longshot-builderis built by longshot-builder;nx2/make_game.py(and no longshot-builder) is built by make_game.py, as before;error;builder/Cargo.lockof its own, no root workspace) is refused in words (Builder.LayoutProblem).A job is one kind. A baseline of one kind and a candidate of the other are refused with an
errorthat says so ("main builds with make_game.py and the pull request with longshot-builder: ... rebase the pull request on main"). Theirtools.lockdiffer anyway, so the existing tools rule would refuse them too, and the nightly regression chain restarts at the change as it already does whentools.lockchanges.Each kind keeps its own folders, so a base of one kind never takes a pack of the other:
tools/,python/,games/,bases/,stores/lifts.<data>/builder/:tools,python,rust,builders,stores,bases.Eviction looks at both kinds' bases and keeps each kind's active one;
builder/bases' linked romfs counts once in the data folder's size. Each kind keeps its own Python: make_game.py's flow keeps its current one, and the new flow uses a pinned python-build-standalone 3.14.10 inbuilder/pythonon both systems, because #2286'stools.lockships no Python.The longshot-builder flow (
Core/WorkspaceBuilder.cs,Core/Builder.cs,Core/BuilderPython.cs)Prefetch (outside the sandbox, running no code of the repository's):
main'stools.locktools for this system, installed by the agent itself (WindowsTools.ParseBuilder,WindowsTools.UnpackTarZst, by build-driver'stools/lock.rsandtools/archive.rsrules): each.tar.zstdownloaded, checked by its size and SHA-256, and unpacked with no path out, no link out, nothing written through a link, no hard links and nothing half unpacked left, with the system's zstd or the pinned one on Windows;Cargo.locknames (main's, and a pull request's when it builds its own builder): only downloaded and checked by their SHA-256 here, never unpacked; they are unpacked in the sandbox. A lock the farm can't fetch (not crates.io's, no checksum, other bytes) is that lock'serror.main'sfetch.py.The
.nupis checked but never read intogames/: longshot-builder reads it in place. A dump is passed as the one folder that holdsromfs/andexefs/.The builder itself:
main's builder is built in the sandbox withscripts/longshot_builder.py build --profile release, offline, with no GPU, its target folder in--workand cargo--lockedat the read-only root. It is built once per key: the git ids ofbuilder/, the scripts that build it, and the rootCargo.tomlandCargo.lock. A reused builder is touched, so pruning by write time keeps the ones in use.longshot-builder-<tag>-<platform>instead, each checked againstSHA256SUMSandSHA256SUMS.sigagainst Longshot's release key, built into the agent (Workspace.ReleasePair). Otherwise both builders are built from their commits alike, so a job never times a release's profile against a commit's.main's builder unless it changes the files in the key. Then it builds its own in the job's folder. The PR's builder is never kept.Builds:
scripts/dev.py packs base|pack|rtwith--game <.nup>,LONGSHOT_BUILD(the side's own builder, read-only, so dev.py never runs cargo; the runtime too),LONGSHOT_STORE,LONGSHOT_CACHE(a cache of each build's own) andLONGSHOT_BUILD_JSON=1. Under these, #2286'sdev.py packsruns directly, not through a job queue.main's builds write the store. A PR's pack builds over a reflink copy of it, deleted after the pack. The store is emptied beforemain's next base build once it holds more than 30 GB.romfs: each one'slongshot_romfs.idxnames the.nup, and every build and game run gets the.nupread-only at its own path.longshot-builder build --json --no-prepare-shaderswith no GPU. Their caches:coldis an empty store,lifta copy of the store'scompile/,warma copy of the whole store.Upscalers (with #144's plans):
dev.py packsreads (LONGSHOT_NGX_SDK,LONGSHOT_FSRwithLONGSHOT_FFX_SDK,LONGSHOT_XESS_SDK), the SDK folder read-only, and the base's stamp names the upscaler;--upscaler <u>,--ngx-sdkfor DLSS and--accept-licenses <vendor>, the licence the tester accepted;dev.py packswithout upscaler variables, a vendor filemain'sruntimes.rspins missing or other, a pull request that pins other files, or a base without the upscaler.Events and errors (
BuildEvents):docs/dev/reference/build-events.md), fromdev.py packstoo, and the text form, for progress, stages, the CPU level,doneandcheck. Stage times come frombuild_times.json.fail, so the job goes to another tester: every code ofbuild-events.mda PC causes and a commit can't (Builder.PcCodes: the game files' row, the disk, the overlapping folders, a folder in use,cpu_unknown, a download, and the upscalers'license_not_accepted,bad_license,dlss_sdk_missing); the checks keep the list inside the doc's table.tools_incompleteis the commit's when its tree'stools.lockis notmain's, else this PC's. Every other code is a report oferror.longshot-builder check --json --cache <the agent's>replacesmake_game.py --checkfor these commits.tools.lockalready is.split_giantsstays in the plan schema and applies to make_game.py's builds only. For a longshot-builder side,LONGSHOT_SPLIT_GIANTSis left out of the build (the builder doesn't read it), and the build's reportnotesays it was ignored.What the review round changed
main'stools.lock(#2286 deletedscripts/tools.py), checked and unpacked by the builder's own rules; no repository code runs on the host for them.Cargo.lock, only downloaded and checked outside the sandbox; the builder's key takes the rootCargo.tomlandCargo.lock; a commit from the middle of #2286's history is refused in words.build-events.mdis afail;tools_incompleteby the tree'stools.lock.check --cache.docs/architecture.mdandusing.mdas the agent now does it.Coordinator and docs
test_timing.py's expected strings were updated for that wording).split_giantsapplies to make_game.py's builds only.main(and the nightlies the farm still tests) have only longshot-builder. That removal will be a follow-up PR.Testing
On the first version (before the review round):
dotnet build agent/Beanstalk.Agent.slnx -c Release: 0 warnings, 0 errors.python -I agent/tests/test_agent_core.py --strict: 2549 checks pass. Every existing check file is unchanged frommain; onlyProgram.csgains a line registering the new section. TheBuilderCheckssection covers the kind picked from real git commits of each kind and from made-up trees; the refusal across kinds; each kind's folders; the events (JSON and text) and the error codes;build_times.json, the tool variables, the builder key and the Rust build's linker settings; a release's program checked against a signed, a wrongly signed and a mismatchedSHA256SUMS; the.nupread in place; bases of a moved.nuprebuilt; the PR's pack built over a store copy, withmain's store and base never writable to it; fail vs error routing, and a timed build's command and store.python -I agent/tests/test_release.py: passes.pytest -q: 630 passed, 1 skipped.The review round adds checks to
BuilderChecksfor each change above (the tools' lock and archive rules, the root lock and key, the layout refusal, the release pair, the PC codes against the doc's table, the upscalers' variables, flags and refusals, the store cap). On the head after the review round (yzoxxkwt):python -I agent/tests/test_agent_core.py --strictpasses 2807 checks and the coordinator'stest_timing.pyandtest_plan.pypass (246). The follow-uppurzmvnm(each job's ownLONGSHOT_DATA; #2286's new game-file codes as this PC's) passes 2817 checks.Not run: a real farm job or game build. A real run will show:
Open points
Notes
LONGSHOT_BUILD_JSON=1, #2286'sdev.py packsprints only the builder's JSON events on stdout, so base and pack failures carry their error codes: adisk_fullis afail, acompile_faileda report oferrorwith its code. An olderdev.pyignores the variable, and its text output is still read. The make_game.py flow never sets it.tools.lockwhen a manual run is requested. A pinned-Rust change between two longshot-builder nightlies is caught by the agent, as anerror.https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
🤖 Generated with Claude Code
The timed builds are longshot-builder builds now: its stage ids (tools, read, lift, compile, finish, shaders) in the build-time table, the lift's digest of its gen/ folder ("lifted code", no longer C), the caches as copies of its store, and a manual run's tagged sides built with their release's longshot-builder. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq898d664f38e89fcbef963I rewrote the branch's history (force-pushed, now at
89fcbef9) to add theAssisted-by: Claude Opus 5.5trailer that Beanstalk's AGENTS.md asks for, next to theCo-Authored-ByandClaude-Sessionones. The code is unchanged. The description now also says that Longshot #2286 will makedev.py packspass--jsonthrough, so base and pack failures will carry their error codes.89fcbef963c249ed46a6WIP: feat(agent)!: build Longshot with longshot-builder, the new builder from Longshot #2286to WIP: feat(agent): build Longshot commits of both builders, make_game.py's and longshot-builder's (Longshot #2286)I reworked this to be backwards compatible, and force-pushed it (now at
c249ed46). The agent now builds and tests both kinds of Longshot commit:builder/crates/longshot-buildergoes through the new longshot-builder flow.nx2/make_game.pygoes through make_game.py's flow, exactly as onmain.The kind is read from each side's tree. A job whose two sides use different builders is refused with an
errorthat says why. Each kind keeps its own folders: everything for the new flow is under<data>/builder/.split_giantsstays in the plan schema; a longshot-builder build ignores it and its report says so. Every existing agent check file passes unchanged, alongside the newBuilderChecks.The history is now two commits, both with the
Assisted-by,Co-Authored-ByandClaude-Sessiontrailers. The earlier commit that removedsplit_giantsis gone. This PR no longer depends on #2286 merging first: it works before and after.Pushed
70a118e8. Longshot #2286'sdev.py packsnow acceptsLONGSHOT_BUILD_JSON=1, so the new flow sets it for packs base, pack and rt. This applies to longshot-builder commits only; the make_game.py flow never sets it. With it set, base and pack failures carry longshot-builder's error codes:disk_fulland the other PC-trouble codes go to another tester as a fail, andcompile_failedbecomes a report of error with its code. An olderdev.pyignores the variable, and its text output is still read. The new checks are inBuilderChecks: 2549 agent checks pass.70a118e836fb67307efcView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.