HydraIssues

HydraBrain Role Machine: one card, one job, with a proven handover
proposed feature Project: hydrabrain Parent: #659 Reporter: 15 Nov 2026 09:28

Description

A HydraBrain node serves exactly one workload kind today: a llama.cpp chat
completions server on the alias qwen3.8-27b. A 16 GB card turned out to be a
poor host for a 27B model and an excellent GPU, so #1177 took zappy-cactus-6
back from the brain pool by hand to be the Unreal and Blender creator
workstation. That was the right call and it is also the problem: a role change
is currently a one way conversion done by an operator, with no drain, no proof
that the card came back, and no way for the fleet to say which of several jobs a
card is doing right now.

This issue carries a design for that. The full design is in the plan field,
verbatim. Read it there.
It was produced by a 13 agent ultracode run: three
surveys of the real code in hydrabrain, hydracluster and hydrabrainserver, three
independent designs with different biases, six adversarial critiques across two
lenses, and one synthesis that had to fix or accept every fatal flaw raised.

What it proposes, in short

A node declares several profiles and selects one with a single active
field, so both profiles' launch inputs and artifacts survive a switch instead of
being deleted. Four roles: chat (R1, what we run today), judge (R2, a small
high fidelity model on its own alias), embedding (R3, embeddings and rerank),
and speech (R4). Vision is not a new kind: a VLM is chat completions with
image parts. R5, giving the card back to a body or a creator workstation, is the
empty selection plus a named grant.

The agent gets an explicit, persisted state machine whose every start and stop is
gated by guards that are measured, not assumed: free VRAM against a persisted
baseline, a refused dial on the loopback port, a verified process kill, and
SHA-256 over every artifact. Only one state is discoverable, and the five legacy
state values on the wire never change, which is what keeps the #1170 class of
silent half-upgrade from happening again.

Three things the survey found in the real code

  1. Removing the hydrabrain role does not stop the workload. store.SetRoles
    never touches n.HydraBrain, GET /api/v1/hydrabrain/config then returns 403,
    and the agent turns that into fail(), which sets state = "error" and
    returns without shutting anything down (controller.go:331-334). So a node
    whose brain role is pulled can keep a 12 GiB model resident for ever while
    being absent from discovery, which makes it look free. Keeping fail()
    non-destructive is correct, because a cluster outage must not take live
    inference down. Therefore yield has to be a document change, never a role
    change. Checked on zappy today: it is clean, 555 MiB of 16303 used, no
    llama-server and no HydraBrain task, so #1177 was done properly. The hazard is
    real but it did not bite.

  2. handleEligibleBodies never reads the brain state at all. It filters on
    district, online status, the hydrabody role, venue, owner, experience and XR.
    So a head can be handed a node whose card holds 15 GiB of weights. The design
    puts one shared predicate, brainHoldsGPU, in a single new file and calls it
    from both the body eligibility filter and the brain discovery filter, with
    absence of a status report meaning held, not free.

  3. One non-chat record would take fleet chat down. hydrabrainserver
    internal/brain/client.go:267-270 returns an error on the first record
    whose protocol is not openai-chat-completions, which surfaces as a 502. So
    the consumer fix has to ship before any non-chat profile exists anywhere in
    the fleet. That ordering is step 4 of 10 in the migration table.

Checked while reviewing the design

  • nvidia-smi --query-compute-apps on zappy enumerates processes but reports
    [N/A] for used_memory. So the per-process memory guard cannot work on these
    Windows nodes and the baseline delta is the only option. That is open question
    9 in the plan, and this is the evidence for answering it.
  • The local hydracluster checkout is on branch 833-local-experiences and its
    local main is 30 commits behind origin/main (d225ba7, tag v2.4.1). Any
    patch from this design must be cut from origin/main in a private worktree,
    not from the working tree.

What is needed from the owner

Ten yes or no questions at the end of the plan. The ones that change the shape of
the work: whether a drain may cancel in flight requests when the grace expires,
whether 3 to 6 minutes is an acceptable role switch, whether about 25 to 30 GB of
extra disk per node to keep two profiles resident is acceptable, and whether a 13
state machine is acceptable in a supervisor that today has four string literals.

Nothing has been built. No code changed in any repo.

Sub-issues (1)

open #1206 HydraBrain third role: the issue agent, plus the Inkling 2 Mini ruling

Session Context

Venue
fti-experience-zone

Comments (2)

api 17 Nov 2026 19:46

Plan replaced: two roles, not thirteen states

Owner review on 2026-11-17 rejected the shape of the 13 state machine filed here
on 2026-11-15, on the rule that a role must justify the machine it occupies.
The plan field now holds the replacement. The old design is superseded in full,
not amended.

What the review removed

  • Speech and vision are not roles. A VLM is chat completions with
    image_url parts and an audio model is chat completions with audio parts.
    Same route, same protocol, same consumer code. They merge into one workload
    with general chat, which the owner named the front door.
  • Embeddings and reranking never justify a card. Two 0.6B models at about
    1.2 GiB each belong in the headroom of a card that is already working.
    Measured 2026-11-17: cosmic 4.5 GiB free, chunky 4.3 GiB free.
  • No second runtime. llama-server-impl.dll in the pinned build already
    carries image_url, audio and audio/transcriptions, and mtmd.dll
    carries the audio path. The whisper.cpp build for sm120, the hardest item in
    the old plan, is not needed.

The two states need no new states

hydracluster/pkg/api/handlers_hydrabrain.go:388   (origin/main 3c54f6f)
  discovery skips a node unless status.State == "ready" && fresh
  && cfg.Enabled && hasNodeRole(node,"hydrabrain") && WireGuardIP != ""

hydrabrain/internal/agent/controller.go           (origin/main 27285b3)
  four literals, no others: starting · ready · stopped · error

A node mid switch is starting, so it is already invisible to every
consumer with no new code. A switch is ready(front-door) to starting to
ready(judge), and both transitions fire today. No draining, no releasing,
no blocked, no recovering. The two states are the two roles, and a role is a
field on a profile, not a position in a lifecycle.

One piece of genuinely new mechanics survives: prove the card came back
between stop and start. On Windows a forced tree kill returns before the driver
frees VRAM. The guard must read total free VRAM against a persisted
baseline, because nvidia-smi --query-compute-apps reports [N/A] for
used_memory on these nodes, verified twice.

The model

Front door: Gemma 4 12B instruction tuned at Q6_K, plus its F16 mmproj. It
is the largest Gemma 4 that hears: Google's llama.cpp documentation puts audio
on E2B, E4B and 12B, while the 26B-A4B and 31B have no audio encoder. Q6_K is
about 9.1 to 10.2 GB and the projector about 120 to 175 MB, so it fits a 16 GB
card with real headroom. It is two artifacts, both pinned by URL, exact byte
size and SHA-256.

The risk is the runtime, not the model. Gemma 4 multimodal loading landed in
llama.cpp PR #24118 on 2026-06-04, after an unknown projector type: gemma4uv
failure on older builds. Our pinned runtime is
0.6.0-dev (build 11624, commit af0579c78) CUDA 13.4, the only sm120 build we
have tested, and I could not establish whether it postdates that merge. The
exec channel times out on a binary scan of llama.dll, and published build
numbers are not mapped to dates. Settle it by trying to load the projector on
crispy before committing
, which costs a download and nothing else.

Rejected: Qwen3-Omni-30B-A3B (officially supported and a fast 3B active MoE,
but it lands near 17.5 GiB at 32K and guidance says 20 GB or more, so it is the
right candidate for cosmic's 32 GB card, not for a 16 GB one);
LFM3-Omni-2B (needs b11960 / v0.8.0, ours is b11624); Qwen2.5-Omni 7B
(fits, older, keep as the fallback); MiniCPM-o 4.5 (fork only).

Judge: Qwen3 8B at Q8_0, 32K, thinking ON. About 14 GiB of 15.9. A judge
needs to hold what it is judging more than it needs parameters, and Q8 removes
the quantisation argument in a model whose only job is fidelity. Qwen3 14B at
Q6_K fits only at 16K, which is the wrong trade. Check against TypeSafe System
One before committing a card, since a judgment plane already exists in this org.

Owner rulings, all yes

  1. A drain may cancel in flight requests at grace expiry, counted and reported.
  2. 3 to 6 minutes is an acceptable switch.
  3. About 25 GB of extra disk per node to keep both models resident is fine.
  4. Proceed with the two role machine.

Three bugs that survive, independent of the design

  1. Removing the hydrabrain role does not stop the workload.
    store.SetRoles never touches n.HydraBrain, the config endpoint then
    returns 403, and the agent's fail() sets error and returns without
    shutting anything down (controller.go:331-334). The node leaves discovery
    while still holding the card. Yield must be active: "", never a role change.
  2. handleEligibleBodies never reads brain state, so a head can be sent to
    a node whose card holds 15 GiB. One shared brainHoldsGPU predicate, where a
    missing status report means held.
  3. hydrabrainserver errors on the first record it cannot serve
    (internal/brain/client.go:267-270), surfacing as a 502 for all fleet chat.
    Not a blocker here, because both roles speak openai-chat-completions. It
    becomes one the moment an embeddings record exists.

Still open

  • Which two cards. crispy, zappy (back to a body after #1177) and boom-pickle
    (RTX 4080 SUPER, body plus voice) are the 16 GB candidates.
  • Whether hydravoice, already running on cosmic and boom-pickle, has a
    transcription path we should plug into rather than opening a second one.
  • The title of this issue still says "Role Machine". Left as is rather than
    PATCH it, since PATCH replaces fields.
api 18 Nov 2026 02:49

Added: a single 16 GB envelope, as section 2

The design was complete but the one thing that matters most on this hardware was
spread over six lines in five sections, so it could be derived and not read. It
is now section 2, "What a 16 GB card can and cannot do", immediately after
the summary, with every later section renumbered and all cross references
re-checked.

It states the envelope once: 16303 MiB total, about 15.9 GiB usable, and the
budget that predicts it to within 20 MiB, which is model bytes plus about 2.3
GiB of KV per 32K slot plus about 0.6 GiB of compute buffers
.

Can hold, one at a time: the Gemma 4 12B Q6_K front door with its projector,
with real headroom. The Qwen3 8B Q8_0 judge at 32K with thinking on, near 14
GiB, tight. Qwen3.8-27B at Q3_K_XL, 15121 MiB measured, about 1.1 GiB spare.
Embeddings or a reranker, which fit trivially and do not justify the card.

Cannot do: two 32K slots, because the card holds one and two requests
serialise at 9.3 s and about 53.7 tok/s aggregate. Qwen3.8-27B above Q3_K_XL,
because Q4_K_M is 15.33 GiB of weights alone with no KV budget left.
Qwen3-Omni-30B-A3B, at about 17.5 GiB. Qwen3 14B Q6_K with 32K, which fits only
at 16K. Both roles at once, which is the entire reason a selector exists.
64K context on anything. A brain and a body sharing the card.

It also records the two consequences that already bit us: a 16 GB card is
capacity and not quality, because Q3_K_XL at a labelled 56 tok/s sorted above
chunky's Q4_K_M at 33 and gave every consumer 3-bit, code work included, which
is why discovery gains a role filter rather than a shaded number. And thinking
is a front door setting, not a card setting: the fleet wide
--reasoning-budget 0 exists so an open-ended request cannot spend its budget
thinking and return an empty message, while a judge must run with thinking on.

Separately, hydrabrain README and runbook are corrected and pushed (7181bd6):
the pool is two providers, cosmic and chunky, and the #1172 section is retitled
as retired with its measurements and quant ladder kept.