Skip to content

fix(serving): a seat remembers the typical prompt it served across boots — a boot never plans thinner than what it served - #4207

Merged
joelteply merged 2 commits into
canaryfrom
fix/a-seat-remembers-the-typical-prompt-it-served-across-boots
Sep 19, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fix/a-seat-remembers-the-typical-prompt-it-served-across-boots

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

The 5090's first plan on the new build: lanes=2 served_window=17,313 leased_in=1 host-fit — two 17k slots for coders sending ~30k. The planner chose slots over window because its per-lane floor was the 16,384 bootstrap prior: the leased-in prompt samples that #4197 folds into the floor live in a process-static ring that is empty on a fresh core. Once prompts land, the floor becomes ~37.5k and the same plan says one 49k slot — the boot had forgotten what it served.

The served-window store gains typical_prompt_tokens: the plan tick records the live median when measured (a 0 never overwrites), the spawn's save keeps it, and a boot with no measured median floors from it. Older records read 0 = unknown.

Test plan

  • 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
  • live: the 5090's first plan after its next boot carries demand_window ≥ the remembered typical × 1.25 and does not choose 2 × 17k for 30k coders

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…ots — 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
…embered; 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
@joelteply
joelteply enabled auto-merge (squash) September 19, 2026 01:51
@joelteply
joelteply merged commit fb150a4 into canary Sep 19, 2026
6 checks passed
@joelteply
joelteply deleted the fix/a-seat-remembers-the-typical-prompt-it-served-across-boots branch September 19, 2026 01:51
joelteply added a commit that referenced this pull request Sep 19, 2026
…tprint subtracts its own `--cache-ram`, an unattributable sample retires the record, and the grant leaves co-consumer headroom (#4216)

* fix(serving): the prompt cache the daemon granted is not KV — the measured lane footprint subtracts its own `--cache-ram` before attributing bytes to tokens, an unattributable sample retires the record, and the cache grant leaves the planner's co-consumer headroom

The M5, 2026-09-19 03:25–04:30Z, build 1d2ae5f: the lane ran `--parallel 2 -c 134680
--cache-ram 19519` while the health line said "lanes 1 @ 67k — STARVED: 5 minds on 1
lanes" and the hour delivered 6 acts, 0 writes. The plan said one lane; the process ran
two. Three reads in one line:

1. `lane_footprint::per_token_from` divides the process's whole anonymous footprint by
   lanes × window. The host prompt cache (`--cache-ram`, a grant the daemon itself made)
   fills that same footprint over the serve's life: 16.7 → 20.4 GB across the hour, and
   the reading went 105,919 → 133,720 B/token against a 32,768 estimate. `corrects()`
   fired, the plan's kv/token became ~107k, two lanes at 67k no longer fit usable 26–34 GB,
   and the planner starved the seat it was still running two lanes on.
   Fix: subtract the granted cache before dividing. The reading becomes a LOWER bound on
   the KV-attributable bytes — the only direction a footprint may correct an estimate.

2. The record is persisted (`state/lane-footprint.json`) and fresh for an hour. When the
   new process's sample reads "nothing beyond the cache", `observe` returned None without
   touching the record — the stale 133,720 would have ruled the plan from disk through the
   relaunch that was supposed to fix it. Fix: an unattributable sample RETIRES the record
   (`apply_sample`, pure over the map, tested).

3. `prompt_cache_decision` granted everything above the OS floor: afford 20,468 MiB →
   `--cache-ram 19519`. A cache fills to its grant by design, so that is a grant to end the
   serve at the floor with nothing left for the co-consumers the planner reserves for
   (the core's growth, a sidecar, the eye): the box sat 6 GB into swap with 25 GB in the
   compressor, and a 37,020-token prompt prefilled in 367 s with 0 cached. Fix: the grant
   leaves `CO_CONSUMER_HEADROOM` — the planner's own constant, one place, both decisions.

Probe `serving.footprint.measured` now carries `host_cache_bytes` so the subtraction is
readable on the wire. No change to the lifetime-peak read (#4165) — with the grant
subtracted, the peak's cache component is bounded by the number we subtract.

Card 1c0b60a9 (settles inflated). Related: #4165, #4202, #4207.

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

* test(serving): the three prompt-cache afford pins take the co-consumer share — a cache fills to its grant, so no arm is promised everything above the floor

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 19, 2026
…ne — the served-window store is written on the tick a launch outlives its spawn cooldown, never at spawn

Measured 2026-09-19 on the M5: the 12:19Z Eco-band relaunch spawned `--parallel 1`; the
spawn wrote `lanes: 1` to `served-window.json`; `plan_serving` caps a cold boot's lanes to
the remembered count (#4207, so an 8-lane boot cannot OOM again), so every boot after
(13:2xZ on 2d55932, 13:36Z on 97f480e) planned `min(fit, 1)` = one lane on a box whose
fit at the header rate holds two. A shrink-only ratchet across boots: the smallest lane
count any transient ever spawned became the ceiling forever.

The boot probe already says what it means: "the first launch is the steady one". Make it
true: `settles_this_tick(cooling, ready, lanes)` — the tick the spawn cooldown reaches
zero with the lane serving — is the one that writes the store (`serving.geometry.settled`
probe); the spawn no longer writes it. A launch re-homed inside its cooldown leaves no
mark; the last settled geometry stands for the next boot. The sticky window and the
typical-prompt half of the record are untouched. Card 1c0b60a9 (term 3).

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 19, 2026
…ne — the served-window store is written on the tick a launch outlives its spawn cooldown, never at spawn (#4227)

Measured 2026-09-19 on the M5: the 12:19Z Eco-band relaunch spawned `--parallel 1`; the
spawn wrote `lanes: 1` to `served-window.json`; `plan_serving` caps a cold boot's lanes to
the remembered count (#4207, so an 8-lane boot cannot OOM again), so every boot after
(13:2xZ on 2d55932, 13:36Z on 97f480e) planned `min(fit, 1)` = one lane on a box whose
fit at the header rate holds two. A shrink-only ratchet across boots: the smallest lane
count any transient ever spawned became the ceiling forever.

The boot probe already says what it means: "the first launch is the steady one". Make it
true: `settles_this_tick(cooling, ready, lanes)` — the tick the spawn cooldown reaches
zero with the lane serving — is the one that writes the store (`serving.geometry.settled`
probe); the spawn no longer writes it. A launch re-homed inside its cooldown leaves no
mark; the last settled geometry stands for the next boot. The sticky window and the
typical-prompt half of the record are untouched. Card 1c0b60a9 (term 3).


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