Skip to content

feat(kv-router): inject host hooks into SelectionService - #8

Closed
ishandhanani wants to merge 1 commit into
mainfrom
idhanani/p0-selection-scheduler-hooks
Closed

ishandhanani wants to merge 1 commit into
mainfrom
idhanani/p0-selection-scheduler-hooks

Conversation

@ishandhanani

@ishandhanani ishandhanani commented Sep 3, 2026 •

Copy link
Copy Markdown
Owner

Phase 0 (selection-core parity) of the runtime-optional frontend roadmap, item 1.

Summary

  • Add SelectionHostHooks { prefill_load_estimator, overloaded_worker_provider, available_worker_provider } and SelectionServiceBuilder::host_hooks().
  • SelectionCore::ensure_entry passes the hooks to every LocalScheduler it creates instead of the hardcoded Nones (core/mod.rs formerly lines 498-502). LocalScheduler::new_with_policy_profile already accepted them.
  • Standalone HTTP service leaves the hooks unset: no behavior change. This is the seam Phase 1 uses to re-host the frontend KvRouter (which today builds these three closures from its Client in lib/llm/src/kv_router.rs:770-786) on an embedded SelectionService.

Validation

  • cargo test -p dynamo-kv-router --features standalone-selection --lib services::selection: 64 passed, including two new tests proving an injected availability set and an injected overload set steer select() through the core.
  • cargo clippy -p dynamo-kv-router --features standalone-selection --all-targets: only the pre-existing new_with_indexer_metrics_and_cancel_token dead-code warning in services/indexer/registry.rs.
  • cargo fmt clean. Python bindings (lib/bindings/python/rust/llm/kv.rs:664) use the builder via new() + chained methods, so the new defaulted field is non-breaking.

Expose the three LocalScheduler provider hooks that SelectionCore::ensure_entry
hardcoded to None (prefill-load estimator, overloaded-worker exclusion set,
hard-availability inclusion set) through a new SelectionHostHooks struct and
SelectionServiceBuilder::host_hooks(). Every partition scheduler the core
creates receives the same hooks.

The standalone HTTP service leaves them unset, so its behavior is unchanged.
An embedding host (the frontend KvRouter in a later change) can now feed the
same overload and availability state it passes to KvScheduler today.

Tests: availability and overload providers steer selection through the core.
Signed-off-by: Ishan Dhanani <[email protected]>
@ishandhanani

Copy link
Copy Markdown
Owner Author

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

This branch had an error being deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant