Skip to content

feat(router): RuntimeIngress feeds the partition's index for the frontend - #43

Closed
ishandhanani wants to merge 1 commit into
idhanani/s1d-affinityfrom
idhanani/s1c-runtime-ingress
Closed

ishandhanani wants to merge 1 commit into
idhanani/s1d-affinityfrom
idhanani/s1c-runtime-ingress

Conversation

@ishandhanani

Copy link
Copy Markdown
Owner

Stack 1, group C, third slice: closes the "two feeders" gap at the API level. Stacked on #42. DEP #33.

Summary

One logical commit. KvEventIngress gains open, so an ingress builds the partition's index as well as feeding it, and KvIndexSource::Owned(ingress) covers both hosts:

  • ZmqDirectIngress (kv-router): open returns the registry's index; detach deregisters the worker's listeners, or, when there are none because events are off or the primary is remote, drops the worker from the index. Those are the two branches SelectionCore used to keep itself.
  • RuntimeIngress (lib/llm/src/kv_router/indexer/ingress.rs): builds the frontend's index from the router config (component metrics, request-plane remote, LRU retention), starts the runtime event-plane subscription with per-rank recovery and the served-indexer endpoint, and hands the index to the partition. Per-worker hooks are no-ops because membership comes from the KV-source watch. KvRouter::new shrinks to constructing it; task guard and shutdown go through it.
  • KvIndexSource::Provided is removed: no host needs it once its feeder is an ingress.

Behavior

Unchanged for both hosts. Same frontend index construction and subscription (the code moved from KvRouter::new), same standalone listener lifecycle and worker-removal behavior, same schedulability reasons. The recovery state machine still lives in lib/llm; this PR routes it through the trait rather than moving it.

Validation

  • cargo test -p dynamo-kv-router --features standalone-selection --lib -- services::selection: 81 passed.
  • cargo test -p dynamo-llm --lib -- kv_router::: 309 passed.
  • cargo test -p dynamo-ext-proc: 141 passed.
  • cargo clippy for kv-router (feature standalone-selection), llm, ext-proc (tests): clean. Bindings cargo check: clean.
  • Router e2e and replay parity: run once at the tip of the stack together with the EPP session-affinity PR that follows; results posted there.

Review notes (graham-code-review pass)

  • open is synchronous because the core creates partitions inside a OnceCell initializer. The frontend therefore builds its index and starts the subscription in RuntimeIngress::start before the partition exists; the two never depended on each other.
  • RuntimeIngress holds the subscription handle behind a parking_lot::Mutex only because set_task_guard and shutdown take &self through an Arc the partition shares; no lock is held across an await.
  • WorkerRegistry::has_worker is the one registry addition; it replaces the listens_for_kv_events branch in the core's cleanup path.

…tend

KvEventIngress now builds the partition's index (open) as well as feeding it,
so KvIndexSource::Owned covers both hosts and Provided goes away:

- ZmqDirectIngress opens the registry's index and, on detach, deregisters the
  worker's listeners or, when there are none (events off or a remote primary),
  drops the worker from the index: the two behaviors SelectionCore used to
  branch on itself.
- RuntimeIngress (lib/llm/src/kv_router/indexer/ingress.rs) builds the
  frontend's index from the router config, starts the event-plane subscription
  with per-rank recovery and the served-indexer endpoint, and hands the index
  to the partition. Its per-worker hooks are no-ops because membership comes
  from the KV-source watch. KvRouter::new shrinks to constructing it; task
  guard and shutdown go through it.

The core no longer special-cases a host-fed index anywhere: every Owned index
is opened by and detached through its ingress.

Signed-off-by: Ishan Dhanani <[email protected]>
@github-actions github-actions Bot added feat documentation Improvements or additions to documentation router labels Sep 4, 2026
@ishandhanani
ishandhanani force-pushed the idhanani/s1c-runtime-ingress branch from 64fef40 to de30662 Compare September 4, 2026 01:47
@ishandhanani

Copy link
Copy Markdown
Owner Author

Superseded by the upstream-shaped staging stack: continued as #51 (rebased onto ai-dynamo/main, see #33).

This branch had an error being deployed

1 failed deployment
external_collaborator — de30662b Deployed Sep 4, 2026 by ishandhanani via ok-to-test #76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feat router

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant