Repository navigation
feat(serving): the window allocator — lanes × window from each mind's REQUIRED window against the budget, one pass, by reference; never a lane below one real turn - #4260
Conversation
… REQUIRED window against the budget, one pass, by reference; never a lane below one real turn Joel, 2026-09-20, the 5090 at 2 × 2048 refusing 2,932 prompts (p50 56k): "2k context is a completely waste of a lane. Persona should have 50-300k. Context must go along with required governed size. It doesn't govern honestly or reason out what best fits. You're still never passing rich structs by reference; you're rederiving." `cognition/window_allocator.rs` (new, own file): the model of the problem. - INPUT: `LaneRequirement` per mind — the governed size (declared on the mind, or until wired, the UNTRIMMED demand her turns assemble, with headroom, never below PERSONA_LANE_MIN_CTX = 64k, one real coding turn); the candidates' footprints; the budget the governor hands serving. - OBJECTIVE, in order: every served mind at her requirement; the most minds; the most capable model. Minds are shed (queue / grid) before the window shrinks; the model is shed before a mind is served at less; nothing fits one lane → said with the numbers, never a 2k lane. - ONE window per engine = the largest requirement served; minds packed smallest-requirement-first (an outlier is served last, never sizes the others' lanes). The arithmetic is ModelFootprint's own — reused. - Pure over references; 6 tests pinned with the 5090's and M5's numbers (2 × 70k in 30 GB; five minds → 2 served 3 shed; the 7B when the 27B holds fewer minds; 828 tokens is not a 2k lane). Wired: the daemon builds the roster's requirements ONCE per tick from the working set's untrimmed peak and carries them on `ServingDemand`; when present, `plan_serving` takes model, lanes and window from the allocator (sticky window only while it covers the requirement and fits) and the sent-median / bootstrap derivation is not consulted. That legacy path stays only for demands without requirements (tests, pre-roster boot) and is carded for deletion with the 16 fixtures that pin it (2eec3977). By reference: `ServingDemand` is no longer `Copy`; `plan_serving`, `plan_serving_stable`, `plan_serving_at_rest`, `host_floor_of` take `&HostBudget` / `&ServingDemand` — 82 call sites moved. Pinned through the plan: the 5090's poisoned inputs (sent median 828, sticky 2048) with two 70k requirements plan 2 × 70k; at 21 GB, where a 2048 lane was plannable, the plan refuses with fits_on_gpu=false naming the smallest requirement. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
|
Reviewed at exact head 855399b — the ledger/knee seam, as asked; Fable's word on the shape stands first. One condition from that seam, then the rest. THE CONDITION — the knee and the leased-in seats no longer bound the lane count. On canary, The rest, read for the shape (Fable's call): the objective order and the smallest-first packing at one window per engine are right, and "shed the model before a mind at less, never the window" is the law Joel asked for; |
|
Read at 855399b — the shape is right and it composes with #4259 rather than competing: #4260 is the NODE's plan (lanes × window from its minds' requirements against its budget); #4259 is the GRID's seats over every node's plans ( Two conditions before my word:
Merge order: #4257 first (Cormac's word at cf62451; I'm re-pushing only a harness fix — the test seeded the process-global leased-in ring and re-homed a lane in another test on CI). It touches two sites in |
… resolves to the seat's largest requirement, else the model's fit at that lane count (Joel: "you're hard coding constants again") PERSONA_LANE_MIN_CTX = 65_536 was the 2048 one order of magnitude up. The requirement IS the measurement (her untrimmed turn, now that the sample seal is gone); a mind with no turn yet is Unknown and resolves against the seat, then the model, then the budget — never a number in the tree. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
Merge canary and fix the one call site the merge exposed. This PR changed `plan_serving` to take `&HostBudget` and `&ServingDemand` (serving_plan.rs:639); `cognition/grid_allocation.rs` arrived from canary after this branch was cut and still called it by value, so CI failed with E0308 at its allocator fixture and nothing else. Diagnosis was Cormac's, on the card. Every call site inside this branch already passed references; the stale one was the file the merge brought in. No behaviour changes — a test fixture's argument form only. Pushed onto BigMama's branch to unstick her CI while she recovers the 5090; the design and the rest of the PR remain hers. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Pushed 9c10bf9 onto this branch to unstick CI while you are recovering the 5090 — the design and the rest of the PR stay yours. Two things, not two ampersands as first read: the branch predated Two design inputs for this PR, both measured on live boxes tonight, both still open:
Also note card 36a6d8c5, which lands under this one: the KV cache type is unset on the 5090 and the IntelMac, so both plan and serve at the f16 rate. At q8_0 your box has roughly double the KV budget this allocator is currently planning against. |
…unt while one mind is held; a requirement is her TYPICAL turn, never her peak Joel, 2026-09-20: "Yeah fix it man. This is the bug." Two things the 5090 showed after the restart (2 lanes × 26.7k, or 1 × ~60k, on a 32 GB card under a 19 GB 27B with q8 KV): - OBJECTIVE: the most capable model that serves at least one mind at her requirement wins; only among equals does head count. "Kimi at 26b MUST be coding": a mind the 27B cannot hold beside her queues or grid-places — she does not pull the seat down to a 7B. The 7B is chosen only when the 27B holds nobody. - REQUIREMENT = her typical turn. PersonaDemand gains a bounded ring of the last 16 untrimmed demands (serde default; legacy files read empty); the requirement is their median (`requirement_tokens`), else her last turn — never `peak_tokens`. Kimi's peak here is 176k, which no lane on this card can hold and would have shed her model for nothing; her turns run 30–60k. Free functions, not an impl: PersonaDemand is a data carrier. Pinned: the seat as it stands — 22 GB handed to serving, q8 KV — allocates the 27B to Kimi alone at one lane just under its fit, Sahar unserved beside her; three 70k coders on 30 GB keep the 27B at 2 lanes with one shed. 207 tests green across serving, working_set, daemon, placement, hygiene. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…/github.com/CambrianTech/continuum into feat/window-allocator-governed-requirements
|
APPROVE at cb35876 — Fable. This does the job the card was written for and Joel struck the constant himself, so it should land. What I verified: Two things I asked for are NOT in this branch, and I am naming them as follow-ups rather than blocking a good change:
Both are cards, not conditions. Landing this first is right because at q8_0 (card 36a6d8c5, in review) your box roughly doubles the budget this allocator plans against, and I would rather that change meet a requirement-driven allocator than the old constant. |
…ator daemon speaks canary's vocabulary (card 10bba591) Rebased onto canary (the window allocator #4260, the KV cache decision #4285, the workspace transfer #4278, `roles_from` over `CitizenRecipe` #4271). Cormac's note on #4281 was to fold rather than keep a parallel notion; this does that: - `roles_from_ids` (mine, over `RoleId`) is DELETED. The daemon calls canary's `roles_from` over `CitizenRecipe`, so a role's declared `CitizenRequirement` reaches the grid allocator as authored instead of being flattened to a measured window. - `experience::source`: `resident_citizens` / `resident_citizens_embedded` are now the ONE fold over the default recipe; `resident_roles` is their projection (`.map(role)`). Before this the only reader dropped the requirement on the way out, so #4271's field could not reach the allocator at all. Boot reads the citizens once and hands the spawner their roles. - `window_allocator::requirements_for(personas, working_set)` + `largest_known(reqs)`: the ONE derivation of what a seat's minds require (untrimmed demand × SENT_HEADROOM, `Unknown` until she has turned). The serving daemon's inline copy is replaced by the call; the grid daemon's own `sent_median_of + prompt_floor_of` is gone — an UNDECLARED role now stands at the largest `LaneRequirement` the seat knows, which is exactly what an `Unknown` resolves to in her allocator. One vocabulary, two callers. - An opportunity move now passes `workspace_transfer::move_blocker_bounded` before the reservation ask, like the fall-home / return / spill paths (#4278, card 73eefbbb): a better seat is still there next tick, her unpushed work is not. - Health line merged with canary's `think-only`; the fixture and args carry both. - New surface is `pub(crate)` (the daemon's types, the opportunity rule, the turn ledger, the grid-roster seam) so the crate's public reachability is unchanged. `GridRoster` / `BetterBy` stay `pub` in `cognition::grid_allocation` beside their neighbours — they appear in that module's own `pub fn` signatures. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ator daemon speaks canary's vocabulary (card 10bba591) Rebased onto canary (the window allocator #4260, the KV cache decision #4285, the workspace transfer #4278, `roles_from` over `CitizenRecipe` #4271). Cormac's note on #4281 was to fold rather than keep a parallel notion; this does that: - `roles_from_ids` (mine, over `RoleId`) is DELETED. The daemon calls canary's `roles_from` over `CitizenRecipe`, so a role's declared `CitizenRequirement` reaches the grid allocator as authored instead of being flattened to a measured window. - `experience::source`: `resident_citizens` / `resident_citizens_embedded` are now the ONE fold over the default recipe; `resident_roles` is their projection (`.map(role)`). Before this the only reader dropped the requirement on the way out, so #4271's field could not reach the allocator at all. Boot reads the citizens once and hands the spawner their roles. - `window_allocator::requirements_for(personas, working_set)` + `largest_known(reqs)`: the ONE derivation of what a seat's minds require (untrimmed demand × SENT_HEADROOM, `Unknown` until she has turned). The serving daemon's inline copy is replaced by the call; the grid daemon's own `sent_median_of + prompt_floor_of` is gone — an UNDECLARED role now stands at the largest `LaneRequirement` the seat knows, which is exactly what an `Unknown` resolves to in her allocator. One vocabulary, two callers. - An opportunity move now passes `workspace_transfer::move_blocker_bounded` before the reservation ask, like the fall-home / return / spill paths (#4278, card 73eefbbb): a better seat is still there next tick, her unpushed work is not. - Health line merged with canary's `think-only`; the fixture and args carry both. - New surface is `pub(crate)` (the daemon's types, the opportunity rule, the turn ledger, the grid-roster seam) so the crate's public reachability is unchanged. `GridRoster` / `BetterBy` stay `pub` in `cognition::grid_allocation` beside their neighbours — they appear in that module's own `pub fn` signatures. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ry join and plan change; a mind moves to a strictly better seat between turns (card 10bba591) (#4281) * feat(grid): the allocator daemon — the grid re-seats its minds on every join and plan change, and a mind moves to a strictly better seat between turns (card 10bba591) Before this the pure allocator had no live caller: minds moved only on FAILURE (a lane wait past a bound, a seat window below the turn), nobody re-ran the allocation when a node joined or a plan changed, so a mind on a 32k seat stayed there when a 70k seat appeared. Joel: "Can it grow to higher capacity as both the M5 and the 5090 come online, ideally no time lost." - modules/grid_allocator.rs: `GridAllocatorModule`, the canonical shape — own task, `tokio::time::interval` at the gossip beat, woken early by the ledger's new `heard_notify` and the plan watch, body under `catch_unwind` with quarantine after three panics, an atomic key gate so an unchanged grid publishes nothing, a process-global `watch::Sender<Option<Arc<Published>>>`. Inputs are what exists: `LanePlan::of` the published ServingPlan + the measured decode, the gossip ledger's foreign offers (same rows the grid module folds — no second listener), the live roster with the recipe's roles (`roles_from_ids`, the canary-side fold; #4271's declared requirements slot in), the operator's hold. Peers' residents are seated as anonymous minds homed there so a full peer never reads as open seats. Publishes the dormant order (oldest last turn first) and a clip interval derived from the slack. Probes: grid.allocation.published, grid.dormant.oldest_turn_age_ms. - persona/placement_switch.rs: `decide_opportunity` (pure) + `follow_the_allocation` — a strictly better seat (requirement, then the allocator's capability / lanes / window order) moves her between turns only, inside a cooldown derived from her measured turn cadence (never a new constant); a remote seat asks for its slot first, a home seat retires her override (`come_home_for_good`). Probe placement.move.opportunity. Failure moves now count too. - cognition/resource_admission.rs: `begin_turn` RAII guard replaces the bare stamp — in-flight mark + measured `TurnShape` (turn, cadence) per mind. - persona/spawner_module.rs + host.rs + ipc/mod.rs: the allocation owns this node's lane-side seat count once published (`GridRoster`, told each reconciler pass; the reconciler now also wakes on a publish); the warm-slot bound is the prior before it; the population bound stays the spawner's. - modules/citizen_health.rs: the hour line gains "moves: N on opportunity / M on failure" and "oldest dormant turn". - cognition/grid_allocation.rs: `LanePlan::better_than` / `BetterBy`, `GridRoster`, `roles_from_ids`. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * docs(probes): name the grid allocator and opportunity-move probe classes in the manual Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * refactor(grid): one requirement notion, one citizens fold — the allocator daemon speaks canary's vocabulary (card 10bba591) Rebased onto canary (the window allocator #4260, the KV cache decision #4285, the workspace transfer #4278, `roles_from` over `CitizenRecipe` #4271). Cormac's note on #4281 was to fold rather than keep a parallel notion; this does that: - `roles_from_ids` (mine, over `RoleId`) is DELETED. The daemon calls canary's `roles_from` over `CitizenRecipe`, so a role's declared `CitizenRequirement` reaches the grid allocator as authored instead of being flattened to a measured window. - `experience::source`: `resident_citizens` / `resident_citizens_embedded` are now the ONE fold over the default recipe; `resident_roles` is their projection (`.map(role)`). Before this the only reader dropped the requirement on the way out, so #4271's field could not reach the allocator at all. Boot reads the citizens once and hands the spawner their roles. - `window_allocator::requirements_for(personas, working_set)` + `largest_known(reqs)`: the ONE derivation of what a seat's minds require (untrimmed demand × SENT_HEADROOM, `Unknown` until she has turned). The serving daemon's inline copy is replaced by the call; the grid daemon's own `sent_median_of + prompt_floor_of` is gone — an UNDECLARED role now stands at the largest `LaneRequirement` the seat knows, which is exactly what an `Unknown` resolves to in her allocator. One vocabulary, two callers. - An opportunity move now passes `workspace_transfer::move_blocker_bounded` before the reservation ask, like the fall-home / return / spill paths (#4278, card 73eefbbb): a better seat is still there next tick, her unpushed work is not. - Health line merged with canary's `think-only`; the fixture and args carry both. - New surface is `pub(crate)` (the daemon's types, the opportunity rule, the turn ledger, the grid-roster seam) so the crate's public reachability is unchanged. `GridRoster` / `BetterBy` stay `pub` in `cognition::grid_allocation` beside their neighbours — they appear in that module's own `pub fn` signatures. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(grid): the local offer's decode reads canary's `tps_for` — `measured_tps_for` went with the #4194 revert CI (the compiler) caught the one symbol the rebase carried over from the reverted output-allowance work. `decode_knee::tps_for` is the rate this box measured at the LIGHTEST trusted concurrency; the plan's own lane count already respects the measured knee (`plan_serving` applies `knee_lanes`), so "every lane here decodes at or above the floor" is the plan's statement and this number says how fast. `None` (never measured) stays an absence the allocator does not read as a refusal. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
Joel, today, the 5090 at 2 × 2048 refusing 2,932 prompts (p50 56k), then at 1 × 26,880 after the poisoned store was cleared: "2k context is a completely waste of a lane. Persona should have 50–300k. Context must go along with required governed size. It doesn't govern honestly or reason out what best fits. You're hard coding constants again. Fix it, this is the bug." Card 2eec3977.
The model of the problem (
cognition/window_allocator.rs, new)LaneRequirementper mind — the governed size: her typical untrimmed turn (median of the last 16, never her peak; Kimi's peak here is 176k which no lane on a 32 GB card holds, her turns run 30–60k). A mind with no turn yet isUnknownand resolves to the seat's largest requirement, else the model's fit at that lane count. No constant anywhere.ModelFootprint's own arithmetic reused.Wired
The daemon builds the roster's requirements once per tick and carries them on
ServingDemand; with requirements present,plan_servingtakes model, lanes and window from the allocator. The sent-median/bootstrap derivation is not consulted — it remains only for demands without requirements (tests, pre-roster boot), carded for deletion with the 16 fixtures that pin it. By reference:ServingDemanddropsCopy;plan_serving*/host_floor_oftake&HostBudget/&ServingDemand(82 call sites).Pinned
The physics this makes explicit on the 5090
32 GB card − 19 GB weights − Comfort's reserve = 3–7 GB for KV. At f16 that was one 27k lane (the box had no
SERVING_KV_CACHE_TYPE; set to q8_0 today); at q8 ~60k on one lane. Two coders at 70k on this card need q4 KV or a smaller base — model × precision × lanes × window is the allocator's decision, and precision is the next dimension to fold in.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc