Skip to content

fix(serving,deploy): a deploy converges the ENGINE too — the warm build installs the pinned llama-server on macOS/Linux, and a lane on an older engine than the installed one is relaunched (card 7c5f139d) - #4464

Merged
joelteply merged 4 commits into
canaryfrom
fix/mac-engine-converges-on-deploy
Sep 27, 2026

Conversation

@joelteply

@joelteply joelteply commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

The M5 and the IntelMac served llama-server b10765-965d38a90 (no /train) a day after the pin
reached 9733aca6c, so the M5 could not dream whatever S3-S5 landed. Two holes:

  1. Build: a deploy's warm build runs start-server.sh with BUILD_ONLY=1, and the engine install
    sits in the runtime-only branch, so a Mac deploy never built the engine. continuum install
    has an engine arm only on Windows (Converge Windows engine receipts through continuum install #4382).
  2. Adopt: every deploy leaves the lane up for the next core, and adoption asked only window,
    lanes, sight and KV. An adopted lane kept running the binary it was launched from.

Now:

  • start-server.sh, BUILD_ONLY on Darwin/Linux (not under an LLAMA_SERVER_BIN override): run
    install-llama-server.sh in the warm pass. It is stamp-gated (instant when commit:backend
    match) and installs atomically (rm, temp, codesign, mv), so a running lane keeps its old
    inode; the engine is static on macOS (otool: libSystem, Accelerate, libc++). It inherits
    nice 19 (fix(deploy): a warm build yields the CPU to the serving core it runs beside #4449). A failed build warns and never fails the core deploy; the stamp is written
    only after a verified build, so the lane keeps the engine it has.
  • llama_server: a fourth adopt-or-relaunch operand, asked of the lane like the other three.
    /props build_info (the IntelMac lane: "b10765-965d38a90") against the installed stamp
    (.llama-server.stamp beside the resolved server_bin: "965d38a90:cpu"). If they disagree,
    the lane is relaunched onto the installed binary, at the same size; the trade guard and the
    memory gate do not apply, since it is not a resize. Unknown on either side (a probe error, no
    field, an operator override, no stamp) is "engine OK": never a spurious relaunch.
  • Probe: serving.engine.converged {from, to}.
  • Windows: the core launches with LLAMA_SERVER_BIN at the registered engine slot, and the stamp
    lives in that slot, so the same comparison converges a lane onto a newly registered engine
    after an install. No platform code.

Test (llama_server, existing mod): an older engine is stale; the same commit short or full is
current; no build or no stamp never relaunches.

Not compiled on the IntelMac: its deploy build holds the machine. CI is the compile.

Follow-up commit (BigMama on the design): the comparison uses deploy_provenance::sha_matches (credible hex, prefix either way), and the hour's health line carries engine_stale (from->to, empty once converged). The Windows slot already carries the same stamp (win-modules.ps1:646), so the comparison holds there without platform code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…ld installs the pinned llama-server on macOS/Linux, and a lane on an older engine than the installed one is relaunched (card 7c5f139d)

The M5 and the IntelMac served llama-server b10765-965d38a90 (no /train) a day after the pin
reached 9733aca6c, so the M5 could not dream whatever S3-S5 landed. Two holes:
1. Build: a deploy's warm build runs start-server.sh with BUILD_ONLY=1, and the engine install
   sits in the runtime-only branch, so a Mac deploy never built the engine. `continuum install`
   has an engine arm only on Windows (#4382).
2. Adopt: every deploy leaves the lane up for the next core, and adoption asked only window,
   lanes, sight and KV. An adopted lane kept running the binary it was launched from.

Now:
- start-server.sh, BUILD_ONLY on Darwin/Linux (not under an LLAMA_SERVER_BIN override): run
  install-llama-server.sh in the warm pass. It is stamp-gated (instant when commit:backend
  match) and installs atomically (rm, temp, codesign, mv), so a running lane keeps its old
  inode; the engine is static on macOS (otool: libSystem, Accelerate, libc++). It inherits
  nice 19 (#4449). A failed build warns and never fails the core deploy; the stamp is written
  only after a verified build, so the lane keeps the engine it has.
- llama_server: a fourth adopt-or-relaunch operand, asked of the lane like the other three.
  `/props` build_info (the IntelMac lane: "b10765-965d38a90") against the installed stamp
  (`.llama-server.stamp` beside the resolved server_bin: "965d38a90:cpu"). If they disagree,
  the lane is relaunched onto the installed binary, at the same size; the trade guard and the
  memory gate do not apply, since it is not a resize. Unknown on either side (a probe error, no
  field, an operator override, no stamp) is "engine OK": never a spurious relaunch.
- Probe: serving.engine.converged {from, to}.
- Windows: the core launches with LLAMA_SERVER_BIN at the registered engine slot, and the stamp
  lives in that slot, so the same comparison converges a lane onto a newly registered engine
  after an install. No platform code.

Test (llama_server, existing mod): an older engine is stale; the same commit short or full is
current; no build or no stamp never relaunches.

Not compiled on the IntelMac: its deploy build holds the machine. CI is the compile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

Fable at a42927f: the build half and the operand are right (stamp-gated atomic install; unknown on either side is never a relaunch). One change before a word:

Nothing bounds the relaunch when the relaunched lane still disagrees with the stamp. The stamp is the submodule HEAD; build_info is whatever the build-info generator baked into the binary. If those ever differ for the SAME binary (an incremental build that did not regenerate build-info, a submodule checked out through a gitdir file that the generator's dependency misses, a local merge commit), every reconcile tick relaunches the lane onto the same binary, forever: a lane that goes dark on a loop, which is worse than a stale engine. Please remember the from->to you relaunched for, and if the relaunched lane reports the same from again, stop and probe it ("the installed binary reports X, the stamp says Y") instead of relaunching; the health line can carry that too. A test: two consecutive reconciles with the lane still on the old build relaunch once.

Non-blocking: this relaunch tears any turn in flight. Once per engine change is acceptable, but if the grow path can wait for idle slots, this one should too.

@joelteply

Copy link
Copy Markdown
Contributor Author

@cormac #4464 at a42927f: APPROVED. The stamp sits beside server_bin and is compared with sha_matches; every unknown reads as "engine OK"; the relaunch happens at the same size, so trade and pressure are rightly skipped. On BigMama engine-a is stamped 9733aca6c:cuda and Kimi's adopted lane runs 965d38a90, so this is exactly the case it fixes. Non-blocking: nothing bounds a relaunch whose new lane still reports another build (e.g. build_info from a dirty or other checkout than the stamp). Worth one probe plus a no-repeat for the same from->to pair.

joelteply and others added 2 commits September 27, 2026 11:05
…e that still reports the old build after it is reported, never relaunched again (Fable on #4464)

A relaunched lane whose build_info was not regenerated (a local merge, a gitdir-file submodule)
would otherwise relaunch onto the same binary every tick: a dark lane on a loop. The second
sighting of the same pair probes serving.engine.converge_failed and leaves engine_stale on the
health line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ce, and its failure never fails the deploy (card 7c5f139d)

start-server-build-only.test.sh forbade install-llama-server.sh in every warm
build, the invariant this PR deliberately changes. The stub now records the
call: exactly one on a successful macOS/Linux warm build, none on Windows
(#4382) and none after a failed core build (which exits first). One more case:
a failing engine build still completes the warm build with the warning and a
receipt. Mutation: dropping Linux from the case arm fails the test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

Fable: APPROVED at 9da64f4. The warm pass builds the engine on macOS/Linux, stamp-gated and atomic, never on Windows or after a failed core build, and a failed engine build never fails the deploy (test pins all three). The fourth operand relaunches a lane on an older engine once per from->to and then only reports it (serving.engine.converge_failed, engine_stale on the health line). All 9 checks green.

@joelteply
joelteply merged commit db3d4d6 into canary Sep 27, 2026
9 checks passed
@joelteply
joelteply deleted the fix/mac-engine-converges-on-deploy branch September 27, 2026 16:35
joelteply added a commit that referenced this pull request Sep 27, 2026
… on macOS, the background band (card 682a5abf) (#4471)

yield_to_serving set nice 19 and nothing else. Nice reorders the run queue but
frees no core, and cargo ran its default jobs (one per logical CPU) on the cores
a CPU-served lane decodes on: llama.cpp's default threads are one per physical
core, and the core passes no --threads. The IntelMac (6 cores, 12 threads) went
three hours at 0 acts with 7 of 11 generations dropped while it built (Fable's
health reads, 2026-09-27), and the build's contention is what condemned its
lane three times today.

- warm_build_jobs(backend), pure: Some(1) when the installed engine's stamp says
  cpu, None otherwise (metal, cuda, unknown: no cap). installed_engine_backend()
  reads the same stamp as installed_engine_commit().
- yield_to_serving sets CARGO_BUILD_JOBS from it. install-llama-server.sh (which
  the warm build runs since #4464) reads the same budget instead of nproc.
- On macOS the child also enters the background band
  (setpriority PRIO_DARWIN_PROCESS, PRIO_DARWIN_BG), which throttles CPU and I/O
  below nice. Measured here: a child keeps nice 19 at priority 3, and so do its
  children.

The deploy gets slower on a CPU-only node. That is the trade against hours of
citizens with no lane.


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

Co-authored-by: Claude Opus 5.5 <[email protected]>
joelteply added a commit that referenced this pull request Sep 28, 2026
… every OS (card 2c5d0ec0) (#4491)

* feat(serving): engine slots with a recorded current, one resolver for every OS (card 2c5d0ec0, core half)

An engine update overwrote the one installed binary in place: POSIX-only by
accident, impossible on Windows (a running exe is locked), so #4464 skipped
the engine there, and the Windows service-host injected its slot as
LLAMA_SERVER_BIN, which the core reads as an operator's pin and never
converges. Windows with CUDA may be someone's first and only machine.

- inference/engine_slots: the Windows layout for every OS
  (<continuum_home>/bin/engine-{a,b,c}) plus `current` and `previous`
  pointers, each replaced atomically. idle_slot reads the lane records,
  never the process table, and fails closed on a lane recorded before
  lanes named their engine. promote needs the binary and the exact stamp;
  rollback is compare-and-swap on the failed slot (Codex) onto an intact
  previous (Fable).
- server_bin: an override is always the operator's (provenance, not path:
  Codex), then the current slot (a missing binary fails loud at spawn),
  then the pre-slot install. Resolved PER LAUNCH: the process no longer
  caches the path, so a relaunch after a promote takes the new slot.
- LaneRecord.engine_bin: the exe each lane launched from.
- service-host: registers its release's slot as current (the Windows
  promotion) instead of injecting LLAMA_SERVER_BIN.
- `continuum engine idle-slot | promote | rollback`: one implementation for
  the bash and PowerShell installers (exit 3: none idle, skip the build).

Behaviour is unchanged until an installer calls promote: Macs resolve the
pre-slot install as today, Windows resolves the registered slot as today.

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

* feat(serving): a launch that fails on a promoted engine rolls back to the previous one (card 2c5d0ec0)

Fable on #4491: rollback was only a verb, so a promoted CUDA engine that
passed its stamp and then failed at launch left a first-and-only machine
dark until a human ran it. A spawn or readiness failure from the current
slot now restores the previous engine (never under an operator override,
never while a deploy holds the claim), probes serving.engine.rolled_back
with both slots, and relaunches once; the engine is resolved per launch,
so the relaunch takes the restored slot. Once only: the restored engine
failing too is not rolled back onto the failed one, which would swap two
bad engines forever.

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

* fix(serving): only an engine that never came up ready is rolled back (card 2c5d0ec0)

Fable on #4491: NotReady also comes from memory (the M5's swap and
headroom refusals), a model load or a wedge. Rolling back on any of
those demoted a good new engine and silently ran the node on the older
one, without pause or top_layers, until the next deploy.

A slot now carries a `.verified` marker, written at the first launch
from it that comes up ready (the exact program the launch ran, not a
fresh resolution), and cleared whenever the slot is promoted or
registered anew. Automatic rollback applies only while current has no
marker: a proven engine that later fails takes the ordinary
launch-failure path.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
joelteply added a commit that referenced this pull request Sep 28, 2026
…ever over a live lane (card 7a6a033a) (#4495)

The installer half of #4491 for macOS and Linux. install-llama-server.sh
asks the core for the idle slot (`continuum engine idle-slot`), builds or
installs there, verifies and stamps as before, and only then promotes it
(`continuum engine promote <slot> <commit:backend>`). The core resolves
current at every launch and #4464's convergence relaunches lanes onto it.

- Current slot already at the pin: a no-op, as the stamp check was.
- A slot holding the pin whose promote failed: promoted, not rebuilt.
- Migration: a pre-slot engine already verified at the pin is copied into
  the slot and promoted, with no rebuild (hours on a CPU-served node).
- Exit 3 (no slot idle) skips the engine build this deploy and says so;
  any other idle-slot failure is fatal, never a guessed slot.
- Version skew: a deployed CLI without the verbs installs the pre-slot
  way once, says so, and the next deploy uses the slots.
- start-server takes the engine path from the installer's stdout, and the
  installer's placement lines now go to stderr (they polluted stdout).

Windows keeps its PowerShell slot arm; its move onto these verbs is the
other half.

Test: tools/scripts/tests/install-llama-server-slots.test.sh, 5 cases,
run in CI beside the warm-build test; mutation-checked (dropping the
promote and breaking exit 3 each fail it).


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

Co-authored-by: Claude Opus 5.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