Repository navigation
Description
Problem Statement
A user with a server of their own wants their builders to run there first, because it is already paid for, and to go to a cloud sandbox only when the server is full. OpenWiz can't do that today. docs/agents/host.md names exactly one host (records v1, section 6). A Roster start never tries a second entry (roster v1, pick rule 4). No driver can say it is full: the local driver takes as many runs as it is given, and driver v1's only refusal is a generic error. Everything goes to one place. Either the server gets overloaded, or every builder pays for a sandbox.
Solution
Local first, capped overflow. A project lists its hosts in the order it prefers them, Host: local, boat. Each host has an optional cap on how many agents run there at once, set on the machine that runs its driver. A driver at its cap answers with one new, exact "full" refusal and starts nothing. launch-fleet takes that answer as a signal, not a failure: it tries the next host in order. When every host is full, the start waits for the fleet's next wake. Nothing is reported as failed, and no retries burn. A wake or stop always goes back to the run's own host, as today (records v1, H2). With a Roster, the same spill-over runs down the Roster's candidates in table order.
Changelog headline
Run your builders on your own server first, and send only the overflow to a cloud sandbox, up to a cap you set.
User Stories
- As a user with a server, I write
Host: local, boat, and new builders start on my server until it is full, then on boat.dev. - As a user, I set how many agents may run at once on each host, on that host's machine (
OPENWIZ_LOCAL_MAX,OPENWIZ_BOAT_MAX). With no cap set, a host behaves exactly as it does today. - As a user, I set a cap on the overflow host, and it is never passed. When the base and the overflow are both full, the next start waits and goes ahead on the fleet's next wake. It isn't reported as a failed start.
- As a user, a builder I started on my server is always woken and stopped there, even after it filled up or my host list changed.
- As a user with a Roster, the same spill-over follows my Roster's table order: a host entry that answers full gives the start to the next candidate for that role.
- As a driver author, I can make any driver say "full" with one fixed refusal, and every caller that predates this work still reads it as an ordinary refusal.
- As a user with only
Host: localor no host file, nothing changes.
Implementation Decisions
- The full refusal (driver v1, new section "Full"). A driver that can't take one more run refuses
startunder D3 (exit 1) and starts nothing. Itsnextis exactlythis host is full: start on the next host, or wait for a free place, and itserrorsays how many agents are running and the cap, such aslocal is full: 2 of 2 agents are running. There is no newcanentry and no schema change, sokernel/driver-kit/schema.jsonand every driver'sschema.jsonstay byte for byte as they are. A caller that predates this sees an ordinary refusal. Onlystartanswers full.wakeandstopare never refused as full: a wake must reach its own run (D5). The section adds this rule and changes no other v1 rule. - The ordered host setting (records v1, section 6). The one setting line may name one or more hosts, separated by commas, in the order they are preferred:
Host: local, boat. Each name keeps today's form, no name appears twice, and there are at most 8. H1, H2 and H4 are unchanged. H3 changes in one way: a line that breaks this form starts nothing. A start tries each host in order. Afullanswer moves on to the next host, and any other refusal stops there, as today. When every host answers full, the start waits. Caps are never written in the repository (H4): they are a fact about a machine. - The Roster's spill-over (roster v1, pick rule 4). A picked entry whose driver answers full isn't a failed start: the next candidate in table order is tried. Any other refusal is retried and reported as today, and the next candidate is never tried in its place. When every candidate answers full, the start waits, and the fleet says exactly
roster: every entry for the <R> role is full; the start waits. New fixtures:full/(the first entry full, the second picked),all-full/(a wait) andfull-then-failed/(a failure after a full answer is reported as a failure and isn't passed on). - The local driver's cap.
OPENWIZ_LOCAL_MAXis a whole number from 1 to 1000; unset means no cap. A run counts while it is starting or while its last turn is running. A run whose turn ended and is waiting for a wake doesn't count. The count and the start's save happen under one driver-wide lock, so two starts at once never both take the last place. A bad value is refused under D3, and nothing starts. - The boat driver's cap.
OPENWIZ_BOAT_MAX, read the same way. A run counts while it is starting, or while boat shows its sandbox as not stopped (boat's own idle auto-stop frees the place). An unreadable count answers full, never "go ahead". boat's own refusal at its plan's limit on concurrent sandboxes also answers full, and its start-rate limit answers full too, because boat never queues a start. - launch-fleet's
host.py.whichprints the ordered list.starttries the hosts in order and saves the run with the host that took it. All full is a new outcome,waits: every host is full (<hosts>); the start is tried again on the next wake, on exit 1, with no failure note, no failure comment and no retries. The fleet's next wake starts the ticket again, as it would any ready ticket without a run. Only start answers move on to the next host. - Contract-first tickets: LF1 (driver v1 and records v1) and LF2 (roster v1) are docs and fixtures only. The exact refusal text and host-line form above are fixed here, so both run in parallel and the drivers build against LF1.
Testing Decisions
- Seam 1: each driver on its fixtures.
adapters/local/test_driver.pyandadapters/boat/test_driver.py, red first. With the cap at N, start N+1 runs: the last answers the exact full refusal and starts nothing. A finished turn frees its place. A wake at the cap still runs. Two starts at once at N-1 take one place between them. Unset keeps today's behaviour. The kit's five checks still pass unchanged. - Seam 2:
host.pyon fake drivers.test-host.py:localfull, soboattakes it and the run is saved onboat; both full is a wait, with no comment and no note; a non-full refusal onlocalnever triesboat; a one-host line works as today; a malformed list starts nothing. - Seam 3: the Roster reference reader.
cargo test -p openwiz-tests --test cli-agent roster_contractruns the new fixtures. WizSkills' Roster pick runs the same cases. - Prior art: driver v1's effort refusal (an exact
nexttext that callers read),host.py's retry and report for failed starts (0.1.0 KN11: a failed driver start or wake retries twice, then shows on the ticket with the driver's next text #1446), and the boat driver's limit handling.
Proof
- P1 (contracts): LF1 and LF2 are reviewed against this spec, and the Roster fixtures pass the reference reader.
- P2 (drivers): the local and boat fixture tests show the cap, the full refusal and the free place on a finished turn, red first.
- P3 (routing):
test-host.pyshows the order, the spill-over, the all-full wait and the saved host, red first. - P4 (live): on the owner's server, the live check in LF7.
Checkpoints
- One-way door: yes
- User-visible: yes
Live check
LF7, by a person, because a boat sandbox costs money. On the user's own server, set Host: local, boat on a throwaway repository, with OPENWIZ_LOCAL_MAX=2 and OPENWIZ_BOAT_MAX=1, and start four throwaway tickets. Expected: two start on local, one on boat, and the fourth waits. When one local builder finishes, the next wake starts the fourth on local. Record which host started each run, the waits, and the exact heads.
Out of Scope
- A base of several machines: a pool driver that runs the local driver over
sshon the least-loaded machine. That is a later spec. - A daily credit or spend cap on the overflow host. None by default.
- Setup asking for a host list or caps (the install's first fleet writes one host as today), and the app showing load per host.
- Moving a running agent between hosts.
- Drivers other than
localandboatadopting the cap. Any driver can adopt it later under LF1's rule.
Further Notes
The owner approved this plan on 2026-11-24: local first, with a capped overflow (private record). It builds on an earlier confirmed decision: own machines first, cloud only when they're full, no credit cap by default. The cap sizes come from a separate CPU measure on the server.
Activity
jparker2006 commentedon Nov 24, 2026
Plan graph, read back from GitHub (7 tickets, all S, 9 real links, no file links). It's waiting for one plan approval. No ready labels yet.
Longest chain: 2 links (#3029 → #3034 → #3035).
Can start at approval: 2 of 7.