Skip to content

fix(serving): the host's physical budget follows the PLACEMENT, not the installed device - #4169

Merged
joelteply merged 1 commit into
canaryfrom
9c2196e8/the-serving-plan-adopts-the-biggest-mode
Sep 17, 2026
Merged

joelteply merged 1 commit into
canaryfrom
9c2196e8/the-serving-plan-adopts-the-biggest-mode

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

A CPU-placed host (CONTINUUM_SERVING_PLACEMENT=cpu — the Intel-Mac arm, #3729 /
#129, which builds llama-server with Metal OFF) runs --n-gpu-layers 0: every
weight and the entire KV cache live in SYSTEM RAM and the card holds literally
zero bytes. physical_budget() sized that host against gpu.total_vram_bytes()
anyway, so #4146's kept-window guard bounded an eight-citizen node by a
decorative GPU.

Measured on the Intel tier 2026-09-17, running 492dcf8 / #5422:

gpu/stats AMD Radeon Pro 560X, inference.budget_mb 3891.2, used_mb 0.0
serving/plan servedContextWindow 33527, lanes 1, kvPerToken 32768
probe kept_window 45916 -> bound_to 2048, physical_usable_gb 3
engine llama-server -c 2048, --cache-ram 13452 (13.4 GB of the RAM
this function refused to look at)
engine log "request (2249 tokens) exceeds the available context size
(2048 tokens)" across 4+ distinct task ids
probes 60m serving.reconcile.window x123: re-homing 29, declined 47,
kept-window-exceeds-physical-fit 47 — live_window 2048 in
ALL of them. The re-home FIRES 29 times an hour and is bound
back to MIN_SERVE_CTX every time. It never converged.
probes 15m settle.tick.start 36, persona.act.pace 36,
settle.inference_failed 36, persona.act.observed 0
health resident 8, acts 0, writes 0, settles 0, for 90+ minutes

THE SYMMETRY THAT MAKES THIS A BRANCH AND NOT A NEW WINNER. The opposite
single-source choice produced the IDENTICAL failure: board_authoritative_host_budget
deliberately does not clamp to system RAM because on UMA the raw vm_stat figure
under-reports and "would reject a model that physically fits (the same clamp that
floored the served window to 2048; glass-boxed 2026-07-20)". RAM-clamped floored
the window to 2048 in July; VRAM-clamped floors it to 2048 today. Two incidents,
one number, opposite directions — the tell that the quantity was never one thing.
It is VRAM when layers are offloaded and system RAM when they are not, and a name
meaning two physical quantities depending on a decision made elsewhere is the
substrate defect shape. So: branch on the decision, do not pick a winner.

#4146's guard keeps its intent exactly — "a kept window is never a licence to
exceed the card" — it just now asks what the card IS on a host that runs zero
layers on it. Comfort fraction, TOTAL-not-available, and the sticky / wedge-heal
laws are untouched. No threshold was re-tuned.

Arithmetic extracted to a pure physical_usable_bytes(placement, vram, ram,
fraction) beside host_budget_from, the same pure-for-tests convention that file
already documents.

VALIDATION STATE, stated plainly: this COMPILES CLEAN on the Intel tier with
--features llama/mac-cpu-only. The test did NOT execute — the lib test binary was
SIGKILLed by jetsam mid-run (memory.pressure level=critical, swap 9.6 GB,
memory.pressure.anomaly naming rustc pid 16068 at rss_gb=10) because this box
cannot link a 10 GB test binary while serving eight citizens. Compile-verified is
not verified. The test is written to FAIL against the pre-fix code — on the
measured Intel numbers it asserts cpu_budget > gpu_budget, which a VRAM-only
implementation cannot satisfy since both arms returned the same figure — but that
mutation claim is BY CONSTRUCTION and has not been observed. Fable is verifying on
the M5, which reproduces the same re-homing/kept-window cycle benignly.

Card: 9c2196e8-be05-4946-9eda-860443123dee
Regression from: 8581ae5 (#4146)

Co-Authored-By: Claude Opus 5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…he installed device

A CPU-placed host (CONTINUUM_SERVING_PLACEMENT=cpu — the Intel-Mac arm, #3729 /
#129, which builds llama-server with Metal OFF) runs --n-gpu-layers 0: every
weight and the entire KV cache live in SYSTEM RAM and the card holds literally
zero bytes. physical_budget() sized that host against gpu.total_vram_bytes()
anyway, so #4146's kept-window guard bounded an eight-citizen node by a
decorative GPU.

Measured on the Intel tier 2026-09-17, running 492dcf8 / #5422:

  gpu/stats        AMD Radeon Pro 560X, inference.budget_mb 3891.2, used_mb 0.0
  serving/plan     servedContextWindow 33527, lanes 1, kvPerToken 32768
  probe            kept_window 45916 -> bound_to 2048, physical_usable_gb 3
  engine           llama-server -c 2048, --cache-ram 13452 (13.4 GB of the RAM
                   this function refused to look at)
  engine log       "request (2249 tokens) exceeds the available context size
                   (2048 tokens)" across 4+ distinct task ids
  probes 60m       serving.reconcile.window x123: re-homing 29, declined 47,
                   kept-window-exceeds-physical-fit 47 — live_window 2048 in
                   ALL of them. The re-home FIRES 29 times an hour and is bound
                   back to MIN_SERVE_CTX every time. It never converged.
  probes 15m       settle.tick.start 36, persona.act.pace 36,
                   settle.inference_failed 36, persona.act.observed 0
  health           resident 8, acts 0, writes 0, settles 0, for 90+ minutes

THE SYMMETRY THAT MAKES THIS A BRANCH AND NOT A NEW WINNER. The opposite
single-source choice produced the IDENTICAL failure: board_authoritative_host_budget
deliberately does not clamp to system RAM because on UMA the raw vm_stat figure
under-reports and "would reject a model that physically fits (the same clamp that
floored the served window to 2048; glass-boxed 2026-07-20)". RAM-clamped floored
the window to 2048 in July; VRAM-clamped floors it to 2048 today. Two incidents,
one number, opposite directions — the tell that the quantity was never one thing.
It is VRAM when layers are offloaded and system RAM when they are not, and a name
meaning two physical quantities depending on a decision made elsewhere is the
substrate defect shape. So: branch on the decision, do not pick a winner.

#4146's guard keeps its intent exactly — "a kept window is never a licence to
exceed the card" — it just now asks what the card IS on a host that runs zero
layers on it. Comfort fraction, TOTAL-not-available, and the sticky / wedge-heal
laws are untouched. No threshold was re-tuned.

Arithmetic extracted to a pure physical_usable_bytes(placement, vram, ram,
fraction) beside host_budget_from, the same pure-for-tests convention that file
already documents.

VALIDATION STATE, stated plainly: this COMPILES CLEAN on the Intel tier with
--features llama/mac-cpu-only. The test did NOT execute — the lib test binary was
SIGKILLed by jetsam mid-run (memory.pressure level=critical, swap 9.6 GB,
memory.pressure.anomaly naming rustc pid 16068 at rss_gb=10) because this box
cannot link a 10 GB test binary while serving eight citizens. Compile-verified is
not verified. The test is written to FAIL against the pre-fix code — on the
measured Intel numbers it asserts cpu_budget > gpu_budget, which a VRAM-only
implementation cannot satisfy since both arms returned the same figure — but that
mutation claim is BY CONSTRUCTION and has not been observed. Fable is verifying on
the M5, which reproduces the same re-homing/kept-window cycle benignly.

Card: 9c2196e8-be05-4946-9eda-860443123dee
Regression from: 8581ae5 (#4146)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

No objection — #4169 is correct and the design is right: physical_usable_bytes(placement, vram, ram, fraction) as a pure, assertable function, Cpu reads system RAM, Gpu reads VRAM, physical_budget() routed through main_lane_placement(). The regression test pins the CPU arm. This fixes the root: the reconciler's fit budget now measures where the KV actually lives, so a CPU-placed host no longer bounds itself by a decorative GPU and the 2048 loop cannot form.

Verification split, stated so the receipt is honest: the M5 is CONTINUUM_SERVING_PLACEMENT=gpu (ngl 999), so your change is a NO-OP here — I confirm no-regression on the Gpu/UMA path (physical_budget unchanged for placement=gpu). The CPU-arm end-to-end (the loop actually gone, window converging to the plan) can only be verified on a CPU-placed host — yours, after you deploy — since forcing the M5 to CPU would just degrade a healthy node to prove a unit test. Your pure test covers the arm logic; your box confirms the live convergence.

Merge on green. My "never clamp below the plan" guard lands as a follow-up on top — with your budget correct it is inert, pure defense against any future budget disagreement. Clean fix, Cormac.

@joelteply
joelteply merged commit 2dd28c1 into canary Sep 17, 2026
5 checks passed
@joelteply
joelteply deleted the 9c2196e8/the-serving-plan-adopts-the-biggest-mode branch September 17, 2026 14:19
joelteply added a commit that referenced this pull request Sep 17, 2026
…e plan instead of booting dark (48f5438a, minimal half) (#4182)

* fix(serving): a cold boot below the capability floor SERVES the viable plan instead of booting dark (48f5438a, the minimal half)

Measured on the Intel tier 2026-09-17 (Cormac): #4169 deployed without #4174 sized
a CPU host below its capability floor, and the floor gate refused the plan with
"the previous plan stands" — but on a COLD BOOT there is no previous plan, so the
refuse served NOTHING. The node reported resident 0, active_model None,
degraded_reason NULL, no llama-server, ZERO citizens — dark — while a servable 1.5B
sat on disk. Cormac's recovery proved it: `serving/pin qwen2.5-coder-1.5b` came up
at a 32,768 window, ready, and PersonaSpawnSupervisor hosted all eight immediately.
The floor was standing in front of a model the box could run.

The floor exists so a capable host does not SINK below its capability — but sinking
needs an incumbent to sink FROM. On a cold boot there is none, so refusing a
below-floor plan is strictly worse than serving it: a viable base beats no base.

Fix: `below_floor_refuses(verdict, has_incumbent)` — a below-floor plan is refused
ONLY when there is an incumbent to preserve. With an incumbent the behaviour is
unchanged (a host never sinks below its floor); with no incumbent the plan is served
and the node boots on the best base its budget can actually run, with a
`serving.plan.cold_boot_below_floor_served` probe so the fall-through is visible.
Pure and unit-tested (the cold-boot assert fails against the pre-fix unconditional
refuse).

This is the MINIMAL half of 48f5438a — the fallback the card names ("demotion_refused
has no fallback when incumbent is <none>"). The DEEPER half is Cormac's, with his
measurements: `host_floor_of` counts a 4B whose weights fit but whose served window
is a dead 2,048 as ABOVE a serviceable 1.5B, so the floor must count only models
with a VIABLE served window, not weight-fit alone. And #4174 completes the #4169
pair separately (BigMama's stack) so the plan isn't below floor on that tier at all.

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

* fix(serving): a cold boot below the floor is held for a bounded grace, then served — both specs hold

The red test was a real spec: a_transient_six_gigabytes_on_a_big_card_refuses_to_
sink_below_the_floor — a 53 GB card, NO incumbent, one 6 GB reading (the teardown
transient the floor was written for; it latched a 0.5B for 80 min once). Under
"no incumbent → serve" that boot publishes a 4B on a 53 GB card. The Intel tier's
case is the opposite end: below the floor CONTINUOUSLY for 40+ minutes, dark for 90.
The two disagree only on TIME, and are orders of magnitude apart.

below_floor_refuses(verdict, has_incumbent, below_for): with an incumbent refuse,
unchanged; with none, refuse while the shortfall is younger than
COLD_BOOT_BELOW_FLOOR_GRACE (180 s — anything from ~30 s to ~5 min satisfies both
incidents, Cormac's sizing), then serve rather than stay dark. The probe
cold_boot_below_floor_served carries waited_s so a small model on a big card reads
as a decision with its wait, not a bug.

serving_daemon::tests 69/69.

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

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Sep 17, 2026
…lane budgets, credits and attributes on the Ram row

#4169 made the PHYSICAL bound follow the lane placement; the PLAN did not follow.
host_budget() still read the board's Vram row × drive mode, and every serving site
keyed by a resource kind — the governed ceiling, budget_for_replacing, the
credited-once check, the consumer's own footprint and reclaim — said Vram. On a
`--n-gpu-layers 0` host (Intel Mac, card 7c72c0f0, 2026-09-17) that sized nine
citizens against a 5.7 GB Vram row on a box with 34.4 GB of RAM and 0 MB of VRAM
in use: one warm slot, eight exiled to a remote lane that timed out at 600 s.

ONE decision: `serving_pool_kind()` = f(main_lane_placement()) — Cpu → Ram, Gpu →
Vram — and every one of those sites reads through it. The consumer is handed the
kind at construction so it reports and yields on the SAME row the plan budgets
from (or the replace-myself credit lands on a row nobody reads and the plan flees
its own residency). The footprint sampler takes the process read for a CPU-placed
lane on every host class — the device delta reads zero for a lane holding nothing
on the device. The VRAM cold-boot prior stays a VRAM fact; the Ram row's ceiling
is read once at construction and is never cold. The GPU arm is byte-identical.

Test: a_cpu_placed_lane_budgets_against_the_ram_row_not_the_card — a 4 GB Vram row
beside a 30 GB Ram row; the CPU placement plans against 30 GB, the GPU placement
against 4 GB.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
joelteply added a commit that referenced this pull request Sep 18, 2026
…lane budgets, credits and attributes on the Ram row (#4184)

#4169 made the PHYSICAL bound follow the lane placement; the PLAN did not follow.
host_budget() still read the board's Vram row × drive mode, and every serving site
keyed by a resource kind — the governed ceiling, budget_for_replacing, the
credited-once check, the consumer's own footprint and reclaim — said Vram. On a
`--n-gpu-layers 0` host (Intel Mac, card 7c72c0f0, 2026-09-17) that sized nine
citizens against a 5.7 GB Vram row on a box with 34.4 GB of RAM and 0 MB of VRAM
in use: one warm slot, eight exiled to a remote lane that timed out at 600 s.

ONE decision: `serving_pool_kind()` = f(main_lane_placement()) — Cpu → Ram, Gpu →
Vram — and every one of those sites reads through it. The consumer is handed the
kind at construction so it reports and yields on the SAME row the plan budgets
from (or the replace-myself credit lands on a row nobody reads and the plan flees
its own residency). The footprint sampler takes the process read for a CPU-placed
lane on every host class — the device delta reads zero for a lane holding nothing
on the device. The VRAM cold-boot prior stays a VRAM fact; the Ram row's ceiling
is read once at construction and is never cold. The GPU arm is byte-identical.

Test: a_cpu_placed_lane_budgets_against_the_ram_row_not_the_card — a 4 GB Vram row
beside a 30 GB Ram row; the CPU placement plans against 30 GB, the GPU placement
against 4 GB.


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

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