mit einem Klick
dynamo-clone-hotpath-audit
// Audit Dynamo Rust hot-path `.clone()` calls, explain which clones are removable and why, and only apply clone-removal patches when explicitly requested.
// Audit Dynamo Rust hot-path `.clone()` calls, explain which clones are removable and why, and only apply clone-removal patches when explicitly requested.
Validate that a Dynamo deployment's NIXL/UCX/NCCL interconnect is ready for disaggregated serving over RDMA/NVLink. Use after recipe-runner brings a deployment up (especially disagg/multi-node) to confirm the KV transport is correct; use troubleshoot for diagnosing already-failed pods.
Select, validate, patch, and deploy existing NVIDIA Dynamo Kubernetes recipes. Use for model/backend/GPU/deployment-mode recipe bring-up; use router-starter for router-only mode work and troubleshoot for broken deployments.
Start or patch Dynamo router modes and run router endpoint smoke checks. Use for round-robin, KV-aware, least-loaded, or device-aware routing setup; use recipe-runner for recipe deployment and troubleshoot for failure diagnosis.
Diagnose failed or unhealthy Dynamo deployments. Use when pods, model-cache jobs, PVCs, workers, frontend/router health, endpoints, or benchmark jobs fail; use recipe-runner/router-starter before this for normal bring-up.
Start a debugging session with worklog file
Create or update Dynamo Enhancement Proposals as GitHub issues, including lightweight DEPs, implementation plans, and retroactive DEPs for ai-dynamo/dynamo.
| name | dynamo-clone-hotpath-audit |
| description | Audit Dynamo Rust hot-path `.clone()` calls, explain which clones are removable and why, and only apply clone-removal patches when explicitly requested. |
| license | Apache-2.0 |
| metadata | {"author":"NVIDIA","tags":["dynamo","rust","performance","code-review","allocation"],"permissions":["file_read","file_write"]} |
Find .clone() calls in Dynamo Rust request, scheduling, KV, block-manager, and
runtime hot paths that can be removed without changing ownership semantics. This
is an audit-first workflow, not a blanket clone-removal tool.
Default behavior is read-only audit. Do not edit files, commit, or open a PR
unless the user explicitly asks to fix, patch, apply, implement, or create an
MR/PR. A skill invocation such as $dynamo-clone-hotpath-audit, "audit",
"check", or "scan" is not patch permission.
ai-dynamo/dynamo.Run the read-only scanner from the repository root:
python3 .agents/contributor-skills/dynamo-clone-hotpath-audit/scripts/clone_inventory.py \
--only-actionable \
--limit 80
Use narrower paths when the user names a subsystem:
python3 .agents/contributor-skills/dynamo-clone-hotpath-audit/scripts/clone_inventory.py \
--paths lib/kv-router/src/scheduling lib/llm/src/backend \
--only-actionable
Treat the scanner as a triage aid. It ranks likely expensive clones but does not prove removability.
Prioritize in this order:
lib/llm/src/backend.rs, preprocessor, HTTP/gRPC
services, protocol conversion, migrationlib/kv-router/src/scheduling,
lib/kv-router/src/sequences, lib/kv-router/src/indexerlib/llm/src/block_manager,
lib/bindings/kvbm/src/block_manager, lib/kvbm-engine/src/offloadlib/runtime/src/component,
lib/runtime/src/pipeline, lib/runtime/src/transportsFor non-trivial audits, use subagents. Give each subagent only the inventory slice and relevant source files, not your intended answer.
Required roles:
Arc, or mem::take
changes.await, break spawned task ownership, or make APIs
less clearIf two roles disagree, keep the clone unless you can write down a precise ownership proof and validation plan.
Use these buckets:
Arc, sender, cancellation token, runtime handle, watch
receiver, metrics handle, or tracing span clone needed to share ownership&T, &str,
slice, or iteratorVec<T> to
Arc<[T]>, or changing an API familyDo not patch candidates in the first three buckets.
Only run this section when the user explicitly asks for fixes or a patch. If the user only asked for an audit, stop after the report and list recommended patch batches as follow-up work.
Keep each patch batch narrow: one subsystem or one repeated pattern. Avoid a single repository-wide clone cleanup PR unless the user explicitly asks for it.
Preferred fixes:
&T, &str, &[T], or an iterator when the callee only readsinto_iter() instead of indexing and cloningCopy fields before moving a large eventstd::mem::take only when leaving the source value empty is part of the
intended semanticsArc only when shared ownership is semantically right, not just to avoid
borrow-checker workDo not:
tokio::spawn, channel send, callback storage, or
task lifetime boundaries without proving ownership.await unless the borrow is local and compiler-verifiedFor every proposed change, report:
file:lineExample:
lib/llm/src/preprocessor.rs:123
Hot path: every embeddings request.
Cost: clones Vec<String> before moving into spawn_blocking.
Bucket: removable move.
Change: move input_strs into the closure.
Removal rationale: the clone feeds the only owned consumer and the original is
not read after closure construction.
Required-clone check: no fan-out, retry, async task sharing, or later logging
uses the original value.
Proof: the closure receives the same owned Vec<String>; all later behavior reads
from that moved value.
Validation: cargo test -p dynamo-llm preprocessor
If patches were made, always run formatting and the narrowest relevant Rust tests. For broad API changes, also run clippy or crate-level tests for each touched crate. If no patches were made, do not run tests just to make the audit look validated; report the inventory command and any read-only review checks.
Return:
none: audit-onlynot run: no files changed| Script | Purpose | Arguments |
|---|---|---|
scripts/clone_inventory.py | Rank Rust .clone() call sites by hot-path likelihood and removal potential | --paths, --limit, --format, --only-actionable, --include-tests |
Invoke via the agentskills.io run_script() protocol:
run_script("scripts/clone_inventory.py", args=["--only-actionable", "--limit", "80"])
Return a concise audit report or PR summary with:
none: audit-only