Skip to content

refactor(router): classifier runtime reports its own error and takes the view - #132

Closed
ishandhanani wants to merge 1 commit into
idhanani/dyn-178-admission-configfrom
idhanani/dyn-178-classification-error
Closed

ishandhanani wants to merge 1 commit into
idhanani/dyn-178-admission-configfrom
idhanani/dyn-178-classification-error

Conversation

@ishandhanani

Copy link
Copy Markdown
Owner

Step 5e-3 of the router split v2 (DYNO-178). Stacked on #131. Behavior-preserving; the last boundary change before the admission crate move.

Summary

  • ClassificationError. The classifier runtime (scheduling/request_classifier.rs, moving to dynamo-admission in 5e-4) stops naming the kernel's KvSchedulerError. classify_with, begin_request, and the terminal-delivery wait return ClassificationError::{Panicked(String), Failed(Arc<ClassifierError>), DuplicateRequestId(String), InvalidMetadata(String), LifecycleEnded(String), Shutdown}, with the messages the kernel's variants carried (Shutdown says "request classifier runtime shut down"; the kernel's SubscriberShutdown keeps its own text).
  • Kernel conversion. impl From<ClassificationError> for KvSchedulerError in scheduling/types.rs maps each variant to the existing one (RequestClassifierPanicked, RequestClassifierFailed, DuplicateClassificationRequestId, InvalidClassificationMetadata, ClassificationLifecycleEnded, SubscriberShutdown), so the kernel's error surface, the selection service's HTTP status mapping, lib/llm's abort-cause mapping, and the Python bindings are untouched. The scheduler's two call sites add map_err(KvSchedulerError::from).
  • classify_with(&dyn WorkerView). The runtime takes the view; the scheduler wraps its freshly built rows in ClassifierRows (introduced in refactor(router): classifiers read workers through an admission-owned view #130) at the call site, and the runtime's own tests classify over NoWorkers. The view is lent for the synchronous classify call as before.
  • WorkerView: Sync. Views are read-only snapshots. A classification future borrowing &dyn WorkerView across the classifier-lock await must stay Send for spawned callers (the selection service's handlers and tokio::spawned selections), which &dyn WorkerView is only when the trait object is Sync.
  • ClassificationError is exported at scheduling::ClassificationError beside RequestLifecycle.

Validation

  • cargo test -p dynamo-kv-router --features standalone-selection,standalone-slot-tracker,metrics,testing: 554 + 2 + 7 passed (the runtime's tests now assert ClassificationError variants).
  • cargo test -p dynamo-custom-policy-builtin --all-features: 56 + 5 + 1 + 3 + 20 + 3 + 4 passed.
  • cargo test -p dynamo-llm kv_router: 485 passed; cargo test -p dynamo-llm --lib watcher: 36 passed.
  • cargo clippy --all-features --all-targets -D warnings on kv-router, builtin: clean; cargo clippy --tests -D warnings on lib/llm (default features), mocker, ext-proc, bench: clean; cargo check --tests on lib/llm, mocker, bench, sglang-sidecar, ext-proc: clean.
  • scripts/router_layering_check.sh: 22 checks, 0 failures.
  • scripts/router_move_diff.py f832286531 WORKTREE over scheduling/{request_classifier,local,types,mod}.rs and plugins/request_classifier/view.rs: 3,788 common / 91 new / 64 dropped. New: the error enum, the From impl, the view parameter and the two call-site wraps, NoWorkers in the runtime tests, the Sync bound. Dropped: the KvSchedulerError variant constructions and signatures in the runtime, the WorkerInputRows::empty() arguments, and the in-runtime ClassifierRows wrap.

…the view

Step 5e-3 of the router split (DYNO-178). RequestClassifierRuntime no
longer names KvSchedulerError: classify_with, begin_request, and the
terminal-delivery wait return ClassificationError, with one variant per
failure the runtime can detect (Panicked, Failed, DuplicateRequestId,
InvalidMetadata, LifecycleEnded, Shutdown) and the same messages the
kernel's variants carried. The kernel converts with
From<ClassificationError> for KvSchedulerError, so its error surface,
the selection service's status mapping, and every host path are
unchanged. classify_with takes `&dyn WorkerView`; the scheduler wraps
the rows it built in ClassifierRows at its two call sites, and the
runtime's tests classify over the empty view. WorkerView gains a Sync
supertrait: views are read-only snapshots, and a classification future
that borrows one must stay Send for spawned callers.

Validation: kv-router 554 + 2 + 7; builtin plugin all targets; lib/llm
kv_router 485 and discovery watcher 36; clippy clean on kv-router,
builtin, lib/llm, mocker, ext-proc, bench; downstream check clean;
layering gate 22 checks; move-diff 3,788 common / 91 new / 64 dropped.

Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
@ishandhanani

Copy link
Copy Markdown
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

1 failed deployment
external_collaborator — 5b8c1f3e Deployed Nov 2, 2026 by ishandhanani via ok-to-test #477
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