Repository navigation
fix(serving): a seat plans for the minds it SERVES, not only the minds it HOSTS — leased-in generates count toward the slot count - #4197
Merged
joelteply merged 5 commits intoSep 18, 2026
Conversation
…s it HOSTS — leased-in demand counts toward the slot count
Governor slice S2, first half (Joel, 2026-09-18: "this is where only advanced code can
figure it out — govern for reliability"). Card c84d885a.
MEASURED: the 5090's 27B seat served the M5's coders (Benchy 12, Aris 8, Demetri 5,
Mara 5 remote answers in one afternoon) and IntelMac's eight, on ONE slot
(`-c 101120 --parallel 1`), with lane waits of p50 216 s / p90 1,387 s / max 7,058 s.
Its serving plan sized the slot count to its own roster, because a seat's lane demand
was `resident_lane_demand(...)` over `live_personas()` of the LOCAL registry, and an
inbound remote `ai/generate` entered neither `InflightModelCall` nor the admission gate.
The seat could not see the demand it carried; llama-server queued it where no receipt
lives; three agents found the queue by reading two nodes' ledgers by hand.
THE TERM: `ServingDemand::leased_in` — concurrent lanes this seat serves for minds hosted
on other nodes, measured at the seat's own admission as the PEAK per plan tick.
`plan_serving` sizes the slot count to `lanes + leased_in` (saturating). The daemon
reads `resource_admission::take_leased_in_peak()` when it assembles demand and carries
`leased_in` on the `serving.plan` receipt, so a plan that ignores the grid is falsifiable
from the ledger.
THE GAUGE: `PeakGauge` in resource_admission — the module's injectable `Gauge` idiom plus
a peak that re-arms at the CURRENT concurrency on each take, so a long remote turn
spanning two ticks is not read as zero demand on the second. `LeasedInCall::enter()` is
the RAII marker, mirror of `InflightModelCall`.
NOT IN THIS COMMIT, deliberately: feeding the gauge at the inbound-generate seam
(routing/command_handler.rs → commands/ai). Until that lands `leased_in` reads 0 on every
seat — honest, never invented — and this commit changes no live plan. That is the wire
half, its own PR, so the pure arithmetic is proven first.
Tests, in the existing mods, named for what they catch:
serving_plan: a_seat_plans_for_the_minds_it_serves_not_only_the_minds_it_hosts
(1 resident + 3 leased-in on a roomy host -> 4 warm slots, as for 4
residents; a solve-lease shape that pins residents to 1 still counts
the leased-in three; a tight host names the two it cannot seat)
resource_admission: a_leased_in_gauge_remembers_its_peak_per_interval_and_never_forgets_a_running_call
Whole-file: serving_plan 39/39, resource_admission 17/17, serving_daemon 71/71.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… the wire half of "a seat plans for the minds it serves" Every inbound path on the serving node (streamed and plain `ai/generate`, and the test entry `process_request_via`) converges on `dispatch_request`; a `LeasedInCall` guard held there for the whole dispatch — receipt to settled reply — is what feeds the term the previous commit taught the planner to read. Only for `ai/generate`: a peer's `work/list` is not inference and must not inflate a seat's slot count. With this, `serving.plan` on a seat that other nodes spill onto carries a non-zero `leased_in`, and the slot count follows the minds the seat actually serves. The 5090 would have planned for its own roster PLUS the twelve coders it was serving, instead of one slot for everyone. Test: an_inbound_generate_is_counted_as_leased_in_demand_for_the_whole_dispatch — reads the gauge AT GATE TIME (inside the guard) relative to a baseline, never as an absolute; asserts release on exit; asserts a non-generate peer command does not count. command_handler 17/17 whole-file. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…onstant — a burst must be a LOAD before it moves a slot Cormac's review of #4197, accepted: `--parallel` is a LAUNCH arg, so a lane-count change is a new llama-server and every in-flight generation dies with the old one. The planner debounces DOWNshifts (DOWNSHIFT_SUSTAINED_TICKS = 3) and adopts UPshifts immediately, and `leased_in` was a raw per-tick PEAK of bursty grid overflow. On the 5090 that sequence is: burst of 3 leased calls -> peak 3 -> plan lanes+3 -> relaunch NOW -> the relaunch kills the three leased-in generations that raised the count -> next tick peak 0 -> downshift (debounced 3 ticks) -> relaunch back -> next burst Every few minutes, on the one seat everyone queues on, each relaunch destroying the remote turns it was sized for — the 718-replan flap through a new input. Now the planner acts on `sustained_leased_in`: the MINIMUM of the last DOWNSHIFT_SUSTAINED_TICKS per-tick peaks (fewer samples = 0; a fresh gauge never relaunches). One constant for both directions, on purpose: the guard that stops a squeeze evicting the best activity is the guard that stops a burst evicting the grid's coders. The `serving.plan` receipt carries both `leased_in_peak` (raw) and `leased_in` (sustained), so the debounce is falsifiable from the ledger. Test (Cormac's, verbatim in intent): a peak of 3 on ONE tick, then 0, must NOT change the lane count. `a_burst_of_leased_in_calls_on_one_tick_does_not_move_the_lane_count` also pins the window ([0,3,3,3] -> 3), the dip rule ([2,3,3] -> 2) and the fall ([3,3,3,1] -> 1). serving_daemon 72/72 whole-file. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… serves for other nodes — and both RAII guards name their field BigMama's correction on #4197: the 5090 is STILL `-c 101120 --parallel 1` and there is no operator lever for slots — lanes are derived. The plan CONSIDERS 2 x 49k every tick and keeps one lane, because the per-lane floor is the LOCAL residents' median sent prompt, and on a two-resident seat that median IS Sahar's SWE prompt (~60k+). So the previous commit would have made the seat grow lane DEMAND for twelve leased-in coders and then size those lanes to one resident's prompt and refuse to fit them. Demand and floor must see the same pool. Now: - `resource_admission::note_leased_in_sent` / `leased_in_sent_samples`: a bounded ring (64) of the measured `usage.input_tokens` of generates this seat performed for cross-grid callers; zero is not a sample. - `commands/ai/generate.rs`: when the caller's source is Airc, the response's prompt size is recorded — the server's own count, never an estimate, at the seam where both the caller and the usage are in hand. - `working_set::sent_median_with(personas, extra)`: ONE median over residents' sent peaks plus the leased-in samples; `sent_median_of` delegates to it (one median, not two). - `serving_daemon::serving_demand`: feeds the samples in — including on a seat with no residents of its own, which still gets a floor from the minds it serves. Also: both `InflightModelCall` and `LeasedInCall` held a positional `GaugeGuard` that rustc rightly reports as never read (it is held for its drop). Named `_guard`, which says so. The CI warning ratchet failed the previous push at 76 -> 77; this lands at 75 — the baseline lowered, not matched, and no `#[allow]` anywhere. Tests: `the_typical_prompt_includes_the_prompts_a_seat_serves_for_other_nodes` (one resident at 64k + twelve leased-in at ~30k -> a median under 40k; no residents + leased-in -> still a floor; zeros never samples), `leased_in_prompt_sizes_are_remembered_bounded_and_zero_is_not_a_sample`. Whole-file: resource_admission 18/18, working_set 46/46, serving_plan 39/39, serving_daemon 72/72, command_handler 17/17, commands::ai 22/22. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
enabled auto-merge (squash)
September 18, 2026 20:23
…ided and the win must stick CI red on 68bcc97: "warnings fell to 75 below the baseline 76 — lower the baseline in this branch so the win sticks". Naming the never-read GaugeGuard fields `_guard` (LeasedInCall, InflightModelCall) removed one warning; the ratchet refuses a shrink that is not recorded. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Sep 18, 2026
… the beacon — S1's seat side Governor slice S1, seat half (card c84d885a). Joel: "should have picked S1 first — just get it working well." S2 (#4197) makes a seat size itself for what arrives; S1 stops more arriving than fits. This commit is the half a seat can do alone: say the truth about itself where the truth is measured. TWO FACTS A SEAT NOW CARRIES ON `CapacityOffer` (serde-default, additive): free_slots_live served lanes minus everything in flight on them — local turns AND leased-in generates — read off the seat's own admission gauges. The old `lanes − residents` was roster arithmetic every node evaluated independently, so the M5 and IntelMac each read the 5090 as free and spilled onto the same slot at once. lane_wait_p50_ms the seat's own median receipt-to-first-progress wait for the lane_wait_samples generates it served for other nodes. MEASURED WHERE THE QUEUE FORMS: a citizen's delib.gate.lane_wait is stamped on her home node and includes the wire; this is stamped at the seat's receipt (StreamPublisher.received_at) and closed at the first prefill frame or token it publishes. Paired with the sample count so 0 ms / 0 samples reads as UNMEASURED, never as a fast seat — the absence-read-as-a-value error, closed at the type. WHERE THEY COME FROM: resource_admission gains a bounded ring of first-progress waits and a pure p50 (`p50_of`: median, not mean — one 7,058 s outlier is not the seat's wait); command_handler's stream publisher records the first progress once per generate; grid_capacity::offer_from_board fills the beacon; PeerOffer carries the same three so the chooser can read them. NOT YET (S1b, placement — coordinated with Cormac): choose_offloads still uses lanes − residents and has no queue term. This commit changes NO placement decision; it makes the seat's truth available. The lease (a spill acquires before it moves) rides the same two numbers. Tests: a_seats_measured_wait_is_a_median_with_a_count_and_unmeasured_is_not_fast. Whole-file: resource_admission 19/19, command_handler 17/17, capacity::gossip 5/5, capacity::lease 5/5, grid_capacity 1/1, placement_switch 5/5. No new warnings. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
deleted the
fix/a-seat-plans-for-the-minds-it-serves-not-only-the-minds-it-hosts
branch
September 18, 2026 20:51
joelteply
added a commit
that referenced
this pull request
Sep 18, 2026
… the beacon — S1's seat side Governor slice S1, seat half (card c84d885a). Joel: "should have picked S1 first — just get it working well." S2 (#4197) makes a seat size itself for what arrives; S1 stops more arriving than fits. This commit is the half a seat can do alone: say the truth about itself where the truth is measured. TWO FACTS A SEAT NOW CARRIES ON `CapacityOffer` (serde-default, additive): free_slots_live served lanes minus everything in flight on them — local turns AND leased-in generates — read off the seat's own admission gauges. The old `lanes − residents` was roster arithmetic every node evaluated independently, so the M5 and IntelMac each read the 5090 as free and spilled onto the same slot at once. lane_wait_p50_ms the seat's own median receipt-to-first-progress wait for the lane_wait_samples generates it served for other nodes. MEASURED WHERE THE QUEUE FORMS: a citizen's delib.gate.lane_wait is stamped on her home node and includes the wire; this is stamped at the seat's receipt (StreamPublisher.received_at) and closed at the first prefill frame or token it publishes. Paired with the sample count so 0 ms / 0 samples reads as UNMEASURED, never as a fast seat — the absence-read-as-a-value error, closed at the type. WHERE THEY COME FROM: resource_admission gains a bounded ring of first-progress waits and a pure p50 (`p50_of`: median, not mean — one 7,058 s outlier is not the seat's wait); command_handler's stream publisher records the first progress once per generate; grid_capacity::offer_from_board fills the beacon; PeerOffer carries the same three so the chooser can read them. NOT YET (S1b, placement — coordinated with Cormac): choose_offloads still uses lanes − residents and has no queue term. This commit changes NO placement decision; it makes the seat's truth available. The lease (a spill acquires before it moves) rides the same two numbers. Tests: a_seats_measured_wait_is_a_median_with_a_count_and_unmeasured_is_not_fast. Whole-file: resource_admission 19/19, command_handler 17/17, capacity::gossip 5/5, capacity::lease 5/5, grid_capacity 1/1, placement_switch 5/5. No new warnings. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
2 of 3 tasks
joelteply
added a commit
that referenced
this pull request
Sep 18, 2026
… the beacon — S1's seat side (#4198) Governor slice S1, seat half (card c84d885a). Joel: "should have picked S1 first — just get it working well." S2 (#4197) makes a seat size itself for what arrives; S1 stops more arriving than fits. This commit is the half a seat can do alone: say the truth about itself where the truth is measured. TWO FACTS A SEAT NOW CARRIES ON `CapacityOffer` (serde-default, additive): free_slots_live served lanes minus everything in flight on them — local turns AND leased-in generates — read off the seat's own admission gauges. The old `lanes − residents` was roster arithmetic every node evaluated independently, so the M5 and IntelMac each read the 5090 as free and spilled onto the same slot at once. lane_wait_p50_ms the seat's own median receipt-to-first-progress wait for the lane_wait_samples generates it served for other nodes. MEASURED WHERE THE QUEUE FORMS: a citizen's delib.gate.lane_wait is stamped on her home node and includes the wire; this is stamped at the seat's receipt (StreamPublisher.received_at) and closed at the first prefill frame or token it publishes. Paired with the sample count so 0 ms / 0 samples reads as UNMEASURED, never as a fast seat — the absence-read-as-a-value error, closed at the type. WHERE THEY COME FROM: resource_admission gains a bounded ring of first-progress waits and a pure p50 (`p50_of`: median, not mean — one 7,058 s outlier is not the seat's wait); command_handler's stream publisher records the first progress once per generate; grid_capacity::offer_from_board fills the beacon; PeerOffer carries the same three so the chooser can read them. NOT YET (S1b, placement — coordinated with Cormac): choose_offloads still uses lanes − residents and has no queue term. This commit changes NO placement decision; it makes the seat's truth available. The lease (a spill acquires before it moves) rides the same two numbers. Tests: a_seats_measured_wait_is_a_median_with_a_count_and_unmeasured_is_not_fast. Whole-file: resource_admission 19/19, command_handler 17/17, capacity::gossip 5/5, capacity::lease 5/5, grid_capacity 1/1, placement_switch 5/5. No new warnings. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Fable 5.1 <[email protected]>
3 of 4 tasks
joelteply
added a commit
that referenced
this pull request
Sep 18, 2026
…e back, the seats come back Cormac's condition on S3, verbatim: "a lane_bound REST has no lane_bound WAKE … the seat was fine, the LANES were short, and the correct return trigger is the lanes coming back. As written: the M5 at 1 lane this hour rests 2 of 5; #4197 lands and the M5 goes to 2 lanes; those 2 stay rested until the next deploy. Every transient lane dip permanently shrinks the roster — the peak ratchet, the claim expiry, the metronome, in a fourth coat." The mirror, pure (`lane_bound_wakes`): while lanes × MINDS_PER_LANE_STARVED_ABOVE has room above the residents, the most recently rested lane-bound seat (the most served of those rested — the least served rested first) wakes, same cap per tick, reason "lanes returned"; a MINDLESS rest is untouched (she must have changed). Rest and wake cannot both fire: one needs residents above the edge, the other room below it. Receipt: persona.lane_bound.woken; the health line gains "lanes returned: N woken". Test: a_lane_bound_rest_has_a_lane_bound_wake_and_a_mindless_rest_does_not — two rested at lanes = 1 stay rested at lanes = 1; the tick at lanes = 2 wakes them most-served first; room for one wakes one; the recital never wakes by lanes. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
3 of 4 tasks
joelteply
added a commit
that referenced
this pull request
Sep 18, 2026
…ts least-served seats to the healthy edge, and wakes them when the lanes return (#4200) * feat(health): the receipt gets an actor — a lane-bound roster rests its least-served seats to the healthy edge Governor slice S3 (card c84d885a; Joel 2026-09-18: "govern for reliability"). For hours on 2026-09-18 the org room read "AT THE KNEE: 16 minds on 2 lanes … owed: fewer seats here or more decode, never more lanes" and nobody paid it; an operator paid it by hand (a hold and a reboot). Now the hourly tick pays it. THE RULE (pure, `is_lane_bound` + `lane_bound_seats`): the verdict is STARVED or AT THE KNEE, the hour's card pulls are a fair sample (≥ LANE_BOUND_MIN_PULLS), and at least LANE_BOUND_DEFERRED_SHARE of them were `bench.round.pull_deferred_wip` — the minds were QUEUED on the lanes, not idle, not mindless. Then the least-served seats (no writes first, then fewest lane grants) REST down to the healthy edge, `lanes × MINDS_PER_LANE_STARVED_ABOVE` — the one number the STARVED verdict already turns on — never below the resident floor, never more than the per-tick cap: the same resting-seat page-out the mindless rule uses (checkpoint flushed, on record, back on a change: a deploy or `persona/instances/wake`). WHAT IT REFUSES TO DO: an hour of `pull_none` (the IntelMac: 8 minds, 278 pulls, no round on the node) rests NOBODY. That is a round-supply defect, not a seat one; paging a roster for it would delete the roster and report success. The reason on every rest says `lane_bound` and carries the numbers, so an empty seat explains itself. The pulls are counted at the three receipted outcomes of `work_pull::try_pull_next_card` (pulled / deferred / nothing) — one ledger, the same seams that already probe. The per-mind lane-grant map folds into `MindHour` (one per-mind ledger, not two). The receipt line and the `citizen.health.hour` probe carry `pulls` and `pulls_deferred`; the actor's receipt is `persona.lane_bound.rested`. Test: a_lane_bound_roster_rests_its_least_served_seats_and_a_roundless_one_rests_nobody — the M5's hour (16 on 2, 424/430 deferred) and the IntelMac's (8, 278 pulls, none deferred), the edge, the floor, the cap, a healthy roster never paged. Whole-file: citizen_health, work_pull, placement_switch, source_hygiene — 35/35, no new warnings. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(health): a lane-bound rest has a lane-bound WAKE — the lanes came back, the seats come back Cormac's condition on S3, verbatim: "a lane_bound REST has no lane_bound WAKE … the seat was fine, the LANES were short, and the correct return trigger is the lanes coming back. As written: the M5 at 1 lane this hour rests 2 of 5; #4197 lands and the M5 goes to 2 lanes; those 2 stay rested until the next deploy. Every transient lane dip permanently shrinks the roster — the peak ratchet, the claim expiry, the metronome, in a fourth coat." The mirror, pure (`lane_bound_wakes`): while lanes × MINDS_PER_LANE_STARVED_ABOVE has room above the residents, the most recently rested lane-bound seat (the most served of those rested — the least served rested first) wakes, same cap per tick, reason "lanes returned"; a MINDLESS rest is untouched (she must have changed). Rest and wake cannot both fire: one needs residents above the edge, the other room below it. Receipt: persona.lane_bound.woken; the health line gains "lanes returned: N woken". Test: a_lane_bound_rest_has_a_lane_bound_wake_and_a_mindless_rest_does_not — two rested at lanes = 1 stay rested at lanes = 1; the tick at lanes = 2 wakes them most-served first; room for one wakes one; the recital never wakes by lanes. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
2 of 3 tasks
joelteply
added a commit
that referenced
this pull request
Sep 19, 2026
…ots — a boot never plans thinner than what it served (#4207) * fix(serving): a seat remembers the typical prompt it served across boots — a boot never plans thinner than what it served 2026-09-19 00:3xZ, the 5090's first plan on the new build: lanes=2 served_window=17,313 demand_lanes=2 leased_in=1 bound_by=host-fit — #4197 counted the leased-in mind and asked for two slots, and host-fit halved the same ~49k of KV into 17k slots for coders whose prompts are ~30k. The planner chose slots over window because its per-lane FLOOR was the 16,384 bootstrap prior: the leased-in prompt samples #4197 folds into the floor live in a process-static ring that is EMPTY on a fresh core, and the residents' median was one local mind's. Once a few 30k prompts land the floor becomes ~37.5k and the same plan says one slot — the boot had simply forgotten. The served-window store carries a third half, `typical_prompt_tokens`: the plan tick records the live median whenever it is measured (idempotent, a 0 never overwrites), the spawn's save keeps it, and a boot with no measured median floors from it. A seat plans from what it served yesterday, never from a prior it outgrew hours ago. Older records read 0 = unknown. Test: the store round-trips the typical prompt beside window and lanes, a spawn keeps it, an older record reads unknown. Whole-file: served_window_store, serving_daemon, serving_plan, source_hygiene — 134/134. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * test(serving): the typical prompt's three arms — live wins and is remembered; the same model's record floors an unmeasured boot; a foreign record or a 0 floors nothing (Cormac's condition on #4207) The seam is a pure fn now (typical_prompt_for_plan) so the arms are asserted without a daemon or a disk. Doc carries: 'typical' is the median of the prompts the seat SERVES — residents and leased-in in one pool — so on a seat that mostly serves other nodes' coders the remembered median is theirs, correct for a seat. NOT built or run tonight: no cargo on the serving node (M5) under the merge freeze; compiles and lands at the morning quiet hour. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Governor slice S2, complete — Joel: "this is where only advanced code can figure it out — govern for reliability." Card
c84d885a. Four commits, two review findings folded in.Measured
The 5090's 27B seat served the M5's coders (Benchy 12, Aris 8, Demetri 5, Mara 5 remote answers in one afternoon) and IntelMac's eight, on one slot (
-c 101120 --parallel 1): lane wait p50 216 s, p90 1,387 s, max 7,058 s. Its plan sized the slot count to its own roster and its per-lane floor to its own residents' prompts; an inbound remoteai/generateentered neitherInflightModelCallnor the admission gate. The seat could not see the demand it carried, in either dimension.Commit 1 — the term (pure)
ServingDemand::leased_in: concurrent lanes this seat serves for minds hosted elsewhere, measured at the seat's admission as a peak per plan tick (PeakGauge, re-armed at current concurrency on take).plan_servingsizes slots tolanes + leased_in. Theserving.planreceipt carries it.Commit 2 — the wire
Every inbound path converges on
dispatch_request; aLeasedInCallguard held there for the whole dispatch feeds the gauge. Onlyai/generate.Commit 3 — the debounce (Cormac's review)
--parallelis a launch arg: a lane-count change relaunches the server and kills in-flight generations. Upshifts adopt immediately; a raw per-tick peak of bursty overflow would relaunch the seat and kill the very calls that raised it, then downshift, then repeat. The planner now acts onsustained_leased_in— the minimum over the lastDOWNSHIFT_SUSTAINED_TICKS(3) peaks, the same constant the downshift uses. Receipt carriesleased_in_peak(raw) andleased_in(sustained). Test: a peak of 3 on one tick, then 0, must not move the lane count.Commit 4 — the floor pool (BigMama's correction)
The 5090 considers 2 × 49k every tick and keeps one lane because the per-lane floor is the local residents' median prompt — on a two-resident seat, one SWE prompt. Leased-in generates' measured
usage.input_tokens(recorded incommands/ai/generate.rswhen the caller's source isAirc) now join one median (working_set::sent_median_with), so demand and floor see the same pool; a seat with no residents of its own still gets a floor from the minds it serves. Also: both RAII guards name their_guardfield — the warning ratchet failed the earlier push at 76 → 77; this lands at 75, no#[allow].What changes live
Once deployed, a seat that other nodes spill onto plans slots and window for them, on the existing reconcile cadence with its hysteresis. No operator lever exists for slot count; this arithmetic is the only thing that changes the 5090's one slot.
Tests (existing mods, each named for what it catches)
a_seat_plans_for_the_minds_it_serves_not_only_the_minds_it_hosts·a_leased_in_gauge_remembers_its_peak_per_interval_and_never_forgets_a_running_call·an_inbound_generate_is_counted_as_leased_in_demand_for_the_whole_dispatch·a_burst_of_leased_in_calls_on_one_tick_does_not_move_the_lane_count·the_typical_prompt_includes_the_prompts_a_seat_serves_for_other_nodes·leased_in_prompt_sizes_are_remembered_bounded_and_zero_is_not_a_sample.Whole-file:
resource_admission18/18 ·working_set46/46 ·serving_plan39/39 ·serving_daemon72/72 ·command_handler17/17 ·commands::ai22/22.Not here: S1 — the spiller's side (a spill acquires a lease; a seat whose own receipt-to-first-token wait exceeds the latency budget is not capacity). Both halves of one mechanism.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo