Skip to content

feat(serving): engine slots with a recorded current, one resolver for every OS (card 2c5d0ec0) - #4491

Merged
joelteply merged 3 commits into
canaryfrom
feat/engine-ab-slots
Sep 28, 2026
Merged

joelteply merged 3 commits into
canaryfrom
feat/engine-ab-slots

Conversation

@joelteply

@joelteply joelteply commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Card 2c5d0ec0, core half. The interface was agreed in cambriantech with Fable's three holes and Codex's four inputs, all taken.

What lands

  • inference/engine_slots.rs adopts the Windows layout (Converge Windows engine receipts through continuum install #4382, <continuum_home>/bin/engine-{a,b,c}) for every OS, and adds current and previous pointers, each written atomically with tmp+rename.
  • idle_slot excludes three slots: the one current names, any slot a live lane's recorded engine_bin names, and, while another slot is free, the one previous names (the rollback).
    • A live lane recorded before lanes named their engine makes every populated slot unavailable, so on the 5090 today only the empty slot is idle. It fails closed and never builds over a slot that lane might be running.
  • promote requires the slot's binary and its exact <commit>:<backend> stamp. The live-lane check is repeated in the verb.
  • rollback is compare-and-swap on the failed slot (Codex), so a delayed failure cannot undo a newer promotion. It only lands on an intact previous engine (Fable's first-and-only-machine case).
  • server_bin:
    • LLAMA_SERVER_BIN is always the operator's engine, wherever it points. Codex's point: a path alone can't tell an installer's injection from a deliberate pin.
    • Otherwise the current slot; a recorded slot with no binary fails loud at spawn and never falls back.
    • Otherwise the pre-slot install.
  • It is resolved per launch. LlamaServerProcess used to cache the path at construction, so after a promote 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's convergence would have relaunched onto the very binary it was leaving. Restoration of an original launch validates against that launch's own recorded program.
  • LaneRecord.engine_bin is written at spawn.
  • The Windows service-host now calls engine_slots::register for its registered release's slot, which is the Windows promotion and keeps the replaced slot as previous. It no longer injects LLAMA_SERVER_BIN, so Windows converges like every other OS.
  • New CLI verbs: continuum engine idle-slot | promote <slot> <commit:backend> | rollback <failed-slot>.
    • One implementation serves bash and PowerShell.
    • Exit 3 means no slot is idle, and the installer skips the engine build.
    • Callers hold the deploy lock across idle-slot, the build and promote.

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

Follow-ups (not in this PR)

  1. install-llama-server.sh builds into continuum engine idle-slot and then promotes. The version-skew bridge: when the deployed CLI lacks the verb, keep today's path for that one deploy and log it. This is mine.
  2. The PowerShell migration: Select-CoreEngineSlot is retired in favour of continuum engine idle-slot. This is BigMama's.
  3. Automatic rollback on engine.converge_failed after a promote.
  4. A TrackedDir row and an eviction decision for the slots: keep current + previous, and reap a slot no lane names.

Verification: 3 lib tests in engine_slots, each with a what this catches note. I did not compile locally: the IntelMac's shared cargo target is held by its deploy build right now, so the CI lib-test is the compile check.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

… 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
@joelteply joelteply changed the title feat(serving): engine slots with a recorded current, one resolver for every OS (card 2c5d0ec0, core half) feat(serving): engine slots with a recorded current, one resolver for every OS (card 2c5d0ec0) Sep 28, 2026
… 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
…(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
@joelteply
joelteply merged commit b7b28f7 into canary Sep 28, 2026
8 checks passed
@joelteply
joelteply deleted the feat/engine-ab-slots branch September 28, 2026 02:08
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]>
joelteply added a commit that referenced this pull request Sep 28, 2026
…e slot (card 0a3ea433) (#4499)

The Windows half of card 2c5d0ec0 (#4491 core, #4495 macOS/Linux).
Select-CoreEngineSlot picked a slot by reading llama-server processes, and
a lane the supervisor started runs in the service session, where its path
is unreadable from the operator's session: the picker then had to guess
it was the registered engine. It now asks `continuum engine idle-slot`,
which reads the lane records (each names the exe it launched), the one
implementation the bash installer uses too.

- Exit 3 (every slot current or run by a live lane) refuses, as before.
- An answer that is not engine-a/b/c under the install root refuses.
- A readable live engine inside the answered slot refuses (belt and
  braces against a stale record).
- A CLI that predates the verb keeps the process-table choice for that
  one deploy, with a warning; the next deploy asks the core.
- Native stderr under 'Stop' is terminating in Windows PowerShell 5.1,
  so the call reads exit codes under 'Continue'.

Promotion on Windows stays the service registration: #4491's service
host records the registered slot as current (and #4497 degrades a refusal
to the pinned engine).

Not run locally (no PowerShell on this node): windows-service.test.ps1
gains a case with a fake CLI, and CI's installer job runs 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