Repository navigation
refactor(router): give the kernel its own config slice - #134
Closed
ishandhanani wants to merge 1 commit into
Closed
ishandhanani wants to merge 1 commit into
ishandhanani wants to merge 1 commit into
Conversation
ishandhanani
had a problem deploying
to
external_collaborator
October 31, 2026 03:55 — with
GitHub Actions
Failure
Step 6-0 of the router split (DYNO-179). The scheduler kernel stops reading the flat KvRouterConfig. RouterConfig (scheduling/ router_config.rs) holds exactly what the kernel reads: the worker- selection and conditional-disagg slices, use_kv_events, track_prefill_tokens and assume_kv_reuse with their override-aware helpers, the queue recheck interval, and a PolicyProfileSource that resolves a partition's profile by model name. RouterConfig::validate runs the selection slice's checks plus a non-zero recheck interval and yields Validated<RouterConfig>, the only config SelectionCore::new_inner accepts (invariant G4); the flat config converts with From<&KvRouterConfig>, resolving profiles lazily through the policy file it loaded so a bad file still fails where policy_profile failed before. OverlapAnalysis::new, cache_hit_estimates_from_tiered_matches, and TieredOverlapRefresher::new take CacheHitWeights, a two-field view of the selection slice's host and disk cache-hit weights, instead of the whole flat config; the kernel derives it from config.selection, and lib/llm and the mocker pass CacheHitWeights::from(&config) at their five call sites. SelectionCore holds the validated slice; its try_new_local constructors still take KvRouterConfig and convert, so tests and benches are unchanged. Validation: cargo test -p dynamo-kv-router --features standalone-selection,standalone-slot-tracker,metrics,testing (532 lib + 2 plugin-API + 7 standalone HTTP); clippy -D warnings on kv-router (all targets, same features), dynamo-llm, dynamo-mocker, dynamo-ext-proc, dynamo-custom-policy-builtin, dynamo-bench (--tests), dynamo-sglang-sidecar; builtin tests 56+5+1+3+20+3+4; cargo test -p dynamo-llm kv_router (485) and --lib watcher (36); dynamo-mocker --lib 304; router layering gate 24/24; CODEOWNERS strict clean; cargo fmt --check clean; move-diff vs 37e939a lists only the RouterConfig/Validated/CacheHitWeights additions and the removed KvRouterConfig reads (summary common=16814 new=198 dropped=58). Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
ishandhanani
force-pushed
the
idhanani/dyn-179-router-config-slice
branch
from
November 2, 2026 13:30
e9256a3 to
db1103b
Compare
ishandhanani
had a problem deploying
to
external_collaborator
November 2, 2026 13:30 — with
GitHub Actions
Failure
Owner
Author
|
Landed upstream as ai-dynamo#18055 (squash commit 79692cf on main, 2026-11-11). Closing this fork review unit. |
This branch had an error being deployed
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.
Step 6-0 of the router split v2 (DYNO-179). Stacked on #133. Behavior-preserving: the scheduler kernel gets a configuration slice of its own, the first boundary the kernel crate needs.
Summary
RouterConfig(scheduling/router_config.rs, the kernel'sconfigmodule after the move) holds exactly what the kernel reads of the flat config today:selection: SelectionConfig(handed to the policy factory),conditional_disagg: ConditionalDisaggConfig(its two busy thresholds feed the load report),use_kv_events,track_prefill_tokensandassume_kv_reusewithassume_kv_reuse(override)mirroring the flat config's helper,queue_recheck_interval, andprofiles: PolicyProfileSource, a closure that resolves a partition'sPolicyProfileby model name (queueing_enabled(model)asks it).Validated<RouterConfig>.RouterConfig::validate(self)runs the selection slice's own checks (the same finite, non-negative checks the flat config applies, cache-hit weights included) plus a non-zero recheck interval, which the flat config cannot produce, and yields the newtype with a private constructor;SelectionCore::new_inneraccepts nothing else (invariant G4).impl From<&KvRouterConfig> for RouterConfiglives inscheduling/config.rswith the flat config; it clones the flat config into the profile source so profiles resolve lazily through the policy file it already loaded, failing at partition creation exactly wherepolicy_profilefailed before.CacheHitWeights { host, disk }is a two-field view of the selection slice'shost_cache_hit_weight/disk_cache_hit_weight(From<&SelectionConfig>,From<&KvRouterConfig>), so the knob has one home and both the policies that score tiers themselves and the kernel's overlap analysis read it.OverlapAnalysis::new(&CacheHitWeights, ..),cache_hit_estimates_from_tiered_matches(&CacheHitWeights, ..),TieredOverlapRefresher::new(provider, CacheHitWeights, block_size); the core derives it fromconfig.selection, lib/llm's two call sites and the mocker's three passCacheHitWeights::from(&config);CacheHitWeights::default()is the flat config's defaults (0.75 host, 0.25 disk).SelectionCore::try_new_local*still takeKvRouterConfigand convert afterapply_policy_config/validate_config, so tests, benches, and the service builder keep their calls; the builder converts once beforenew_inner.Audit behind the field list (inventory split-v2/inventory-scheduler.md §4):
overlap.rsandoverlap_refresh.rsread the two weights;core/mod.rsreadsuse_kv_events;core/workers.rsbuilds a partition's scheduler from the selection slice, the profile, the recheck interval, andtrack_prefill_tokens;core/{queries,reservations,run}.rsreadtrack_prefill_tokens,assume_kv_reuse(override), and the conditional-disagg thresholds;queue.rs,local.rs,types.rs,filter.rsnever name the flat config.Validation
cargo test -p dynamo-kv-router --features standalone-selection,standalone-slot-tracker,metrics,testing: 532 lib + 2 plugin-API + 7 standalone-HTTP tests pass.cargo clippy -- -D warnings: kv-router (all targets, same features), dynamo-llm, dynamo-mocker, dynamo-ext-proc, dynamo-custom-policy-builtin, dynamo-bench (--tests), dynamo-sglang-sidecar: clean.cargo test -p dynamo-llm kv_router485 and--lib watcher36;cargo test -p dynamo-mocker --lib304.scripts/router_layering_check.sh: 24 checks, 0 failures. CODEOWNERS--strictclean.cargo fmt --all -- --checkclean.scripts/router_move_diff.py 37e939a361 WORKTREEoverscheduling/{config,overlap,overlap_refresh,mod}.rs,services/selection/{core,service.rs}, lib/llmkv_router.rs, the two mocker files (+router_config.rson the head side):common=16814 new=198 dropped=58; every new line is theRouterConfig/Validated/CacheHitWeightscode and theself.config.*reads, every dropped line akv_router_configread or the oldKvRouterConfigparameter (artifact:s6-0-move-diff.txt).f64s from a 16-byte struct instead of from the flat config).