Skip to content

fix(health): the active roster is bounded by the warm slots — two minds per lane, rested to the edge in one tick, a lane-bound rest outlives a deploy (card 7c38ff6f) - #4244

Merged
joelteply merged 3 commits into
canaryfrom
fix/the-roster-is-bounded-by-the-warm-slots
Sep 20, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fix/the-roster-is-bounded-by-the-warm-slots

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Joel's call (00:4xZ 9/20)

"23 minds … the nursery is over-saturated" — the bound "is the way to go". Card 7c38ff6f. The 22:22Z M5 hour: resident 16 · lanes 3 · acts 5 · writes 0 · 2,174 of 2,177 pulls lane-deferred; the 16 residents also cost the plan its second lane.

The mechanism existed (citizen health's lane-bound rest); it was too gentle in three places

  1. Edge 3 → 2 per lane (MINDS_PER_LANE_STARVED_ABOVE): one turning, one prefilled and waiting. STARVED and the rest share the number, as before.
  2. To the edge in one tick. It rested 3 seats per hourly tick; 16 on 3 took three hours and a deploy in between reset it. lane_bound_seats now rests the full overage (resident floor holds; the per-tick cap stays the mindless rule's). lane_bound_wakes wakes as many as the room holds.
  3. A lane-bound rest outlives a deploy. Records were keyed by build, so every deploy woke the whole roster. resting_seat::survives_a_build_change keeps lane_bound records across builds; the spawner's draw already skips resting seats, so the boot draws within the bound. LANE_BOUND_REASON moves beside the record; citizen_health re-exports it.

Tests

  • lane-bound rest: 16-on-2 rests all five fixture minds least-served first; 7-on-2 rests three; 2-on-1 is the edge; 3-on-1 rests one.
  • lane-bound wake: room-sized wakes, the recital stays rested.
  • verdict shapes moved to 8 lanes where "enough lanes" was assumed (16 on 6 is now STARVED, correctly).
  • resting seat: a lane-bound record outlives a build change; a recital does not.

Not here (S3 of the card)

A card that names a resting mind wakes her; remote seats the node holds grants on counting toward its slots.

Receipt

Next [health] hour on the M5: resident ≤ 2 × lanes, lane_bound_rested = the full overage in one tick, pulls_deferred near 0; the boot after a deploy draws the bounded roster (persona.host.resting rows, no wake storm).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…ds per lane, rested to the edge in one tick, and a lane-bound rest outlives a deploy (Joel: "the nursery is over-saturated")

Joel, 2026-09-20 00:4xZ, on 23 minds over 3 warm slots: "the nursery activity and system we
talked about is over saturated"; the bound "is the way to go". Card 7c38ff6f. The 22:22Z hour
on the M5: resident 16 · lanes 3 · acts 5 · writes 0 · 2,174 of 2,177 pulls lane-deferred —
16 resident minds also cost the plan its second lane (external memory 15 → 31 GB), and every
unslotted mind re-prefilled cold on every turn.

The mechanism already existed in citizen health (card c84d885a S3: the lane-bound rest) and
was too gentle in three places:
1. The edge was 3 per lane. Now MINDS_PER_LANE_STARVED_ABOVE = 2 — one turning, one
   prefilled and waiting; a lane every ~8 minutes each at 4-minute turns. STARVED and the
   rest use the same number, as before.
2. It rested 3 seats per HOURLY tick. 16 on 3 took three hours to reach the edge, and a
   deploy in between reset it. Now `lane_bound_seats` rests to the edge in one tick (the
   resident floor still holds; the per-tick cap stays the MINDLESS rule's, a page-out for
   cause). `lane_bound_wakes` wakes as many as the room holds, for the same reason.
3. A resting record was keyed by build: a deploy woke everyone. A lane-bound rest is not a
   change in HER — the lanes were short — so `resting_seat::survives_a_build_change`
   keeps `lane_bound` records across builds; the spawner's draw (which already skips
   resting seats) then boots within the bound, and the lane-bound wake + the operator's
   word are its returns. LANE_BOUND_REASON moves beside the record it marks;
   citizen_health re-exports it.

Tests: the lane-bound rest test now pins 16-on-2 resting all five fixture minds least-served
first, 7-on-2 resting three, 2-on-1 at the edge and 3-on-1 resting one; the wake test pins
room-sized wakes; the verdict shapes move to 8 lanes where "enough lanes" was assumed (16 on 6
is now STARVED, correctly); the resting-seat test pins a lane-bound record outliving a build
change while a recital does not.

Not in this PR (S3 of the card): a card that names a resting mind wakes her; remote seats the
node holds grants on counting toward its slots.

Receipt: the next [health] hour on the M5 reads resident ≤ 2 × lanes, `lane_bound_rested`
= the full overage in one tick, pulls_deferred near 0, and the boot after a deploy draws
the bounded roster (persona.host.resting rows for the rested, no wake storm).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVE with one condition — reviewed at exact head 93f2a6d (checks still running at read time; merge on green).

The three changes are the card's S1+S2 and the bound Joel confirmed: edge 3 → 2 per lane, the full overage rests in one tick (the floor holds; rest_seats still flushes once and shuts seats down in sequence, so 12 rests is 12 sequential shutdown_slots, not a storm), and a lane_bound record outlives a build (survives_a_build_change, with the wake as its mirror — the wake is now sized to the room, so the two-direction test still holds). The test moves are the right ones: 16 on 6 IS starved at two per lane, and 8 lanes is where "enough lanes" now lives.

The condition — the term the one-tick rest now stands on. CitizenHealth.lanes is current_serving().lanes at the instant of the hourly tick (citizen_health.rs:471, 594): a point sample, not the hour's lanes. That was tolerable when a bad sample cost at most three seats; it now costs the whole overage. The M5 hour #4241 measured had lanes moving 3 → 2 → 3 while the planner settled, and a launch that is between lanes at the tick reads 1. On 16 residents: edge 2, rest 14, one flush pass, 14 shutdowns, the boot after the next deploy draws 2, and the wake restores four an hour later — a self-healing hour-long hole on one sample. The verdict rule already guards lanes = 0 (Empty), so the exposure is exactly the transient 1-or-2 sample on a node whose hour served 3. Ask: the rest reads the HOUR's lanes — the maximum serving.lanes sampled across the window (the accumulator snapshot_minds_and_reset already runs a per-window fold, one more field), or the plan's target lanes — never the tick's sample. Max is the right fold for a destructive act: a lane truly lost mid-hour rests one hour later, a lane momentarily absent rests nobody. One line to the health line so a reader sees lanes 3 (max this hour), and the 16-on-2 fixture pins that a tick sampled at 1 with an hour max of 3 rests to the edge of 6, not 2.

Nit, not a condition: survives_a_build_change keys on the reason string's prefix. The reason is already the routing key for lane_bound_wakes, so this extends a convention rather than starting one — but it is one value with two meanings (a sentence for the operator and the record's kind), and a kind field with #[serde(default)] on RestingSeat would let both readers match a variant. Carry it to S3, where the card-names-her wake adds a third reader of the same string.

@joelteply

Copy link
Copy Markdown
Contributor Author

Read 618a9a9 against 93f2a6d: the delta is the one test fix (Aris woken by the word, which also pins that the word returns a lane-bound seat under any build) — good. The condition above stands unchanged: the one-tick rest still reads the tick's lane sample. APPROVE once that lands.

…tick's sample (Cormac's condition on #4244)

`CitizenHealth.lanes` was `current_serving().lanes` at the instant of the hourly tick. With
the rest now taking the whole overage in one tick, a launch between lanes at the tick (reads
1 on a node whose hour served 3) would rest fourteen of sixteen and the wake would restore
them an hour later. The ledger folds the hour's maximum lanes (`note_lanes`, at the serving
daemon's geometry settle and at every lane grant); the tick reads max(window, now) and
restarts the window from now; the rest and the verdict stand on it; `lanes_now` carries the
sample so the line reads "lanes 3 (max this hour; 1 now)". Max is the right fold for a
destructive act: a lane truly lost rests one hour later, a lane momentarily absent rests
nobody. Pinned: 8 minds, hour max 3, tick sample 1 → rest to the edge of 6 (two), not the
floor.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVE — reviewed at exact head 8d39178. The delta from 618a9a9 is the condition, taken in the right shape: the ledger folds the hour's max (at the geometry settle and at every lane grant), the tick reads max(window, now) and RESETS the window to now (so the max cannot ratchet across hours — the mirror is built in), the rest and the verdict stand on it, the line says 'lanes 3 (max this hour; 1 now)' when they differ, and the 8-minds / hour-max-3 / tick-1 fixture pins two rested to the edge of 6, not six to the floor. Merge on green.

@joelteply
joelteply merged commit d8f1fcd into canary Sep 20, 2026
6 checks passed
@joelteply
joelteply deleted the fix/the-roster-is-bounded-by-the-warm-slots branch September 20, 2026 01:56
joelteply added a commit that referenced this pull request Sep 20, 2026
…oaded onto a node whose lanes seat four and starved the plan to a 2,048-token lane (card 7c38ff6f) (#4245)

* fix(persona): the boot draw is bounded by the warm slots — sixteen minds loaded onto a node whose lanes seat four and starved the plan to a 2,048-token lane

The M5 boot on 23d3301, 01:12Z 9/20: the old lane was dead at boot
(`serving.lane_registry.sweep RemovedDead`), the spawner drew all sixteen minds, their
residency left the pinned 27B a 20 GB Eco budget, and the plan launched ONE lane at 2,048
tokens for minds whose typical prompt is 52k. The hourly lane-bound rest (#4244) was fifty
minutes away. Card 7c38ff6f (Joel: the active roster is the warm slots × ~2, the rest
dormant).

`PersonaSpawnerModule::seats()` is now bounded by `bounded_by_warm_slots(seats, lanes)`:
`lanes × MINDS_PER_LANE_STARVED_ABOVE`, never below the resident floor, where `lanes` is the
live lane when one is ready, else the last SETTLED geometry (`served_window_store`) at a cold
boot, else none — and none bounds nothing (an absence is not a number). The memory the
roster would have taken is the plan's for lanes. The mirror is free: the reconciler re-reads
`seats()` every pass, so lanes that grow draw more; lanes that shrink are the hourly rest's.
A `persona.roster.bounded` row when the bound changes what is drawn.

Test: two lanes seat two lanes' worth; one lane seats the edge, never below the floor; lanes
past the population change nothing; None and 0 bound nothing; an empty population stays
empty.

Receipt: the next M5 boot draws 2 × lanes minds (persona.roster.bounded row), the plan's
usable budget stays out of the Eco band, and the lane comes up at the remembered 2 × 67,584.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(persona): the bound reads the lanes the spawner was TOLD (serving_lanes, else the remembered geometry handed in at boot), never a global; the three tests that pinned 'lanes never cap the roster' move to the reversed rule, named

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]>
joelteply added a commit that referenced this pull request Sep 23, 2026
…value needs a span, or a relaunch rests the roster

Astra's review of #4356. LANE_SUSTAINED_MIN_SAMPLES alone does not separate an hour
from a burst, because pulls are not spread through the window — they arrive when the
roster polls. Sixteen residents queueing through ONE 30-second relaunch produce two
dozen samples inside half a minute, every one of them reading the launch's single
lane. That clears a 24-sample floor, and the median of the burst is 1.

Acting on it would rest the roster for a transient — precisely the hazard the peak
was put there to absorb (Cormac, #4244). The count floor was the wrong guard for it.

The ledger now stamps the first and last lane sample of the window (the existing time
owner, `recall_metadata::now_ms` — no new clock), and `lanes_sustained_of` takes the
span. A sustained value requires BOTH: enough samples to say the hour was busy, and
enough span to say it was an hour. Ten minutes is far longer than any relaunch this
substrate performs and still a sixth of the window, so a genuine shortage trips well
inside the hour it happens. Below either floor the peak stands, which actuates nothing.

The new test asserts the distinction and the ACTUATION, not just the number: 32
samples all at one lane across 30 seconds yields no sustained value; the same
distribution across a real span yields 1; and with the guard refusing, the rest
computes against the peak and pages out nobody.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Sep 23, 2026
…st-to-last span are both bought by one stray sample

Astra's second review of #4356, and the counterexample is decisive:

  one 8-lane sample at t0, then 32 one-lane samples during a relaunch at t+10min
    count  = 33  >= 24        PASSES
    span   = 10 min >= 10 min PASSES
    median = 1                RESTS THE ROSTER, on a relaunch

Both my guards measured the wrong thing. A COUNT measures pull volume, and pulls
arrive in bursts, so whoever polls most often decides the median. A first-to-last
SPAN measures the distance between two points, which any single early sample
stretches arbitrarily. Neither measures COVERAGE.

The hour is now judged by its minutes. Thirty two-minute buckets; each bucket keeps
the MAXIMUM lane count seen in it and contributes exactly one value; the sustained
value is the median over buckets that carried a sample, and it exists only once
LANE_MIN_BUCKETS (ten — twenty minutes of *distinct* periods) have one. Volume buys
nothing.

- Per-bucket MAX deliberately: a burst during a relaunch all reads the launch's one
  lane, but if any pull in the same two minutes saw the real count, that is what the
  bucket reports. The bias is AGAINST resting, which is the direction an error should
  take (Cormac's condition on #4244).
- Two minutes is longer than any relaunch here, which is what makes the max absorb one.
- Thirty buckets, not sixty, for the reason this PR already learned once: `std`
  implements `Default` for `[T; N]` only to N = 32 and `Ledger` derives it.

Astra's counterexample now touches exactly TWO buckets, falls below the floor, yields
no sustained value, and the caller keeps the peak — which rests nobody. Asserted both
on the statistic and on the remedy, because gating the number is not gating the act.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Sep 25, 2026
… one it touched once (card 6d444769, P0) (#4356)

* fix(health): starvation is judged on the lanes the hour HELD, not the one it touched once — the seat remedy that never fired

Card 6d444769 (P0). Three hours on the M5 at 98-100% pull deferral, acts in the
teens, writes 0, and `lane_bound_rested: 0` in every one of them. The remedy, its
owner and its probe all existed. Nothing reached them, and the arithmetic is why.

`note_lanes` folds the hour's lane count with `fetch_max`, so `h.lanes` is a PEAK —
a value that can only rise. The starvation rule is `resident > lanes * 2`. With 16
residents and a peak of 8, `16 > 16` is false, so the roster fell through to
`Reading` — a verdict ABOUT THE CITIZENS — and the lane-bound rest, which fires only
for `Starved` or `AtKnee`, was never admitted.

The lane count the node actually had is a different number. 699 samples taken at the
pull gate across those same hours: 1x155, 2x42, 3x344, 4x154, 5x2, 6x2. Never 8.
Median 3. `16 > 3 * 2` is starved, by a lot. The substrate was judging the roster
against a capacity it held for a moment while gating the work on the one it had.

The peak is not wrong, it is the wrong STATISTIC for this job. It exists to stop a
tick that samples a relaunch from resting fourteen of sixteen (Cormac's condition on
 #4244), and that hazard is real — but it buys that protection by making a SUSTAINED
shortage invisible. A median cannot be moved by one bad sample either.

- The hour now carries a lane histogram, sampled at the PULL DECISION — the moment
  the capacity is actually spent, so the distribution is the one the queueing minds
  met rather than the one the node touched.
- `CitizenHealth::lanes_sustained` is its median. The verdict, `lane_bound_seats` and
  `lane_bound_wakes` all divide by it, so the rule and its remedy share one number.
  Rest and wake deliberately use the SAME statistic: resting on the sustained value
  and waking on the peak would flap a seat once an hour.
- Below LANE_SUSTAINED_MIN_SAMPLES (24) the window has no shape and the peak stands.
  That is Cormac's condition kept intact: a handful of pulls taken during a relaunch
  is a launch window, not an hour, and must not rest the roster. The hours that
  motivated this carried 232, 477 and 708 pulls. This node right now carries 3, and
  behaves exactly as before.
- The verdict variants report the number they JUDGED, and the line leads with the
  sustained count, showing the peak only when it disagrees: `lanes 3 (peak 8 this
  hour)`. The gap between them is the diagnosis, and it was invisible all night.

Two tests: the median over the real measured distribution plus the one-dip and
thin-window guards, and the defect itself — the 16-on-a-peak-of-8 receipt, which now
reads STARVED, is lane-bound, and rests ten seats to the edge of six, with the old
arithmetic kept alongside as the contrast.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(health): a COUNT of lane samples is not COVERAGE — the sustained value needs a span, or a relaunch rests the roster

Astra's review of #4356. LANE_SUSTAINED_MIN_SAMPLES alone does not separate an hour
from a burst, because pulls are not spread through the window — they arrive when the
roster polls. Sixteen residents queueing through ONE 30-second relaunch produce two
dozen samples inside half a minute, every one of them reading the launch's single
lane. That clears a 24-sample floor, and the median of the burst is 1.

Acting on it would rest the roster for a transient — precisely the hazard the peak
was put there to absorb (Cormac, #4244). The count floor was the wrong guard for it.

The ledger now stamps the first and last lane sample of the window (the existing time
owner, `recall_metadata::now_ms` — no new clock), and `lanes_sustained_of` takes the
span. A sustained value requires BOTH: enough samples to say the hour was busy, and
enough span to say it was an hour. Ten minutes is far longer than any relaunch this
substrate performs and still a sixth of the window, so a genuine shortage trips well
inside the hour it happens. Below either floor the peak stands, which actuates nothing.

The new test asserts the distinction and the ACTUATION, not just the number: 32
samples all at one lane across 30 seconds yields no sustained value; the same
distribution across a real span yields 1; and with the guard refusing, the rest
computes against the peak and pages out nobody.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(health): the lane histogram is 32 buckets — std implements Default for arrays only to N=32, and Ledger derives it

error[E0277]: the trait bound `[AtomicU64; 33]: std::default::Default` is not satisfied.

A const-generic blanket impl for array Default would conflict with the unit-length
impls, so std stops at 32. `Ledger` derives `Default`, so a 33-bucket histogram
needed a hand-written impl — for a bucket a node serving three lanes will never
reach. Thirty-two buckets, everything above folded into the last, comment says why
so the next person does not 'fix' it back to 33.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(health): the receipt must carry the number the verdict actually used

Caught reviewing my own change against the acceptance-verb rule. The JSON of
`citizen/health` carried `"lanes": h.lanes` — the PEAK — and nothing else. After this
PR the verdict and both seat remedies divide by `lanes_sustained`, so the structured
receipt would have reported a number the decision did not use, while only the prose
`line` carried the real one.

That is this PR's own defect class, committed inside the PR that fixes it: a receipt
reporting the shape next to the decision instead of the decision. A machine reader
gets the peak, a human reading the line gets the sustained value, and they disagree.

`lanes` keeps its meaning (the hour's peak) so no existing consumer moves.
`lanes_sustained` and `lanes_now` join it, which also gives the PR a real acceptance
verb: run `continuum citizen/health` and the JSON carries all three, with `line`
leading on the sustained one.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(health): judge the hour by its MINUTES — a sample count and a first-to-last span are both bought by one stray sample

Astra's second review of #4356, and the counterexample is decisive:

  one 8-lane sample at t0, then 32 one-lane samples during a relaunch at t+10min
    count  = 33  >= 24        PASSES
    span   = 10 min >= 10 min PASSES
    median = 1                RESTS THE ROSTER, on a relaunch

Both my guards measured the wrong thing. A COUNT measures pull volume, and pulls
arrive in bursts, so whoever polls most often decides the median. A first-to-last
SPAN measures the distance between two points, which any single early sample
stretches arbitrarily. Neither measures COVERAGE.

The hour is now judged by its minutes. Thirty two-minute buckets; each bucket keeps
the MAXIMUM lane count seen in it and contributes exactly one value; the sustained
value is the median over buckets that carried a sample, and it exists only once
LANE_MIN_BUCKETS (ten — twenty minutes of *distinct* periods) have one. Volume buys
nothing.

- Per-bucket MAX deliberately: a burst during a relaunch all reads the launch's one
  lane, but if any pull in the same two minutes saw the real count, that is what the
  bucket reports. The bias is AGAINST resting, which is the direction an error should
  take (Cormac's condition on #4244).
- Two minutes is longer than any relaunch here, which is what makes the max absorb one.
- Thirty buckets, not sixty, for the reason this PR already learned once: `std`
  implements `Default` for `[T; N]` only to N = 32 and `Ledger` derives it.

Astra's counterexample now touches exactly TWO buckets, falls below the floor, yields
no sustained value, and the caller keeps the peak — which rests nobody. Asserted both
on the statistic and on the remedy, because gating the number is not gating the act.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant