Repository navigation
Conversation
Signed-off-by: Karen Chung <karenc@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (12)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughThe KV-router plugin system now supports configured KV-hint policies. The LLM router can install a policy, formulate actions from request context, and combine them with request and selection hints during dispatch. ChangesKV-hint policy flow
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to This adds optional KV-hint policy support that is inactive unless configured. Policy failures fall back to no extra hints, so the risk of merging is low. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
⏹️ Dynamo PR CI cancelled — run 37386801701 (attempt 1) on
|
| Other | Jobs |
|---|---|
| dynamo-runtime | ⏹️ 1 |
| frontend | ⏹️ 1 |
| planner | ⏹️ 1 |
| triton-runtime | ⏹️ 1 |
Failure details
No job failed. All 4 non-passing jobs are image builds that GitHub cancelled during Build and Push Image after hitting their job time limit. This was not fail-fast and not a manual or concurrency cancel. The red gate checks only mirror these cancels. A slow or stuck image build or push is the likely cause, so rerunning the failed jobs is probably enough.
- ⏹️ dynamo-runtime / image / Build multi-arch cuda13.0: hit the 1h0m0s limit
- ⏹️ planner / Build multi-arch cpu: hit the 1h0m0s limit
- ⏹️ triton-runtime / Build multi-arch cpu: hit the 1h0m0s limit
- ⏹️ frontend / Build multi-arch cpu: hit the 1h30m0s limit
For agents
{"pr": 15679, "run_id": 37386801701, "run_attempt": 1, "head_sha": "940d96ff4e16e940834640363d2f9f971fe1e86f",
"failures": [],
"cancelled": [
{"job": "dynamo-runtime / image / Build multi-arch cuda13.0", "job_id": 112022092446, "failed_step": "Build and Push Image", "signature": "exceeded maximum execution time of 1h0m0s", "log_cmd": "gh api repos/ai-dynamo/dynamo/actions/jobs/112022092446/logs"},
{"job": "planner / Build multi-arch cpu", "job_id": 112022092176, "failed_step": "Build and Push Image", "signature": "exceeded maximum execution time of 1h0m0s", "log_cmd": "gh api repos/ai-dynamo/dynamo/actions/jobs/112022092176/logs"},
{"job": "triton-runtime / Build multi-arch cpu", "job_id": 112022092058, "failed_step": "Build and Push Image", "signature": "exceeded maximum execution time of 1h0m0s", "log_cmd": "gh api repos/ai-dynamo/dynamo/actions/jobs/112022092058/logs"},
{"job": "frontend / Build multi-arch cpu", "job_id": 112022092256, "failed_step": "Build and Push Image", "signature": "exceeded maximum execution time of 1h30m0s", "log_cmd": "gh api repos/ai-dynamo/dynamo/actions/jobs/112022092256/logs"}
]}Posted automatically by Devin for run 37386801701. Updated on every full-CI run of this PR.
Overview:
This PR extends the existing
RouterPluginRegistrywith a configurableKvHintPolicyhook that formulates request-attached KV-hint actions after Dynamo chooses the worker for a request. This gives custom router policies read-only access to session-aware block lineage without changing worker selection or couplingSessionPrefixIndexerto any specific action or execution policy.Details:
KvHintPolicycontract whose synchronousformulate()callback receives the request ID, canonical session context, and selected worker/DP rank.SessionPrefixIndexerqueries throughKvHintPolicyContext, including worker-qualified session frontiers and root-to-frontier block-hash paths.RouterPluginRegistry: statically linked policies register one constructor and are selected throughrouter_policy_configusingkv_hint_policy: {type, parameters}.User example
Dynamo exposes
KvHintPolicyas the policy interface andKvHintPolicyContextas its read-only view of the request, session, selected worker, and session lineage. A user implements the policy, registers it under a name with the router's existingRouterPluginRegistry, and returns theKvHintActionvalues to attach to matching requests. The existingrouter_policy_configsurface was introduced in #10744, and #12536 established the registered-policy selection pattern reused here:The registration makes
retain-sessionavailable to the router. Select it inrouter_policy_configwith:The
kv.retainaction and payload above are illustrative; the engine consumer defines the supported action semantics.System-level view
flowchart TB subgraph R["Dynamo router"] direction TB REQ["Session-tagged request"] IDX["G1/G2<br/>residency indexes"] SEL["Choose worker<br/>and DP rank"] SPI["SessionPrefixIndexer"] CTX["Policy context<br/>request + session + chosen worker"] POL["KvHintPolicy<br/>formulate actions"] ATTACH["Attach policy actions<br/>to routed request"] REQ --> SEL IDX --> SEL SEL -. "enqueue matched prefix" .-> SPI SEL --> CTX CTX --> POL SPI -->|"read committed lineage"| POL POL -->|"KvHintAction list"| ATTACH end ATTACH -->|"request + KvHint"| ENG["Chosen<br/>inference worker"] ENG -->|"canonical KV events"| IDX ENG -->|"ordered session updates"| SPIRequest ordering
SessionPrefixIndexer.KvHintPolicy::formulate()runs with the selected worker and may query committed session lineage for that worker.compose_kv_hint()appends policy actions to any envelope already produced during selection. Otherwise, the policy actions form a new envelope.Session-index updates are ordered but asynchronous. A policy query observes committed state and must not assume that blocks first associated with or created by the current request are already indexed.
Boundaries
KvHintPolicydoes not participate in worker selection; it receives the already selected worker.SessionPrefixIndexeris disabled.Where should the reviewer start?
lib/kv-router/src/plugins/kv_hint.rs— public policy contract and session-query API.lib/kv-router/src/plugins/kv_hint/registry.rsandlib/kv-router/src/plugins/registry.rs— integration with the existing router plugin registry and per-partition policy construction.lib/llm/src/kv_router.rs— policy installation, context construction, and fail-open invocation.lib/llm/src/kv_router/routing_host/kv.rs— post-selection execution, action precedence, and request dispatch.lib/kv-router/tests/plugin_api_compat.rs— external plugin registration and API compatibility coverage.Related Issues
Validation
cargo fmt --all -- --checkcargo check -p dynamo-kv-router -p dynamo-llm --all-targetscargo clippy -p dynamo-kv-router -p dynamo-llm --all-targets -- -D warningscargo test -p dynamo-kv-router— 1,047 passed; 2 ignoredcargo test -p dynamo-llm kv_hint_policy— passed