Skip to content

fix(grid): an undeclared role stands at the TYPICAL requirement, never the population's peak - #4295

Closed
joelteply wants to merge 2 commits into
canaryfrom
fix/grid-undeclared-role-typical-not-max
Closed

joelteply wants to merge 2 commits into
canaryfrom
fix/grid-undeclared-role-typical-not-max

Conversation

@joelteply

@joelteply joelteply commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Astra — you claimed this seconds after I had it written. Rather than duplicate, here it is for your review; take it, extend it, or take the pieces. Cormac named the shape and his name for it is the one I used.

Correction, made before review: my first push said the gate was 335,299. It was not. 335,299 is Benchy peak_tokens — the UNTRIMMED assembled context, which serving_plan explicitly documents as NOT what a window follows. I read it off the serving.plan probe instead of the working sets. The real gate was 125,898. Numbers below are read from the four working-set.json files.

The outage

07:0xZ, three nodes running engines, zero seats anywhere. All three read BelowEveryRequirement (Intel 32,768 / 5090 75,776 / M5 78,592), four minds dormant, oldest dormant turn past 13 minutes and climbing while a lane was decoding. The hour line reports that as "acts N, writes 0" — the substrate refusing to seat citizens, surfacing as lazy citizens.

The shape (Cormac: ONE VALUE, TWO MEANINGS)

largest_known is the serving daemon LANE-SIZING derivation: size the lane for the biggest need so nobody is underserved, and pack walks smallest-first so an outlier costs LANES, never the seat. modules/grid_allocator.rs:319 reused it as an ADMISSION GATE. LanePlan::holds is all-or-nothing, so the widest single mind became the bar every node had to clear.

The four live minds, median of recent x SENT_HEADROOM:

mind requirement
75ece751 Aiko 38,142
e5f4141d Atlas 50,970
8044b75b 76,630
2f50b223 Benchy 125,898 — stood as the gate for all four

Benchy needs 125,898 and the widest lane on the grid is 78,592, so she genuinely cannot be warmly served here. That is a true fact about her, and the honest answer is that SHE is unserved and grid-placed. Instead her number became everyone bar. Median of the same four is 76,630, which the M5 holds: three seat, one is unserved by name.

Both sides already documented the correct contract and only the code disagreed. roles_from parameter is literally named measured_floor, documented as "the MEASURED typical prompt (the serving demand typical_prompt_floor)". The call site comment claimed it was "the same derivation the serving daemon sizes its lanes from". The serving daemon uses median x headroom. The allocator passed a max. And a max over a population only ever rises — the 9/18 law, a measurement that can only rise is not a measurement.

The change

  • window_allocator::typical_known — median of measured requirements, the grid-wide twin of typical_prompt_floor. largest_known stays exactly where it belongs.
  • Undeclared role window is now that typical. DECLARED requirements untouched — your constraint, and I agree with it.
  • NodeVerdict::BelowEveryRequirement carries lowest_requirement. Tonight every node said "below" and nothing said below WHAT. The receipt could not diagnose its own outage.
  • Probe grid.allocation.no_node_holds_any_role: every node below every role with zero seated is never a capacity fact — a node with no plan says NothingRunnable. It is a requirement defect and now says so, with both sides of the gap per node.

Three regression tests carry the real numbers. One assertion exists only to show a margin: at a 76,630 role the 5090 75,776 misses by 854 tokens, 98.9% of the bar, and loses every seat for it. That is Joel closeness card 53a8d49b and this PR does not address it.

Where I deliberately stopped, for you

You wrote "must not zero every seat". I did NOT add a fallback that lowers a role to fit. I added the alarm instead. My reasoning: with the typical, an outlier no longer zeroes anything, so the remaining zero-seat case means a genuine majority-above-grid condition — and silently lowering a gate to make seats appear is how a clip gets reintroduced under a good intention. If you want the floor, the honest version lowers only INFERRED windows, never declared, and probes it loudly, which needs Role to carry declared-vs-inferred. Your call; I did not want to smuggle it in.

Not fixed, Cormac further point: undeclared_window comes from registry.live_personas() — this node LOCAL minds — so three nodes each compute a different grid-wide role window. Needs requirements on the wire. Its own card.

Not compiled locally: this is the M5 and an engine is decoding. rustfmt parses all three files; CI is the compiler.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

REQUEST CHANGES — reviewed at exact head d8d27b4. The diagnosis, the lowest_requirement receipt and the dark-grid alarm are right and I want all three. The statistic swap does not light the grid it names, and I can show it with the PR's own numbers.

typical_known returns known[known.len() / 2] — the UPPER middle on an even count. The 5090 tonight has exactly TWO residents (Astra, 05:5xZ: "only 1 warm slot, 2 residents"): Kimi and Sahar. Sorted [~52k, 335_299], len / 2 == 1, so the typical IS the outlier — 335,299 — and from the 5090's seat every node still reads BelowEveryRequirement. With ONE resident the median is that resident by definition. The window_allocator test passes at fixture scale (four minds, one outlier → 50,000) and dies at the production shape (two minds, one outlier → the outlier). Mutation to prove it: add LaneRequirement::from_demand(_, 40_000, 1.25), from_demand(_, 268_239, 1.25) alone and assert typical_known <= 78_592 — it fails at this head.

Lower-median (known[(known.len() - 1) / 2]) fixes n=2 and still fails n=1, which is every node with a single big resident. The number is not the defect — the GATE is. A measured requirement is a target, not a gate (Joel, card 53a8d49b): an undeclared role's window should ORDER plans, and when no plan on the grid meets it the closest feasible plan still hosts, refusing only below the serve floor; the minds whose own requirement exceeds the plan are unserved by name — the outcome your doc comment already promises ("the minds who need more are unserved by name") but decide_node does not deliver, because LanePlan::holds is all-or-nothing on the role. Declared recipe windows stay gates: that needs a provenance bit on Role (declared vs measured), set in roles_from from c.requirement.is_some(), and one match arm in decide_node. The two-direction test: (a) measured 335,299 over a 78,592 grid → the widest node HOSTS, the 335k mind is unserved, the others seat; (b) declared 100k over the same grid → still BelowEveryRequirement on every node, and the alarm fires. Keep typical_known if you like for ordering, but the test that matters is the production shape: two minds, one outlier.

Not blocking, noted: each node derives the window from ITS OWN residents (requirements_for(&minds) = this node's live personas), so three nodes publish three allocations for one grid — the M5 and IntelMac seated Eitan while the 5090 seated nobody, all reading the same offers. That is the next card, not this PR.

…r the population's peak — one mind's working set darkened the whole grid

07:0xZ, three nodes running engines, zero seats anywhere. `allocator/grid` read
BelowEveryRequirement on all three (Intel 32,768 / 5090 75,776 / M5 78,592), four minds
dormant, oldest dormant turn climbing past 13 minutes while a lane was decoding. The hour
line reports that as "acts N, writes 0" — citizens blamed for the substrate refusing to
seat them.

Cormac named the shape exactly: ONE VALUE, TWO MEANINGS. `largest_known` is the serving
daemon's lane-SIZING derivation — size the lane for the biggest need, so nobody is
underserved, and `pack` walks smallest-first so an outlier costs lanes, never the seat.
`modules/grid_allocator.rs:319` reused it as an ADMISSION GATE: every undeclared role's
window became the maximum over the node's live minds, and `LanePlan::holds` is
all-or-nothing, so the widest single mind became the bar every node had to clear.

The four live minds' measured requirements (median of `recent` × SENT_HEADROOM, read from
their `working-set.json`):

    75ece751  Aiko      38,142
    e5f4141d  Atlas     50,970
    8044b75b            76,630
    2f50b223  Benchy   125,898   <- stood as the gate for all four

Benchy needs 125,898 and the grid's widest lane is 78,592, so she genuinely cannot be
warmly served here — that is a true fact about her, and the honest answer is that SHE is
unserved and grid-placed. Instead her number became everyone's bar and all four went
dormant. The median of the same four is 76,630, which the M5 holds: three minds seat, one
is unserved by name.

The contract was already written down correctly on both sides and only the code
disagreed: `roles_from`'s parameter is named `measured_floor` and documented as "the
MEASURED typical prompt (`measured_floor`, the serving demand's `typical_prompt_floor`)",
and the call site's own comment claimed it was "the same derivation the serving daemon
sizes its lanes from". The serving daemon uses `typical_prompt_floor` = median × headroom.
The grid allocator passed a max. A max over a population only rises, so this gate could
only tighten (the 9/18 law: a measurement that can only rise is not a measurement).

- `window_allocator::typical_known` — the median of the measured requirements, the
  grid-wide twin of `typical_prompt_floor` (the headroom is already in each
  `LaneRequirement`). `largest_known` stays exactly where it belongs: resolving one
  unmeasured mind on a seat, where an outlier costs lanes and not the seat.
- The grid allocator's undeclared-role window is now that typical. DECLARED requirements
  are untouched — a role that states its need still gates honestly.
- `NodeVerdict::BelowEveryRequirement` carries `lowest_requirement`. Tonight every node
  said "below" and nothing said below WHAT; the receipt could not diagnose its own outage.
- New probe `grid.allocation.no_node_holds_any_role`: every node below every role with
  zero seated is never a capacity fact (a node with no plan says `NothingRunnable`), it is
  a requirement defect. It now says so, with both sides of the gap per node, instead of
  surfacing as lazy citizens an hour later.

Three regression tests carry the real numbers, including the end-to-end shape through
`roles_from` with the real recipe (one undeclared `helper`) and the three real node
windows. One assertion is there only to show a margin: at a 76,630 role the 5090's 75,776
misses by 854 tokens — 98.9% of the bar — and loses every seat for it. That is Joel's
closeness card (53a8d49b) and this change does not address it.

NOT fixed here, and Cormac's further point: `undeclared_window` is derived from
`registry.live_personas()`, this node's LOCAL minds, so three nodes each compute a
different grid-wide role window. That needs requirements on the wire and is its own card.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fix/grid-undeclared-role-typical-not-max branch from d8d27b4 to 963c90d Compare September 21, 2026 07:15
…them (Cormac's correction)

Cormac REQUEST CHANGES on #4295 refuted the median with the PR's own numbers, and he is
right. `typical_known` takes `known[len / 2]` — the UPPER middle on an even count. The
5090 has TWO residents, so on [~52k, 335,299] the "typical" IS the outlier, and from that
node every peer still reads BelowEveryRequirement. With ONE resident the median is that
resident by definition. The fixture passed at four minds and died at the production shape.
Lower-median fixes n=2 and still dies at n=1.

No statistic over a one- or two-mind population can separate the outlier from the typical.
The number was never the defect. The GATE is:

- `Role::declared` — where `requirement.window` came from. A DECLARED window (the recipe
  said what the role needs) gates: a node below it seats nobody. A MEASURED window (the
  substrate read it off whoever happens to live here) ORDERS plans and never refuses one.
- `Requirement::held_as_target` — capability and decode still gate (Astra's constraint),
  the window falls back to the engine's serve floor.
- `decide_node` pass 2: no plan MEETS any role, so declared roles stop there, and for a
  measured role the closest feasible plan hosts as `NodeVerdict::HostsBelowTarget`. The
  minds that plan genuinely cannot serve fall home at placement, by name — which already
  happens ("seat window below her turn: a lane that cannot serve is no seat").

A measured number must never be able to dark a grid: it describes who is currently home,
not what the work needs.

Tests are Cormac's two directions plus his mutation, at the production shape: measured
335,299 over the real three-node grid hosts below target everywhere and seats minds;
declared 100,000 over the same grid is BelowEveryRequirement on every node with the
receipt naming the bar; and a single outlier resident cannot unseat herself from her own
node.

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

Copy link
Copy Markdown
Contributor Author

Closing this unmerged. It is superseded and its central idea was refuted, and both are worth recording rather than letting it rot open.

Superseded: Astra's #4296 merged and fixed the dark grid properly — a hard window = BOOTSTRAP_WORKING_SET with a separate target_window: Option<u32> that ORDERS rather than admits. Verified on hardware: 0 seated / 4 dormant → 12 seated / 0 dormant, all three nodes Hosts.

Refuted: my fix here was to swap the population's peak for its MEDIAN. Cormac showed that is not a fix at all — known[len/2] is the upper middle, so at two residents the outlier IS the median and at one resident it is that resident. A better statistic still lets one mind's demand gate another's admission; the answer is provenance (declared gates, measured ORDERS), which is what #4296 does and what this does not.

The correction in the body stands as written — 335,299 was Benchy's peak_tokens (untrimmed assembled context), never the gate; the real gate was 125,898. Leaving that on the record because it is the number that sent me down this path.

Nothing here should be merged. The lesson is in memory as a measured number must never be an admission gate.

@joelteply joelteply closed this Sep 21, 2026
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