Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Engine reference — generated from the canonical engineering source. Do not edit this page by hand.

Version & Compatibility Matrix

Which component versions can talk to which — for Sol, Luna, the zerg CLI, Mango, and Limon. Two versioned handshakes exist: the ZMQ wire protocol between Sol and Luna (§ZMQ wire protocol) and, since then, the Erlang-distribution join exchange between Sol control nodes (§Sol ↔ Sol). Everything else is REST/HTTP with additive-extension compatibility.

Component versions

All components ship from one repo and deploy together (wild CD deploys Sol + Mango + Luna images from one tagged build). The version is in each component’s VERSION file:

ComponentVersion fileNotes
Sol (orchestrator)server/VERSIONalso -vsn("X.Y.Z") per module
Luna (worker agent)client/VERSION
zerg CLIzerg-cli/VERSIONthe update channel publishes CLI + luna + sol tarball per tag
Mango (identity/auth)mango/VERSION
Limon (ops console)limon/VERSION

Current tree: 1.003.0 in every VERSION file (root VERSION, server/, client/, zerg-cli/, mango/, limon/). ci/check-version-sync.sh enforces the parity (all five per-service files must equal the root VERSION, plus every -vsn attribute in server/src/, the lockfile pins, and the Current tree: row of THIS file — machine-checked since then; this row sat outside every gate and drifted to 0.650.4 while the tree moved on).

Node roles & cluster topology

Production runs as one Erlang distribution cluster of three Sol nodes (blue + green + red). All nodes consume the same tagged build; wild CD distributes the image digests digest-exact through the release-safe sys.config overlay and probes 3/3 membership in its relaunch-cluster step.

NodeRoleSOL_NODE_LABEL → classLane policy
bluecoordinator (HTTP edge, scheduler) + CPU laneblue → cpu_hostmax_sessions=1; lanes ling_tiny_cpu, api_tier
greenGPU lane hostgreen → gpu_3090_64glanes => all_gpu; qwen38_flashnext ctx override 131072
redGPU lane hostred → gpu_3090_fulllanes => all_gpu

Distribution: longnames (sol@host), the seed union pinned in sys.prod.config (self-filtered at boot; wild’s SOL_CLUSTER_NODES wins where set), cluster_expected_nodes=1 (shipped standalone; wild’s per-host SOL_CLUSTER_EXPECTED_NODES sets 3 for the fleet), cluster_deployment = blue-red-green (per-host env), distribution pinned to SOL_DIST_PORT=9150 (epmd 4369). The sol-cluster-expected-nodes alert owns the membership signal. Lane truth is Sol-only: Luna holds no lane configuration — a worker consumes a Sol-issued grant or fails typed lane_unavailable (no local fallback). Cross-node serving needs the non-loopback bind opt-in and advertised reachability; see docs/production-runbook.md §Three-node topology. Compatibility: Sol, Luna, Mango and Limon ship from one repo and the CD deploys them together; the ZMQ wire-protocol table below still governs worker compatibility during a rolling upgrade.

Sol ↔ Sol (Erlang distribution join exchange) — join generation 1

Since **** every Sol↔Sol join — the explicit POST /api/v1/cluster/join, the automatic nodeup, and the seed-pong rejoin — performs a synchronous, bounded rpc to the peer’s sol_cluster:hello/0 (2 s, state-free; its only effect is an idempotent application:load/1 of the peer’s own spec, and it is served even while the peer’s cluster server is busy). The exchange carries:

FieldMeaning
vsnthe join generation (?CLUSTER_JOIN_VSN). The ONE admission authority. A pre-guard release cannot answer hello/0 and is classified as generation 0 (its real release version is read separately via application:get_key(sol, vsn)).
versionthe release VERSION string (informational + the skew detail: a same-generation release difference still raises the gauge).
otp_releaseerlang:system_info(otp_release). Carried and surfaced (status/log); distribution itself enforces OTP compatibility, so it is not a gate.
schema_epochthe durable (Mnesia/event/task) schema epoch (?SCHEMA_EPOCH). Bumped ONLY on an incompatible durable-schema change.

Policy (default-on):

Local join genPeer join genSchema epochVerdict
NNequaljoined (ok); sol_cluster_version_skew = 0 when the release strings also match, else 1 with verdict version_skew
NN−1equaljoined + skew (older_peer), sol_cluster_version_skew = 1, maintenance-503 posture marker published
NN+1equaljoined + skew (newer_peer), gauge 1, marker published (symmetric window)
N≤ N−2anyREFUSED (peer_join_generation_too_old), CRITICAL log, cluster_join_refused_total, peer disconnected and marked refused
N≥ N+2anyREFUSED (peer_join_generation_too_new), same loud/refuse/disconnect path
Nany≠ localREFUSED (schema_epoch_mismatch), same path — a schema jump is stop-the-world, never rolling
Npre-guard (no hello/0)treated as 0admitted only while 0 ≥ N−1 (the first guarded release’s N−1 window); refused one release later

The refusal is typed on the HTTP join path ({error, {cluster_join_refused, Reason}}, 502-class) and best-effort on the automatic paths (no joined event, no catalog sync, no receipt/webhook reconcile; the peer is disconnected). A probe that cannot answer at all is Not a version verdict: the peer is admitted with an unknown posture, a warning and cluster_join_probe_failed_total (availability first — the distribution cookie is the trust boundary; the guard is an accident guard).

The maintenance-503 posture marker is the status datum version.posture.maintenance_503_marker (plus the sol_cluster_version_skew gauge and a one-per-peer WARNING). It deliberately does NOT flip the global sol_maintenance gate: the N/N−1 join is the ALLOWED rolling direction, and gating it would defeat the upgrade it exists to permit. Treat a 1 gauge as a maintenance-class window — finish the roll before trusting cross-node projections.

Release engineering rule: bump ?CLUSTER_JOIN_VSN by ONE on every release (paired with the VERSION bump — the same discipline as a wire protocol bump). Bump ?SCHEMA_EPOCH only when the durable schema changes incompatibly, and roll such a release stop-the-world. Both constants are gated by contract/cluster-generation.yaml + ci/cluster_generation_lint.py the YAML must match the sol_cluster.erl -defines and its recorded_for_version must equal the root VERSION, so a release that bumps VERSION without reviewing this datum is RED. The deliberate mixed-window drill lever is cluster_version_guard_ack (default false, pinned false in sys.config + sys.prod.config); true downgrades a refusal to a CRITICAL-logged ACKED admission, never a silent pass. The lever covers BOTH refusal arms — a join-generation mismatch AND a schema_epoch mismatch — and it is read PER EXCHANGE (sol_config:bool(cluster_version_guard_ack, false) at each probe), so flipping it at runtime applies to the next join/nodeup/seed-pong without a restart. The schema-epoch ACK is for a deliberate drill only: the durable schema still must not jump in production.

Sibling, not duplicate: plan/rolling-upgrade-skew-matrix.md owns the Sol↔Luna ZMQ wire skew (protocol generation N/N−1 READY window). This section is the Erlang-distribution join path; the two are independent contracts and neither replaces the other.

Toolchain build provenance

The toolchain component versions the binaries are built WITH are recorded — not inherited invisibly from a mutable image tag

The wild toolchain image ships its own record at /usr/local/share/toolchain-provenance.env, KEY=VALUE lines, luajit_commit=<40-hex> REQUIRED (the OpenResty LuaJIT fork commit — the grammar/bytecode-determinism carrier), plus musl-gcc, upx and luastatic versions. The image build writes the file; zerg consumes it . Both binary builds embed the record: client/build/build.sh and zerg-cli/build/build.sh distill the file (sorted keys) into a generated toolchain_provenance Lua module linked into the binary. zerg --version prints the record line. A missing file embeds toolchain_provenance;unrecorded and warns loudly in a dry build; on the RELEASE lane a missing record now FAILS the reproducibility gate ( — the waiver is removed; wild must ship the record). A manual operator override remains an explicit, audited escape, never a lane default. The repro gate asserts it: ci/check-build-reproducibility.sh verifies the file parses (40-hex luajit_commit), that BOTH staged builds generated identical provenance modules, and that the embedded record matches the image’s file. ci/crow_cd_lint.py pins the wiring (the gate and both build scripts must keep the provenance hooks).

Engine artifacts

The llama.cpp engines ZERG runs are first-class artifacts with recorded provenance: one engines/<class>.json row per machine class, validated by ci/engine_manifest.py and linted by ci/engine_manifest_lint.py.

Reference rows. engines/cuda_sm86.json records the RTX 3090 class (ref ggml-org/llama.cpp@aa39d7a3e145a88202793a89462d65e94a5fc25f, build b11011, GGML_CUDA=ON + CMAKE_CUDA_ARCHITECTURES=86 + GGML_CUDA_FA_ALL_QUANTS=ON, source=reference, state=reference, production=true). engines/cpu_epyc.json records the EPYC coordinator class with the documented CPU flag set and build=unbuilt — the EPYC leg is a blue/ops acceptance. Reference rows carry image_digest / manifest_hash as unverified until a hermetic ZERG build measures them; only state=reference may claim unverified. Build/packaging. scripts/engines/build.sh --class fixture|cuda_sm86| cpu_epyc --out DIR stages <out>/<build>/{bin,lib} and produces llama-<build>-<rev12>-<class>-linux-x86_64.tar.gz + .sha256 + .manifest.json (the fixture class names itself llama-fixture-<build>-linux-x86_64.tar.gz; it has no upstream rev). Packaging is deterministic: sorted tar entries, SOURCE_DATE_EPOCH mtimes, numeric owners, gzip -n. CUDA/EPYC classes require the hermetic registry image; a non-hermetic host build runs only with the explicit --local flag and can never claim production=true. Reproducibility gate. ci/check-engine-reproducibility.sh compares the sorted whole-tree bin/+lib/ manifest (sha256 + mtime + file set) of two builds with SOURCE_DATE_EPOCH fixed; a sabotage knob proves a timestamp/extra-file drift fails. ZERG_ENGINE_REPRO_TRIPWIRE_ONLY=1 is the GPU-less tripwire mode (runtime tripwire asserted; the GPU certification itself runs on red/green, never on required checks). Install / rollback. scripts/engine-install.sh <artifact> --root DIR verifies the .sha256 sidecar (and .minisig when both the signature and the minisign binary exist — a loud “not verified” line otherwise), unpacks to DIR/<build>/{bin,lib}, canary-probes /health on a scratch port, atomically flips the current symlink, keeps N-1, and writes DIR/installed.json {build, manifest_hash, installed_at, sha256, verified_by}. scripts/engine-rollback.sh repoints to the previous (or --to named) build after re-probing it. A failed canary leaves current untouched. Fixture exclusion. The fixture_openai engine (the test-only OpenAI/ SSE server, production=false, exclude_reason stated) rides the same install and model-sync path but is excluded from the production promotion set by ci/engine_manifest_lint.py. Engine tarball names must keep the llama- prefix so they can never collide with the zerg-cli updater’s exact-name candidate assets (zerg-<tag>[-<os>-<arch>].tar.gz + sidecars).

ZMQ wire protocol — v4 (lane control + per-frame MAC plane)

Protocol version: 4 since then — the v3 → v4 bump added the task-frame inference_binding lane-grant stamp and the lane_control / lane_control_ack worker-plane round-trip (upgrade posture: stop-then-upgrade — a v3 Sol silently drops lane_control). v3 before it carried the team_directive leader-attribution (sender) + content-signature (hmac) fields and joined the per-frame MAC plane. v2 before that added the per-task token seq. The canonical reference is docs/zmq-protocol-reference.md (“Protocol Version” section). Function-name anchors (deliberately no line numbers — code motion cannot stale a function name):

Sol constant + accessor: sol_zmq_protocol:protocol_version/0 returns ?PROTOCOL_VERSION = 4 (server/src/sol_zmq_protocol.erl). Luna constant: M.VERSION = 4 (client/core/zmq_protocol.lua). Every frame carries its protocol version in v (sol_zmq_protocol:stamp_version/2 driven by the centralized frame_version_for/1 authority —,: EVERY Sol→Luna builder stamps the target worker’s admitted version; Luna’s local stamp/1 in zmq_protocol.lua); absent v means legacy v1.

Version policy: zmq_wire_skew_window (default true) admits a worker whose version is exactly one below Sol’s (N−1 = v3) for rolling upgrades; anything older (v2/v1) is refused loudly at the ready handshake. With the lever set false (rollback posture) only exact-version workers register. ALL frames to an N−1 worker are stamped min(Sol, Worker) via the target-aware builders so Luna’s v > M.VERSION gate accepts them. Rationale recorded at sol_zmq_protocol.erl around the constant: (1) accepting arbitrarily old versions would silently disable the current frame semantics (token seq gap detection, MAC plane) for part of the fleet; (2) Sol and Luna ship from one repo and deploy together (wild CD); (3) mismatches already fail loudly in both directions.

Known gap — CLOSED: the control-frame gap (only the task frame skew-stamped; cancel/error/spawn_ack and the rest of the control set went out v4-stamped and were dropped by a real v3 worker’s validate_incoming/1 version gate) is fixed by target-aware stamping across every Sol→Luna builder. The per-frame policy (downstamp / current / stamp-at-target / legacy-unstamped) lives in server/test/fixtures/wire_compat_matrix.json, machine-checked by ci/stamp_policy_matrix_lint.py, and the canonical reference’s skew table documents the same truth. Only lane consumption remains v4-only (lane_control_ack/lane_revoke are v4-only semantics with visible suppression for pre-v4 targets).

Ready-handshake support table

The ready frame carries version + min_version (both = 4 from a current Luna — zmq_protocol.lua:M.ready_message/7). Sol’s sol_zmq_protocol:validate_ready_msg/1:

Worker versionWorker min_versionSol verdict
4 (== Sol’s)<= 4ok — registered (normal case)
4 (== Sol’s)> 4{error, {min_version_too_new, Min, 4}} — worker requires a protocol newer than Sol supports; refused
3 (N−1)> 4{error, {min_version_too_new, Min, 4}} — the N−1 clause binds min_version too since then -8
3 (N−1)<= 4 or absentok while zmq_wire_skew_window=true (default); {error, {version_mismatch, 3, 4}} with the lever false
anything ≠ 4 and ≠ 3any{error, {version_mismatch, V, 4}} — refused (v2/v1 workers land here, loudly)
missing version/worker_id/capabilities—{error, missing_fields}

Luna’s inbound side (M.validate_incoming/1, client/core/zmq_protocol.lua): a frame with v higher than Luna’s supported version is dropped loudly (unsupported protocol version); v <= 4 (including absent = legacy v1) is accepted. Because the ready handshake gates registration to the current version (or the N−1 window), Sol only ever dispatches to workers that already speak the accepted protocol — the Sol→Luna task direction is forward-safe by construction (control frames are the tracked exception above).

Consequence for fleets: a current Sol + v2/v1 Luna mix cannot register; a v3 Luna can register only while the skew window is on, and receives task frames stamped v3. A current Luna + older Sol mix has Sol refuse the ready. In all mismatch directions the worker shows as failed/reconnecting in zerg zmq-workers until versions match. Deploy the tag’s Sol + Luna + Mango together — the CD always does.

zerg CLI ↔ Sol (REST)

The CLI talks REST (/api/v1/* + /v1/chat/completions, /v1/messages) and SSE. REST is additive-extension compatible; the CLI is not pinned to a wire protocol — any CLI version that ships the endpoint paths it calls works against newer Sols (documented commands are the contract; see docs/api-reference.md). The update channel is the one place versions meet: zerg update check compares the local /opt/zerg/VERSION against the latest Forgejo release tag and refuses non-conforming tags (anchored-semver parse + refusal at zerg-cli/cli/update.lua:118-178; Forgejo is the default channel, :23-38) — see docs/cli-reference.md §Updates.

Mango ↔ Sol / Mango ↔ CLI (auth bridge)

Mango tokens (user_uuid, SHA-256 of a 256-bit random token_urlsafe(32)) are opaque to Luna and the CLI; Sol validates them against Mango’s revocation state — an old token against a newer Mango or vice versa either validates or fails with 401, never drifts. No version field in play.

Supporting documentation

Canonical wire reference: docs/zmq-protocol-reference.md (Protocol Version section + ready frame table) decision: docs/archive/AGENTS-decisions-archive.md Handshake auth (HMAC/enrollment): docs/zmq-security.md