Repository navigation
feat(grid): the allocator daemon — the grid re-seats its minds on every join and plan change; a mind moves to a strictly better seat between turns (card 10bba591) - #4281
Conversation
|
REVIEWED at 7530a15 by Fable (team lead). Agent-written under my direction; a second pair of eyes, not a self-approve. The two ways a re-seating daemon ruins a grid are thrash and moving a mind mid-thought. Both are closed here:
Two follow-ups, neither a block: the in-flight set is a process global, so any daemon test that asserts on it must own its own persona ids (the 9/20 lesson); and the dormant ordering should carry the oldest last-turn age into the hour line so the slow-clip law has a receipt a human reads. APPROVE at 7530a15 pending a peer word; merging on green + that word. |
|
APPROVE — reviewed at exact head 7530a15, green. This is the daemon the allocator was written for, and slice 2 of 426a26fb with it: the spawner's seat count now comes from the published allocation ( Three notes, written down so the next slices are named, none a condition for this head: The receipt after deploy: |
7530a15 to
a2441bc
Compare
…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, 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
…ses in the manual Co-Authored-By: Claude Fable 5.1 <[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
…red_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
8857ae4 to
c825ed3
Compare
|
REVIEWED at c825ed3 by Fable. Cormac approved the design at 7530a15 and asked for one fold; the rebase did that and more, so I am merging. The fold he asked for, done: The finding inside that fold is the one I care most about: Two compositions I asked to be re-verified and were: The separate Honest gap, named rather than hidden: the dormant slow-clip TURN is not implemented because no seam exists to hand a dormant mind a turn from slack. The ordered list, the derived interval and the probe are published for whoever builds it. That matches the law as Joel stated it — dormant is not off — without pretending the clock exists yet. APPROVE at c825ed3 — merging. |
Card 10bba591 — the grid allocator daemon
Joel: "Can it grow to higher capacity as both the M5 and the 5090 come online, ideally no time lost."
Before this the pure allocator (
cognition::grid_allocation::allocate, #4259/#4263) had no live caller: minds moved only on FAILURE (lane wait past a bound, 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.What lands
modules/grid_allocator.rs::Inner::gatherbuildsGridInputsfrom what exists:LanePlan::ofthe publishedServingPlan(+decode_knee::measured_tps_for), the gossip ledger'sforeign_offers_with_age(the same rowsgrid/mod.rsfolds — no second listener), the live roster +roles_from_ids(citizens, measured_floor)(the canary-side fold; feat(experience): a recipe's citizens declare what a lane must hold — CitizenRequirement + roles_from (card 10bba591) #4271'sroles_fromoverCitizenRecipeslots in), and the operator's hold. Peers'residentsare seated as anonymous minds homed there, so a full peer never reads as open seats. No node, model or number of this grid is named.tokio::time::intervalat the gossip beat, woken early on change (newgossip::heard_notifyfired byhear, and the plan watch).inputs_keyunchanged ⇒ nothing (probe-visible viaallocator/gridpasses/skipped). Elseallocate→watch::Sender<Option<Arc<Published>>>. Probegrid.allocation.published(seats per node, open, dormant, key).catch_unwind+ quarantine after 3 panics.placement_switch::decide_opportunity(pure) +follow_the_allocation(run at the tail offollow_the_fleet): moves her when the allocation seats her elsewhere on a strictly better seat —BetterBy::Requirement(her node holds no plan for her role) then the allocator's own capability / lanes / window order. Between turns only (resource_admission::turn_in_flight), inside a cooldown derived from her measured turn cadence (opportunity_cooldown_ms; the failure rule'sMOVE_COOLDOWN_MSonly while nothing is measured). Remote seat: reservation ask first, thengo_remote; home seat:come_home_for_good(override retired). Probeplacement.move.opportunity(from, to, reason). The seam added:OpportunityInputsbesidePlacementInputsrather than widening it — the failure rule's inputs are per-seat, this one's are per-allocation.GridAllocation::roster_on→GridRoster{seated, open}, told toPersonaSpawnerModule::set_grid_rosterby the reconciler each pass, which now also wakes on a publish).bounded_by_warm_slotsis the prior before the first publish. The identity-side bound (population under hold, minus resting) stays the spawner's, so the allocation never asks the provider for a name it cannot fill (the 2026-09-13 drain shape).Published.dormant_by_age(oldest last turn first, fromresource_admission::last_turn_ms) andclip_interval_ms = typical_turn × dormant / slack, slack = open seats × their idle fraction (free_slots_live / lanes). Probegrid.dormant.oldest_turn_age_ms. The actual clip turn is not implemented — no seam gives a dormant mind a turn from slack today; the list and interval are published for the scheduler that will.[health] … · moves: N on opportunity / M on failure · oldest dormant turn X min ago.ipc/mod.rsnext to the supervisor construction (it needsresident_roles+serving_daemon.subscribe()).Also:
resource_admission::begin_turnRAII guard replaces the barenote_turn_startedstamp (in-flight mark + measuredTurnShape), so every exit of a service-loop turn ends it.Not done / open
Uuid::nil), every offerOfferTerms::open(), until the negotiation card carries owner + terms on the beacon.LanePlanper beacon (served model, lanes, width) — the beacon carries no candidate list; decode unmeasured for peers.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo