Skip to content

fix(serving): the backend receipt honours a CPU placement — a GPU-less server on a CPU-plan host is by plan, never a mis-install - #3740

Merged
joelteply merged 2 commits into
canaryfrom
fix/backend-receipt-honours-cpu-placement
Sep 5, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fix/backend-receipt-honours-cpu-placement

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The first #3730 refused IntelMac's Intel-GPU Mac, whose server is deliberately built with Metal OFF (#3729): the receipt had no host fact and treated every answered-no-GPU as a mis-install. Joel's ruling in persona/response.rs (CPU-only adapters serve their own personas) settles the direction.

  • main_lane_placement() reads CONTINUUM_SERVING_PLACEMENT=cpu from config.env (the installer's layer; fix(install): turn Metal OFF explicitly on Intel Macs — omission inherits it #3729's Intel arm should write it beside the Metal-OFF build) → LanePlacement::Cpu; default GPU.
  • backend_verdict(bin, receipt, cpu_by_plan) returns CpuByPlan (backend=cpu, no refusal) for a CPU lane; GPU lanes keep refusing a GPU-less server (BigMama's case).

Tests: inference::backend_receipt 5/5, inference::llama_server 40/40 (whole mods).

Installer half (IntelMac): write the key in #3729's Intel arm. Until both land, IntelMac can put the key in config.env by hand as the one-line override.

Review requested; no auto-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…s server on a host whose plan says CPU is by plan, never a mis-install

IntelMac's Intel-GPU Mac serves with Metal OFF on purpose (#3729); the first #3730 refused
its lane because the receipt carried no host fact at all (BigMama's read) and treated every
answered-no-GPU server as a mis-install. Joel's ruling already in tree (persona/response.rs:
CPU-only adapters serve their own personas) settles the direction.

Now placement decides: main lanes read CONTINUUM_SERVING_PLACEMENT=cpu from config.env — the
layer the installer writes, so #3729's Intel arm records the decision beside the Metal-OFF
build — into LanePlacement::Cpu; the receipt gets the lane's placement and returns CpuByPlan
(backend=cpu, no refusal) for a CPU lane, while a GPU lane keeps refusing a server that loads
no GPU backend (BigMama's case). Tests: a CPU placement accepts the GPU-less transcript; the
config key parses one way and defaults to the GPU.

// what this catches: the receipt refusing the tier it was meant to protect.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ided — CONTINUUM_SERVING_PLACEMENT=cpu|gpu into config.env, replace-or-append

BigMama's review of #3740: the Rust was right and the wire did not exist — the key the core
reads had to be written by a human, and the reviewer best placed to notice (IntelMac) had
written it by hand an hour earlier. Now install-llama-server.sh records the decision next to
the build that implements it: BACKEND=cpu (an Intel Mac with Metal OFF, #3729; any host
without Metal or CUDA) → cpu; otherwise gpu. config_env_upsert is idempotent (dry-run: three
calls leave one key line and the other keys intact). The lib's _cold_export still overwrites
config.env wholesale — card 1aa897b0.

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

Copy link
Copy Markdown
Contributor Author

Change taken (BigMama's request): the wire now exists. install-llama-server.sh records the placement it decided — CONTINUUM_SERVING_PLACEMENT=cpu when BACKEND=cpu (the Intel-Mac Metal-OFF arm and any host without Metal/CUDA), gpu otherwise — via an idempotent replace-or-append into config.env (dry run: three calls, one key line, other keys intact). A fresh install on the Intel tier gets CpuByPlan with no human edit. Found on the way: the lib's _cold_export overwrites config.env with > and would erase this key — card 1aa897b0. Re-review requested.

@joelteply
joelteply merged commit 1be888f into canary Sep 5, 2026
7 checks passed
@joelteply
joelteply deleted the fix/backend-receipt-honours-cpu-placement branch September 5, 2026 07:43
joelteply added a commit that referenced this pull request Sep 5, 2026
…he one (#3748)

* ci(install): assert host detection on all three platforms, not just the one

`carl-install-smoke` is our only install check and it is `runs-on:
ubuntu-latest` with no matrix. So the install path is verified on exactly one
platform — and in one night every detect_host bug found on the other two was
invisible to it:

  - Windows 11 24H2 REMOVED `wmic`, so the RAM arm fell through to its else
    branch and recorded IC_RAM_MIB=0 on a machine with 64914 MiB. Every
    downstream tier decision then ran on that zero, silently (#3739).
  - The Intel-Mac arm builds llama-server CPU-only because a Metal build hangs
    that hardware uninterruptibly — and nothing recorded that as the host's
    serving PLAN, so the backend receipt refused a healthy node and advised
    reinstalling with Metal, which would have hung it again (#3729 → #3740).
  - The Linux/WSL RAM arm still turns an unreadable /proc/meminfo into 0 with no
    warning: the same defect as the Windows one, on the platform CI DOES run,
    unnoticed because nothing asserted the value.

Each was a detect_host fact being WRONG rather than missing, on a platform its
author could not run. Three operators, three boxes, and the shared CI checking
the tier none of them installs on.

NOT A MATRIX ON carl-install-smoke: that job is Docker-based and ~30 minutes.
`install-common.sh` is sourceable and `ic_detect_hardware` is a pure probe of
the machine it runs on, so a per-platform leg needs no Docker, no images and no
registry auth — seconds, not half an hour. The Docker smoke stays the Linux
end-to-end check; this is the cross-platform truth check.

Assertions are about SHAPE, not hardware. A CI runner is none of our boxes and
a test expecting an M5 or a 5090 fails for the wrong reason. What must hold
everywhere is that the detector produced a DETERMINATE answer rather than a
silent placeholder: platform recognised, RAM a positive integer, arch known,
gpu_kind one of the declared values INCLUDING `none` — because "no GPU" and "we
did not look" are different facts, and conflating them is what made the backend
receipt refuse a working CPU-by-plan host.

The Windows leg runs under Git Bash, which is the shell install.sh actually
uses there (uname -s reports MINGW64_NT-...), so it exercises the real branch
rather than a WSL or PowerShell approximation. `fail-fast: false` because the
point is to learn what ALL three report — failing fast would hide the second
bug behind the first, which is how these stayed hidden.

The job also runs a MUTATION step: force the RAM arm to the silent-zero shape
that shipped on 24H2, assert the leg goes red, restore. Verified by hand on
this Intel Mac before commit — mutated exit 1 with "IC_RAM_MIB=0 — a host with
no readable RAM figure will be mis-tiered, silently", restored exit 0. Written
after finding twice in one night that a green check can mean the checker never
ran (a crashed linter counted as zero errors; a pipe returned tail's exit
status instead of cargo's).

Both triggers carry the same paths filter, per the comment on
ts-persona-forbidden-strings-ratchet.yml where a missing filter on `push`
produced 100/100 red and taught everyone to ignore the X.

Card b2e4a0bb.

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

* fix(ci): the mutation must patch EVERY platform's RAM arm, not two of three

The Windows leg failed on its own mutation step, and the failure was correct.

My first cut patched the two expression shapes I could see from a Mac —
macOS's `IC_RAM_MIB=$(( $(sysctl …) ))` and Linux's `IC_RAM_MIB=$(awk …)`.
Windows's arm is a `case` over a captured variable since #3739, so neither
pattern matched, nothing was mutated, the assertions passed unchanged, and the
step reported exactly what had happened:

    host-detect-assert did NOT fail with RAM forced to 0 — the gate is dead.

That is the mutation step catching a hole in the mutation step. It is also the
same defect the whole PR is about, committed by me while writing the PR: I
wrote a check against the platforms I could see and shipped it to three.

Now patches by LINE rather than by expression — every `IC_RAM_MIB=` assignment
becomes 0 regardless of the shape the platform's arm happens to use — and
prints the count of mutated lines so a future no-op is visible in the log
instead of inferred from a passing gate. Verified locally: 4 lines mutated,
assert exits 1, restore exits 0.

WHAT THE WINDOWS LEG ALREADY PROVED, and it is the point of the matrix: its
ASSERTIONS all passed. `IC_PLATFORM=windows` on MINGW64_NT-10.0-26100, RAM a
positive integer, gpu_kind `none`. So #3739's Get-CimInstance fallback works on
a real 24H2-era runner — measured on a platform none of us can run, by the leg
that exists for that reason, on its first execution.

Card b2e4a0bb.

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

* fix(ci): inject the mutation at one point, not per-platform regexes

Second failure of the same kind, and the lesson is the PR's own thesis pointed
at me twice.

The mutation step must prove this gate can fail. My first cut patched the two
RAM-assignment shapes I could see from a Mac; Windows uses a `case` over a
captured variable since #3739, so nothing was mutated and the step reported the
gate dead. I fixed that with a line-wise regex — which patched four lines and
STILL left Windows reporting 16378 MiB, because replacing a whole line inside a
`case` arm does not do what replacing an assignment does.

Twice I wrote a platform-shaped mutation from the one platform I have, and both
times the thing that caught it was the mutation step refusing to pass. That is
the same defect this PR exists to prevent — a check written against the
platforms its author can see — committed inside the check itself.

So the defect is now injected where every platform CONVERGES: a
`HOST_DETECT_MUTATE_RAM` hook in the assert script, applied after
`ic_detect_hardware` returns and before the assertions run. Shape-independent,
cannot silently miss an arm, and it lives in CI scaffolding rather than in a
sed over production source — install-common.sh is no longer touched by the
test at all.

Verified locally, both directions:
    MUTATION: forcing IC_RAM_MIB=0 (was 32768)
    FAIL ram — IC_RAM_MIB=0 — a host with no readable RAM figure will be
               mis-tiered, silently
    mutated exit=1   clean exit=0

Card b2e4a0bb.

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

* ci(install): the leg reports WHICH arm produced the RAM figure

ce8b9074's gap on #3748, and it lands on a claim I had already made without
checking.

I said the green Windows leg "confirms #3739's Get-CimInstance fallback works
on a real 24H2-era runner". That is only true IF `wmic` was absent. `wmic` was
removed in Windows 11 24H2, but a runner that still has it takes the LEGACY arm
— the leg would pass, prove the old path, and say nothing about the fix. A
passing RAM check reports the answer, never how it was obtained, and I filled
in the how from what I wanted it to mean.

The leg now prints the precondition, so the log answers the question instead of
the reader assuming:

    wmic PRESENT — the RAM figure came from the legacy wmic arm; this run does
                   NOT exercise the Get-CimInstance fallback (#3739)
    wmic ABSENT (removed in Win11 24H2) — the RAM figure came from the
                   Get-CimInstance fallback (#3739)

with the equivalent one-liner for the macOS sysctl and Linux /proc/meminfo arms,
so every platform's log says which code actually ran.

ON THE SECOND GAP (unconditional restore): already closed by the previous
commit rather than by this one. The mutation moved from patching
install-common.sh to a HOST_DETECT_MUTATE_RAM hook in the assert script, so the
workflow no longer copies, edits or restores production source at all — there
is nothing left to restore conditionally or otherwise. Verified: no `cp` of a
backup remains in the workflow.

Card b2e4a0bb.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[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