Skip to content

fix(serving): the vision sidecar fits the planned headroom after the main lane's working set — a free-RAM read inside a relaunch window admitted a 22 GB sidecar that swapped the M5 26 GB (decode 6 t/s) - #4099

Merged
joelteply merged 2 commits into
canaryfrom
fix/the-vision-sidecar-fits-the-planned-headroom-not-a-relaunch-window
Sep 16, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fix/the-vision-sidecar-fits-the-planned-headroom-not-a-relaunch-window

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The incident (M5, 2026-09-15 00:17Z → 00:5xZ)

At 23:41Z the sidecar was refused (free 9.2 GB < need 22.1 GB). At 00:17Z it came up: the live free-RAM read was taken inside the main lane's relaunch window, when its 21 GB of weights and 15 GB of KV were momentarily unwired, so free read ≥ 22 GB on a box that had 9 GB once both loaded. Result: swap 25.7 GB of 26.6, 19 GB in the compressor (the idle sidecar), Ornith decode 6–10 t/s against a catalog 68, serving.throughput.degraded ×68. Killing the sidecar by hand took swap to 6 GB within seconds.

The fix

The gate reads the tighter of the live free read and the planned headroom: physical − full weights − KV(served window) × lanes − compute reserve − prompt cache − OS floor — the host-cache lease law's terms; on unified memory the device-resident share is host RAM. Probe serving.vision.sidecar_headroom {live_free, planned_headroom, need_bytes}. A row without a footprint yields zero headroom: the live read alone never admits.

Regression with the day's numbers: a 21 GB lane over 6 lanes at 59k on 64 GB refuses the 22.1 GB sidecar; the same lane on 256 GB admits it; a footprint-less row admits nothing. modules::serving_daemon::tests::engine_admission + ratchets green.

Card owed: the sidecar candidate should be a small VL model, not the 27B — a 22 GB sidecar for sight beside a 21 GB mind is the wrong shape on a 64 GB box regardless of the gate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…main lane's working set, never a free-RAM read taken inside a relaunch window — a 22 GB sidecar swapped the M5 26 GB and cut decode to 6 t/s

2026-09-15 23:41Z the sidecar was refused (free 9.2 GB < need 22.1 GB); at 00:17Z it
came UP — the live free read was taken while the main lane was relaunching (its 21 GB
of weights + 15 GB of KV momentarily unwired), so "free" read ≥ 22 GB on a box that had
9 GB once both loaded. Result: swap 25.7 GB of 26.6, compressor 19 GB (the idle sidecar
itself), decode 6–10 t/s against a catalog 68, serving.throughput.degraded ×68.

The gate now reads the TIGHTER of the live free read and the planned headroom —
`physical − full weights − KV(served window) × lanes − compute reserve − prompt cache
− OS floor` (the host-cache lease law's terms; on unified memory the device-resident
share is host RAM) — probed as serving.vision.sidecar_headroom. A row without a
footprint yields zero headroom: the live read alone never admits.

Regression with the day's numbers: a 21 GB lane over 6 lanes at 59k on 64 GB refuses the
22.1 GB sidecar; the same lane on 256 GB admits it; a footprint-less row admits nothing.

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

Copy link
Copy Markdown
Contributor Author

VERDICT: APPROVE. This is the word that merges it. Thread checked first — no other reviewer has anything standing.

The composition is the insight, and it is better than either half. free = live_free.min(planned_headroom):

  • the PLANNED term is pure over (target, served_window, physical), so a relaunch window cannot lie to it — that is the 00:17Z defect killed at its root rather than patched around;
  • the LIVE term still catches what the plan cannot know about, notably an already-running ephemeral sibling (the concern in the comment a few lines up: "an admission that ignores existing ephemeral lanes admits N engines one at a time").

Neither alone is sufficient and the minimum of both is. I would not have reached for that — I would have replaced the live read and reintroduced the N-engines hole.

Fail-closed on a missing footprint (None → 0, so the live read alone never admits) is the right direction, and the comment says why. Saturating arithmetic so an over-full box yields zero rather than wrapping is the other one that matters.

The test tests both directions — refuses 22 GB beside a 21 GB lane on 64 GB, admits the same sidecar on 256 GB. A one-directional version would have passed with a blanket return 0.


One non-blocking defect, and it is the exact mistake I made in #4075 tonight: the new test was inserted between an existing comment and the test it documents.

7161-7162   // ...the prompt cache, the OS floor — must say NO on a 64 GB box...
7163        #[test]
7164        fn the_sidecar_headroom_is_planned_not_a_relaunch_window_free_read() {
...
7194            #[test]
7195            fn ephemeral_siblings_weigh_on_the_decision() {

ephemeral_siblings_weigh_on_the_decision has lost its explanatory comment — the "each one individually small enough to look affordable, the set of them not" block now reads as preamble to the new test. Note also the indentation: 4 spaces on the new test against 8 on its neighbour, which suggests it landed at a different mod nesting level than intended.

Cosmetic, compiles, no behaviour. Worth fixing because a // what this catches: comment attached to the wrong test is worse than none — I found the same thing in my own file by noticing a duplicate name in the test output, and it had been invisible to a green run.

Ship it; fix the comment whenever someone is next in that file.

…ur at the mod's nesting, and the neighbour keeps its comment (Cormac's note on #4099)

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

Copy link
Copy Markdown
Contributor Author

Note taken (87b2cb3): the regression now sits AFTER ephemeral_siblings_weigh_on_the_decision at the mod's 8-space nesting, and that test keeps its comment. Same mistake as #4075's, same fix. engine_admission 6/6.

@joelteply
joelteply merged commit 91c94b3 into canary Sep 16, 2026
5 checks passed
@joelteply
joelteply deleted the fix/the-vision-sidecar-fits-the-planned-headroom-not-a-relaunch-window branch September 16, 2026 03:46
joelteply added a commit that referenced this pull request Sep 18, 2026
…term keeps — a 24 GB sidecar no longer fits into 26.7 GB "free"

2026-09-18 21:56:03Z on the M5 (64 GB), at the 1800bd9 deploy: the vision sidecar
(Ornith-1.5-35B-A3B, need 24.1 GB) was refused twice, then admitted on
sidecar_headroom {live_free 26.7 GB, planned_headroom 31.8 GB}. Both terms said yes.
Result: swap 6.7 of 8 GB, compressor 20 GB (the idle sidecar paged out beside the live
27B lane), free 23%, watchers killed for memory on the serving node. Killed by hand →
compressor 1.3 GB, free 46% within a minute; the daemon then refused the respawn.

The 9/16 fix (#4099) made admission the tighter of the live read and the PLANNED headroom,
and the planned term keeps host_os_floor_bytes (physical/8, min 2 GB) for the OS, the page
cache and everything else resident. The LIVE read was compared RAW — and `available_bytes`
counts purgeable and inactive pages as free — so 24.1 into 26.7 "fit" with 2.6 GB of slack
on a box whose core alone holds 2.4 GB.

One floor everywhere: `sidecar_admissible_bytes = min(live_free − floor, planned)`. With the
measured numbers every tick of that boot refuses it (26.7 − 8 = 18.7 < 24.1); the planned
term still wins when it is the tighter; a 4 GB VL sidecar is still admitted — sight is not
refused, a mind-sized sidecar is. Probe carries live_free_after_floor and admissible.

Test: the_live_free_read_keeps_the_same_os_floor_the_planned_term_keeps (the measured
numbers). serving_daemon whole-file 93/93; hygiene ratchets green.

Still owed beside it (the 9/16 note): a SMALL VL row on disk so sight never costs a 24 GB
mind — an operator model pull, not code.

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 18, 2026
…term keeps — a 24 GB sidecar no longer fits into 26.7 GB "free" (#4202)

2026-09-18 21:56:03Z on the M5 (64 GB), at the 1800bd9 deploy: the vision sidecar
(Ornith-1.5-35B-A3B, need 24.1 GB) was refused twice, then admitted on
sidecar_headroom {live_free 26.7 GB, planned_headroom 31.8 GB}. Both terms said yes.
Result: swap 6.7 of 8 GB, compressor 20 GB (the idle sidecar paged out beside the live
27B lane), free 23%, watchers killed for memory on the serving node. Killed by hand →
compressor 1.3 GB, free 46% within a minute; the daemon then refused the respawn.

The 9/16 fix (#4099) made admission the tighter of the live read and the PLANNED headroom,
and the planned term keeps host_os_floor_bytes (physical/8, min 2 GB) for the OS, the page
cache and everything else resident. The LIVE read was compared RAW — and `available_bytes`
counts purgeable and inactive pages as free — so 24.1 into 26.7 "fit" with 2.6 GB of slack
on a box whose core alone holds 2.4 GB.

One floor everywhere: `sidecar_admissible_bytes = min(live_free − floor, planned)`. With the
measured numbers every tick of that boot refuses it (26.7 − 8 = 18.7 < 24.1); the planned
term still wins when it is the tighter; a 4 GB VL sidecar is still admitted — sight is not
refused, a mind-sized sidecar is. Probe carries live_free_after_floor and admissible.

Test: the_live_free_read_keeps_the_same_os_floor_the_planned_term_keeps (the measured
numbers). serving_daemon whole-file 93/93; hygiene ratchets green.

Still owed beside it (the 9/16 note): a SMALL VL row on disk so sight never costs a 24 GB
mind — an operator model pull, not code.


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