fork: P0-1 head-bootstrap mode for llama-engine (hydra_vortex #49)#54
Merged
Conversation
added 4 commits
July 13, 2026 16:00
…hanism (hydra_vortex #49) When llama-engine starts with no --model but with --rpc-engine (indicating it's a head, not a peer), it now builds server_context + server_routes + Hydra RPC and waits for CONFIGURE(0x40) T3 to load the model. This reuses the existing first_load_pending / apply_pending_hydra_config() / apply_t3_rebuild() mechanism from PR #48/#53 — no parallel implementation. Key changes: - Add set_routes_ptr() public method to server_context (for head-bootstrap to wire routes_ptr without accessing impl directly) - Split no-model path in llama-engine.cpp: - !has_model && !has_peer: compute-only peer (unchanged) - !has_model && has_peer: head-bootstrap mode (new) - Head-bootstrap creates server_context + server_routes + Hydra RPC with empty backends, registers full HTTP inference routes - CONFIGURE T3 triggers apply_pending_hydra_config() via existing first_load_pending mechanism in update_slots() Verified has_peer signal: peer-only nodes (RTX 3060) never have --rpc-engine in their config, head-bootstrap nodes always do.
…ra_vortex #49) Three fixes for head-bootstrap mode: 1. ctx_http.is_ready now set immediately after start() — the server is ready from the moment HTTP starts, matching the compute-only-peer pattern. Individual routes handle the no-model-yet case themselves. 2. set_hydra_capabilities/set_hydra_combined_static called after deferred first-load via bootstrap_* fields staged at startup and applied in apply_pending_hydra_config() success path. Also registers local tensors, enables shared-backend compute lock, and updates RPC backends. 3. Null-meta guard in handle_completions_impl, post_chat_completions, and post_infill — returns 503 with clear message instead of crashing when meta is null (bootstrap window before first CONFIGURE). Also adds hydra_rpc::update_backends() for populating compute backends after deferred first-load.
…hydra_vortex #49) Added null-meta guards (returns 503 + clear message) to every handler that dereferences meta-> under meta_mutex: get_props, post_responses_oai, post_transcriptions_oai, post_anthropic_messages, post_anthropic_count_tokens, post_apply_template, get_models, get_model_info, post_rerank, handle_embeddings_impl Previously covered (round 3): handle_completions_impl, post_chat_completions, post_infill. The bootstrap window (is_ready=true, no model loaded yet) is now safe to expose to real traffic — all endpoints return a clear 503 instead of crashing on null deref.
…oop() (hydra_vortex #49) Without bootstrap_init(), the queue callbacks (on_new_task, on_update_slots, on_sleeping_state) are never wired up in head-bootstrap mode, causing std::bad_function_call crash when start_loop() tries to invoke them. bootstrap_init() wires up these callbacks + metrics.init() without requiring a model (no ctx_tgt/model_tgt assertions). Called before start_loop() in the head-bootstrap path. Verified via smoke test: - /health returns 200 {"status":"ok","mode":"bootstrap"} - /v1/chat/completions returns 501 "model not loaded — waiting for CONFIGURE"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds head-bootstrap mode to
llama-enginebinary so it can start without--modeland bootstrap into a full head via CONFIGURE T3 RPC. This reuses the existingfirst_load_pending/apply_pending_hydra_config()/apply_t3_rebuild()mechanism from PR #48/#53 — no parallel implementation.Problem
The entire CONFIGURE T3 bootstrap mechanism only existed in
server.cpp(llama-server binary). The binary Hydra actually deploys for COMBINED mode (llama-engine) reimplemented its own startup dispatch and had no code path to build aserver_contextwithout a model already in hand. Startingllama-enginewith no--modelmade it a compute-only ggml-RPC peer permanently — it could never become a head via CONFIGURE.Design
Signal: The
--rpc-engineflag (has_peer) distinguishes two cases whenhas_modelis false:!has_model && !has_peer: Compute-only peer (unchanged) — bare ggml-RPC backend!has_model && has_peer: Head bootstrap (new) — waits for CONFIGURE T3Verified: peer-only nodes never have
--rpc-enginein their Hydra Head Go configs; head-bootstrap nodes always do.Changes (4 rounds)
Round 2 (
933c97262): Core head-bootstrap modellama-engine.cppinto compute-only peer vs head-bootstrapbootstrap_init()toserver_context(wires queue callbacks without model)set_routes_ptr()forrefresh_meta()after first loadset_bootstrap_capabilities()for deferred capability staginghydra_rpc::update_backends()for populating compute backends post-loadapply_pending_hydra_config()success path now registers local tensors, enables shared-backend compute lock, and updates RPC backendsRound 3 (
4f296e996): Three review fixesctx_http.is_readyset immediately afterstart()(was never set —/healthwould 503 forever)handle_completions_impl,post_chat_completions,post_infillRound 4 (
5a59df5b5): Complete null-meta coveragemeta->:get_props,post_responses_oai,post_transcriptions_oai,post_anthropic_messages,post_anthropic_count_tokens,post_apply_template,get_models,get_model_info,post_rerank,handle_embeddings_impl(plus 3 from round 3)Round 5 (
c439f2b43): Missingbootstrap_init()callbootstrap_init()public method + implementation (queue callbacks were never wired —std::bad_function_callcrash onstart_loop())Smoke test results
Files changed
tools/server/server-context.hbootstrap_init(),set_routes_ptr(),set_bootstrap_capabilities()tools/server/server-context.cppbootstrap_init(), staged capabilities fields,apply_pending_hydra_config()enhancements, null-meta guards in 13 handlerstools/llama-engine/llama-engine.cpptools/llama-engine/hydra_rpc/hydra_rpc.hupdate_backends()APItools/llama-engine/hydra_rpc/hydra_rpc.cppupdate_backends()Regression verification
The compute-only peer path (
!has_model && !has_peer) is byte-identical in behavior — only a log string changed. All changes are additive to the head-bootstrap branch only.