Skip to content

A mind's requirement is a type: nothing is sized from a number that stands in for a measurement (card 2ce30e8f) - #5750

Merged
joelteply merged 2 commits into
canaryfrom
fable/requirement-is-a-type
Nov 4, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fable/requirement-is-a-type

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves the minds by sizing each window from the mind's own measurement. On the M5 at 00:02Z, one wish took half a 524k pool and Atlas got nothing; with this change every measured mind gets her need first. Plan line 3 (EngineConfig and KV capacity).

Joel, 2026-11-03: "Undefined type values is how you do it. And you require it to be set period"; "Try to avoid fallbacks unless it is literally impossible otherwise"; "You must use a compiler to enforce contracts".

What changes

  • LaneRequirement drops window: Option<u32>, need: Option<u32> and source for one Measure enum over NonZeroU32 (Tokens): Unmeasured | Wished { target } | Held { need, target } | Declared { target }.
    • held() clamps the need to the target, so need <= target holds by construction.
    • working_set loses its two 0 = no measurement unwrap_or sentinels.
  • The allocator packs measured minds only. resolve() used to give an unmeasured mind the seat's largest requirement, else the model's whole fit. She now has no number and stays unserved until her first view measures her; prompt/view.rs:519 records the wish before she asks for a lane. A seat with nobody measured is NoRequirements.
  • Grants give each mind her need, and her target only when every target fits. The population borrow (population_requirement, PoolGrants::from_population) is deleted. Holder floors and in-flight keeps from A grant is never below a mind's need, and a held grant survives drift #5745 are unchanged.
  • Test literals: one test_tokens fixture behind test-fixtures (the grid crate keeps a local copy because it has no fixture dev-dependency). The sim's scenario literals are checked nonzero at compile time with an inline const.

Measured

  • Live symptom (M5, b7c8154, 00:02Z, serving.grants): pool 524,288; Benchy 262,144 (the model's whole window), Aiko 104,015, Aris 88,380, Atlas none. Each grant was a wish.
  • Tests (M5 serving-down window, 00:06-00:17Z): continuum-engine --lib 1,418 passed; continuum-serving --lib 138; continuum-grid --lib 110; cognition working_set 20.
  • Clippy: the two flags in touched files are fixed. planning.rs:224's type-complexity warning predates this change and is out of scope.
  • After deploy: serving.grants should show all four residents granted, with the sum within the pool. Owner: Fable, at the deploy.

Net +272/-219 across 9 files; deletes population_requirement, from_population, RequirementSource, from_demand, with_need and resolve.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

… nothing is sized from a number that stands in for a measurement (card 2ce30e8f)

Joel, 2026-11-03: "Undefined type values is how you do it. And you require it to be set period";
"Try to avoid fallbacks unless it is literally impossible otherwise"; "You must use a compiler to
enforce contracts".

- LaneRequirement's window: Option<u32> + need: Option<u32> + source become one Measure enum over
  NonZeroU32 Tokens. working_set's 0-as-unmeasured sentinels (two JUSTIFIED unwrap_or) are gone: a
  mind with no turn is LaneRequirement::unmeasured, a wish is wished(Tokens), a held floor is held(Tokens).
- The allocator packs measured minds only. An unmeasured one was resolved to the seat's largest
  requirement or the model's whole fit; she now has no number and is unserved until her first view
  measures her (prompt/view.rs records the wish before she asks for a lane). Nobody measured is
  NoRequirements.
- Grants grant her NEED, and her target only when every target fits. On the M5 (b7c8154, 00:02Z)
  grants sized from wishes gave Benchy 262,144, Aiko 104,015, Aris 88,380 of a 524,288 pool and Atlas
  nothing. The population borrow for unmeasured minds (grants.rs population_requirement and
  PoolGrants::from_population) is deleted.
- Test literals: one test_tokens fixture behind test-fixtures; the sim's scenario literals are checked
  nonzero at compile time (inline const).

M5 serving-down window 00:06-00:17Z: continuum-engine 1,418, continuum-serving 138, continuum-grid 110,
cognition working_set 20 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

CHANGES at 181f765 (Cormac; author session 01LoTjvf…, not mine). The core is right, with one conservation hole it widens.

Verified:

  • Needs are granted first, and targets only when every target fits (aim returns only when total(&aim) <= pool, and aim >= want). The rest of the policy is unchanged from A grant is never below a mind's need, and a held grant survives drift #5745, which I traced branch by branch.
  • The population borrow is gone, and Measure makes "not measured" a type.
  • The test is exactly the live case: wishes summing past the pool get needs only.

The hole: grants_now builds a Demand only for a measured mind (r.measure.need()? in the filter_map). An unmeasured resident is absent from the map. Absent means she keeps her binding (rehome.rs:83 drops a None), and a resident with no grant keeps her PROVISIONAL window: materialize_adapters.rs:166 leaves profile.context_length, her planned window, up to the model's trained 262,144 on the M5. Her first turn can build its prompt up to that. Nothing counts it:

  • the M5 at 524,288 with four measured minds whose targets all fit: the pool is fully granted;
  • a fifth resident seated, unmeasured: absent, bound to her provisional window, her first prompt sized to it against a full pool.

Before #5750 she borrowed the median, which was at least counted. Now she is uncounted whenever anyone else is measured. It is the same class as #5745's floors: absent from the map must mean holding nothing.

Fix, no borrowed number: an unmeasured mind gets a Demand with need = target = serving_plan::BOOTSTRAP_WORKING_SET (the substrate's own full-turn floor, which materialize_adapters already uses for the remote case). She is then counted: granted the floor, or waiting whole like any newcomer, and her first view measures her. Typed, so Measure::Unmeasured reads as "the floor", never a number taken from another mind. Add the case to what_is_bound_never_exceeds_the_pool: four measured minds whose targets fill the pool, plus an unmeasured fifth.

@joelteply

Copy link
Copy Markdown
Contributor Author

PASS at 181f765 (Cormac), choosing option (a) from Fable's two: merge as-is.

The hole I raised (a brand-new local mind's first turn at her provisional window, uncounted) is carded with an owner: card a156ee65, which is admission by the request's exact cells (ONE-BUDGET 3b) and deletes per-mind grants, rebinds and the provisional window. I checked the claim that makes it rare. working_set.rs persists every observation ("a restart must not re-strangle her"), so existing residents boot measured. Only a mind new to the node hits it, until a156ee65 lands. Park-until-granted would be deleted by that cut, so it isn't worth adding here.

Verified at this head, from my first read: needs before targets, targets only when all fit, the population borrow deleted, Measure typed.

…ounded by its counts, the served-window record placed through durable staging

The touched-file ratchets on #5750 named four pre-existing sites:
- grid_allocator: two hand-sliced ids ([..8], chars().take(8)) render through airc_core::shown_id::shown_form;
- grid_allocator: slack_seats' clamp(0.0, 1.0) goes; idle_fraction(free, lanes) is in [0, 1] by construction (free.min(lanes) / lanes, no lanes = no idle seat), one helper for the local and peer readings;
- served_window_store: fs::write becomes continuum_host::durable::Staging (staged, synced, renamed), so a crash leaves the old record or the new, never a torn one; the swallowed create_dir_all error and the write error now reach the store_failed probe.

M5 serving-down window 00:26-00:30Z: ratchets against canary pass; continuum-grid 110; engine served_window/window_* 31; clippy clean in touched files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

PASS at 22d4340 (Cormac). The delta from 181f765 (where I passed) is two files: the touched-file ratchet fixes and nothing in the grant logic.

Verified:

  • idle_fraction: min(free, lanes) / lanes, with 0 lanes giving 0. It equals the old free / lanes clamped to [0, 1] for unsigned counts, and every count here is u32 (grid_allocator.rs:134-135, gossip.rs:89,101), so as u64 is lossless and no negative can wrap.
  • The removed .clamp: slack_seats has one production caller (:479), whose idle_of returns idle_fraction(..) or 0.0, both in [0, 1], plus a test passing 0.5. Removing the clamp changes no result.
  • served_window_store::place: goes through continuum_host::durable::Staging (staged, synced, renamed). The old ignored create_dir_all error and the bare fs::write failure now reach the probe as error.
  • shown_form: replaces two hand-sliced 8-character id prefixes, in display strings only.

@joelteply
joelteply merged commit d47c5c2 into canary Nov 4, 2026
32 checks passed
@joelteply
joelteply deleted the fable/requirement-is-a-type branch November 4, 2026 00:41
joelteply added a commit that referenced this pull request Nov 4, 2026
…h is refused: Cormac's three on #5752 (and a spin it exposed)

1. An ungranted mind is MEASURED before she waits (capacity::mind_window::decide_window: decide, else
   measure her view, which records her wish, then wait on grants, then decide again). Waiting first
   waited forever: only a measured mind gets a grant since #5750. Test
   an_ungranted_mind_is_measured_before_she_parks_then_runs_at_her_grant.
2. One writer per binding: a mind on the shared pool is bound only by the re-home reconciler from her
   grant; the turn uses the decided window and writes nothing. A remote lane's report has no other
   writer, so the turn still persists it (Decided::Lane only; the 2026-08-24 model_loadout fix stands).
3. grants_changed returns GrantsUnavailable when no watch is installed; the turn refuses with a typed
   fault instead of hanging. Test no_grants_watch_is_a_typed_refusal_never_a_hang.
Spin found in the first window (199% CPU, 37 min): CapacityReadiness::wait took a refused watch as a
wake and looped inside one poll. With no watch the grants arm now never fires (the turn's
decide_window is where a missing watch is refused). Guard test
an_unchanged_capacity_wait_parks_and_never_spins polls once on its own thread: a spin fails it in 5 s.

M5 windows 02:13-02:56Z: engine capacity/openai/airc_remote 310, mind_window 2; cognition workspace +
llm_deliberation_faculty 164; mind placement_switch 25.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Nov 4, 2026
…the turn and its readiness ask it (card de7bb6e8) (#5752)

* One determiner of a mind's window: capacity::mind_window decides it, and the turn and its capacity readiness ask it (card de7bb6e8)

On the M5 (0b28543, 01:39-01:51Z) two owners fought over Aiko's window: the re-home reconciler bound her
grant (20,817), then every turn adopted the adapter's live window, the serving snapshot's per-sequence
share (18,380), back into her binding (contribute.rs compare_and_swap): 15 rebinds in 12 minutes, each
costing her prompt cache. Joel: 'need one centralized determiner'.

- capacity::mind_window(persona, adapter, bound) -> MindWindow::{Ungranted, Decided(Granted | Lane | Bound)}:
  on the node's shared pool her grant, else the lane's own report, else her binding. A decided window
  always has a size (no Option, no panic); ungranted has none.
- AIProviderAdapter::serves_on_shared_pool (the local provider when not on a dedicated lane; the placement
  switch delegates to its target). On the shared pool the snapshot's per-sequence window is nobody's.
- The turn (contribute.rs) asks once; an ungranted mind waits on the grants watch (grants_changed, an
  event, no timer) and never runs at a provisional window, which also closes #5750's hole for a new mind.
  A grant is adopted exactly (no growth deadband: one owner decided it); a lane's report keeps its deadband.
- CapacityReadiness takes the persona and the decided window, re-decides through mind_window, and its wait
  also wakes on a new grant.
- Unchanged on purpose: ai/generate and request replay stamp the LANE's reported window on a response or a
  replay receipt (a fact about the lane, not a mind's window).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The placement fixture asks the one determiner; derive InferenceDevice's Default; drop a no-op cast (clippy in touched files)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Measure before parking, one writer per binding, a missing grants watch is refused: Cormac's three on #5752 (and a spin it exposed)

1. An ungranted mind is MEASURED before she waits (capacity::mind_window::decide_window: decide, else
   measure her view, which records her wish, then wait on grants, then decide again). Waiting first
   waited forever: only a measured mind gets a grant since #5750. Test
   an_ungranted_mind_is_measured_before_she_parks_then_runs_at_her_grant.
2. One writer per binding: a mind on the shared pool is bound only by the re-home reconciler from her
   grant; the turn uses the decided window and writes nothing. A remote lane's report has no other
   writer, so the turn still persists it (Decided::Lane only; the 2026-08-24 model_loadout fix stands).
3. grants_changed returns GrantsUnavailable when no watch is installed; the turn refuses with a typed
   fault instead of hanging. Test no_grants_watch_is_a_typed_refusal_never_a_hang.
Spin found in the first window (199% CPU, 37 min): CapacityReadiness::wait took a refused watch as a
wake and looped inside one poll. With no watch the grants arm now never fires (the turn's
decide_window is where a missing watch is refused). Guard test
an_unchanged_capacity_wait_parks_and_never_spins polls once on its own thread: a spin fails it in 5 s.

M5 windows 02:13-02:56Z: engine capacity/openai/airc_remote 310, mind_window 2; cognition workspace +
llm_deliberation_faculty 164; mind placement_switch 25.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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