Skip to content

feat(grid): a seat advertises its OWN free slots and its OWN queue on the beacon — S1's seat side - #4198

Merged
joelteply merged 1 commit into
canaryfrom
fix/a-seat-advertises-its-own-free-slots-and-wait
Sep 18, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/a-seat-advertises-its-own-free-slots-and-wait

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Governor slice S1, seat half (card c84d885a; follows S2 #4197). S2 makes a seat size itself for what arrives; S1 stops more arriving than fits. This PR is the half a seat can do alone: say the truth about itself, where the truth is measured. It changes no placement decision — it makes the seat's truth available to the chooser (S1b, next PR, with Cormac's word on placement).

Two facts a seat now carries on CapacityOffer (serde-default, additive; PeerOffer mirrors them):

field meaning why
free_slots_live served lanes − everything in flight on them (local turns and leased-in generates), off the seat's own admission gauges lanes − residents was roster arithmetic every node evaluated on its own — the M5 and IntelMac each read the 5090 as free and spilled onto one slot at once
lane_wait_p50_ms + lane_wait_samples the seat's own median receipt → first-progress wait for the generates it served for other nodes measured where the queue forms: stamped at StreamPublisher.received_at, closed at the first prefill frame or token. A citizen's delib.gate.lane_wait is stamped on her home node and includes the wire. The sample count makes 0 ms / 0 samples read as UNMEASURED, never as a fast seat

Mechanism: resource_admission gains a bounded ring (64) of first-progress waits and a pure p50_of (median, not mean — one 7,058 s outlier is not the seat's wait); command_handler's publisher records first progress once per generate; grid_capacity::offer_from_board fills the beacon; grid/mod.rs maps offer → PeerOffer.

Test plan

  • 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
  • on the 5090 after deploy + an hour of load: the beacon's lane_wait_p50_ms with lane_wait_samples > 0 — the first time the seat has said what its queue is

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

… 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
joelteply enabled auto-merge (squash) September 18, 2026 20:52
@joelteply
joelteply merged commit 1800bd9 into canary Sep 18, 2026
6 checks passed
@joelteply
joelteply deleted the fix/a-seat-advertises-its-own-free-slots-and-wait branch September 18, 2026 21:13
joelteply added a commit that referenced this pull request Sep 19, 2026
…ll does — the seat's grant bounds the fleet's swing (#4206)

2026-09-19 00:3xZ, the first minutes after the 5090 ran #4198: its beacon carried its measured
wait, read QUEUED, and the IntelMac brought all seven bound minds home in one tick — S1b doing
its job. The tick that seat's p50 dips under the bound, `decide` says ReturnRemote for all seven
at once, and `apply(ReturnRemote)` re-bound WITHOUT a grant: seven returns rebuild the very
queue they left, then all seven fall home again — the metronome at fleet scale, one cooldown
per swing. The lease (#4199) exists for exactly this; the return path did not use it.

Now a return asks the seat for its slot as a spill does (`request_reservation`, bounded by the
seat's own freshness window): the seat grants `free_slots_live − outstanding`, the rest stay
home until its beacon shows room. Refused or unanswered = Stay, receipted
(`placement.return.leased` / `placement.return.refused`). One ledger for both paths, so a
return can never take a slot a spill was granted.

Test: seven_returning_minds_take_only_the_seats_free_slots_and_the_rest_stay_home — two slots,
two returns, five wait, and a spill from another node then finds nothing. Whole-file:
placement_switch, placement_reservation, source_hygiene — 32/32.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5.1 <[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