Skip to content

feat(server): route hydra_config through PREFILL and HTTP decode paths (#487) - #62

Merged
ddvnguyen merged 1 commit into
hydra-forkfrom
feat/487-prefill-hydra-config-apply
Jul 22, 2026
Merged

ddvnguyen merged 1 commit into
hydra-forkfrom
feat/487-prefill-hydra-config-apply

Conversation

@ddvnguyen

Copy link
Copy Markdown
Owner

Summary

Closes hydra_vortex#487 (fork side). Hydra.Core already sends a hydra_config
object (split_mode/tensor_split/model_path/rpc_servers/etc, from
EngineConfig.ToHydraConfigDict()) on both the PREFILL (0x42) RPC body and
the HTTP /v1/chat/completions decode body — but until now nothing on this
side read it. CONFIGURE (0x40) already has a working, tested classify →
apply-T1 → stage-T2/T3 pipeline; this PR gives PREFILL and the HTTP decode
path the same capability, applied synchronously since both already own
the slot/task-queue-thread context when they run (CONFIGURE's stage-and-defer
behavior is unchanged).

  • Factor a shared hydra_apply_config() helper out of the CONFIGURE handler
    (sync flag: true for PREFILL/decode, false for CONFIGURE).
  • PREFILL (0x42): parses optional hydra_config, routes it through the
    helper. hydra_config.model_path takes priority over the legacy bare
    model alias field when present.
  • HTTP decode (/v1/chat/completions): extracts hydra_config before
    oaicompat_chat_params_parse() consumes the body, attaches it to the
    server_task, applies it on the task-queue thread at the start of that
    task's processing — not the httplib worker thread (an earlier attempt at
    this, b831c237c, was reverted for exactly that race — eebbe1116).
  • Add rpc_servers to T3 classification; new endpoints are registered into
    the global ggml RPC backend registry (same primitive --rpc/--rpc-engine
    startup parsing uses) before the model reload, deduped against
    already-registered endpoints.

Does not touch binary DECODE (0x43) — Hydra.Core never calls it. Does not
touch load_model()'s VRAM-release ordering (ggml-org#486, already merged).

Test plan

  • cmake --preset hydra-dev && cmake --build build-hydra-dev --target llama-engine — clean build, verified independently (not just agent self-report).
  • Live E2E: deploy to RTX head + RTX 3060 peer, drive a dense-27b-combined request, confirm split_mode/tensor_split/rpc_servers actually land via INFO (0x41) layer_split/peer_addr/combined_head_attached, confirm no SIGKILL loop across MoE↔Dense swaps.

🤖 Generated with a Paseo subagent (opencode-go/mimo-v2.5), reviewed and build-verified by Claude Code acting as lead.

hydra_vortex#487

Factor a shared hydra_apply_config() helper from the CONFIGURE handler
that classifies config keys (T1/T2/T3) and either stages or synchronously
applies them based on a sync flag. This eliminates the duplicated
classify-apply-stage logic.

PREFILL (0x42): Parse optional hydra_config object from the request body.
When present with model_path, drive the model swap directly via the shared
helper (sync mode), bypassing the preset alias lookup. Keep the existing
bare model alias field working for simple swaps without topology changes.

HTTP decode (/v1/chat/completions): Extract hydra_config from the raw body,
attach it to the server_task via a new hydra_config_json field, and apply
it synchronously on the task-queue thread at the start of COMPLETION
processing. This avoids the httplib worker thread race that caused the
previous attempt (b831c23) to be reverted (eebbe11).

rpc_servers T3: Add rpc_servers (JSON string array) to T3 classification.
Stage pending servers in a file-scope static via hydra_apply_t3_mutators(),
then register new endpoints via a ggml backend helper in apply_t3_rebuild()
before load_model(). Tracks already-registered endpoints to avoid unsafe
repeated registration.

Also adds model_path to T3 classification and hydra_apply_t3_mutators()
so the flat hydra_config key drives model swap through the standard T3
rebuild path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant