Skip to content

feat(lora): define runtime adapter identity - #17893

Open
biswapanda wants to merge 19 commits into
bis/dis-2937-lora-crate-movefrom
bis/dis-2937-lora-runtime-identity
Open

biswapanda wants to merge 19 commits into
bis/dis-2937-lora-crate-movefrom
bis/dis-2937-lora-runtime-identity

Conversation

@biswapanda

@biswapanda biswapanda commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add standalone request-time LoRA identity and capability helpers to dynamo-lora, together with the corresponding environment names. The source reference remains opaque and the feature is not activated by this PR.

Ownership-policy preparation and the two SPDX-only routing source shells are inherited from #17896. This PR does not change .github/codeowners/ or root CODEOWNERS; the routing implementations and module registrations remain in #17889.

Part of #15018. Refs #14547 and DIS-2937.

The shared identity error/key primitives and all dependency declarations and lockfile updates are inherited from #17896. This PR now changes only lib/llm/src/lora.rs, lib/lora/src/runtime.rs, and lib/runtime/src/config/environment_names.rs; their owners are frontend and runtime. It has no Cargo manifest, lockfile, or ownership-policy changes.

Validation

  • Diff-scoped pre-commit hooks and cargo fmt --all -- --check passed.
  • cargo check --locked -p dynamo-llm --no-default-features passed.
  • cargo test --locked -p dynamo-lora --lib passed on the subsequent dormant-policy branch, including identity tests.
  • Formatting and diff checks passed.

Summary by CodeRabbit

  • New Features
    • Added support for resolving LoRA adapters at request time by model ID or source and base model.
    • Added worker capability checks so runtime adapters are used only when eligible workers support compatible resolution options.
    • Added configuration options for runtime loading, resolver schemes, timeouts, concurrency, and download and cache limits.
    • Added validation for model and source values, with clearer errors for missing or unsupported base models.
  • Improvements
    • Improved LoRA worker capacity and adapter reporting consistency.

Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
@biswapanda
biswapanda added this pull request to stack #17906 November 3, 2026 02:26
@devin-ai-integration

devin-ai-integration Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

✅ Dynamo PR CI passed — run 41788074480 (attempt 1) on bf9322e55e

Gate checks: ✅ backend-status-check · ✅ deploy-status-check · ✅ dynamo-status-check

Posted automatically by Devin for run 41788074480. Updated on every full-CI run of this PR.

biswapanda

This comment was marked as outdated.

Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
@biswapanda
biswapanda marked this pull request as ready for review November 3, 2026 17:23
@biswapanda
biswapanda requested review from a team as code owners November 3, 2026 17:24
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The pull request moves LoRA code into a new workspace crate and adds runtime worker capability checks and model resolution. It updates controller metrics, load-estimator event handling, and model discovery to use the extracted crate. It also adds runtime configuration environment names and relocates simulation-test references.

Changes

LoRA crate and projections

Layer / File(s) Summary
Crate API and worker projections
Cargo.toml, lib/lora/*, lib/llm/src/model_card.rs
The workspace adds dynamo-lora. The crate defines the LoRA API and worker projection types. Observations now convert to and merge projections using capacity precedence, registration requirements, and adapter-name ordering.
LoRA module paths and simulation relocation
lib/lora/src/config.rs, lib/lora/src/filter.rs, lib/lora/src/huggingface.rs, lib/lora/src/load_estimator.rs, lib/lora/src/predictor.rs, lib/lora/src/routing/*, lib/lora/src/source.rs, lib/lora/tests/lora_simulation/*, lib/llm/Cargo.toml, lib/llm/src/hub.rs
LoRA imports and simulation references now use the extracted crate paths. The llm crate depends on dynamo-lora, removes the simulation test target and explicit AWS SDK dependencies, and removes its Hugging Face module exports.
Ownership paths
.github/codeowners/areas.yaml, CODEOWNERS
Ownership paths now cover lib/lora/ and its routing and test paths instead of the former llm routing path.

Runtime LoRA

Layer / File(s) Summary
Worker capabilities and eligibility
lib/lora/src/runtime.rs, lib/llm/src/lora.rs
The runtime module decodes worker capability metadata and filters eligible workers. ModelRuntimeConfig provides runtime metadata through RuntimeLoraWorkerFacts.
Model resolution and configuration
lib/lora/src/runtime.rs, lib/lora/src/lib.rs, lib/lora/Cargo.toml, lib/runtime/src/config/environment_names.rs
The runtime module adds configuration, model resolution, source validation, and adapter-key generation. Runtime environment-name constants and the duplicate-name test list are extended. Tests cover resolution, configuration, adapter keys, and debug redaction.

Controller metrics and discovery

Layer / File(s) Summary
Controller metrics and discovery wiring
lib/lora/src/metrics.rs, lib/lora/src/controller.rs, lib/llm/src/lora.rs, lib/llm/src/discovery/model_manager.rs, lib/llm/src/lora/metrics_tests.rs
LoraController now writes gauges through its ControllerMetrics instance and accepts supplied metrics for endpoint startup. Model discovery delegates projection conversion and merging to the LoRA types. The llm frontend supplies registry gauges and tests their values.

Load estimator subscription

Layer / File(s) Summary
Event handling and subscription
lib/lora/src/load_estimator.rs, lib/llm/src/lora/subscription.rs
LoadEstimator exposes event handling, and its former subscription loop is removed. LoadEstimatorSubscription subscribes to events, processes them, and retries failed subscriptions with cancellable backoff. Tests cover event processing and subscription behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: Minimal · up to b1c80

The new runtime LoRA helpers remain inactive in production. No issue requiring a fix before merge was established.

Pre-merge checks: Passed 3 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 12.90% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Inconclusive The description covers the Summary, Validation, and the scope of this PR. It names the three changed files (lib/llm/src/lora.rs, lib/lora/src/runtime.rs, lib/runtime/src/config/environment_names.rs) a… Restructure the description to follow the repository template. Add an Overview section with the summary of the standalone identity and capability helpers. Add a Key Changes section that lists the three changed files and their purpose. Keep …
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title "feat(lora): define runtime adapter identity" matches the main change. The PR adds request-time LoRA identity and capability helpers in the dynamo-lora crate, including adapter key derivatio…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(lora): define runtime adapter identity" matches the main change. The PR adds request-time LoRA identity and capability helpers in the dynamo-lora crate, including adapter key derivation and runtime resolution helpers. The title is short, specific, and follows a conventional commit style.

Full details: Docstring Coverage

Explanation

Docstring coverage is 12.90% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 31 functions across 21 files. (5 skipped: 5 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Full details: Description check

Explanation

The description covers the Summary, Validation, and the scope of this PR. It names the three changed files (lib/llm/src/lora.rs, lib/lora/src/runtime.rs, lib/runtime/src/config/environment_names.rs) and states that it has no Cargo manifest, lockfile, or ownership-policy changes. It reports validation results: pre-commit hooks, cargo fmt, cargo check for dynamo-llm, and cargo test for dynamo-lora identity tests. It also links to related issues (#15018, #14547, DIS-2937) and to the dependency PRs (#17896, #17889). The template's Overview heading is not present, and the Key Changes heading is not present, so the layout does not match the template. The template's 'Closes #XXXX' line is missing, and the PR Issue Link check is advisory, so this does not block the result. The template's Pull Request Checklist, including the /pr-checklist skill item, is not mentioned. The description is mostly complete in content, but it does not follow the required structure.

Resolution

Restructure the description to follow the repository template. Add an Overview section with the summary of the standalone identity and capability helpers. Add a Key Changes section that lists the three changed files and their purpose. Keep the existing Validation section. Under Issues and Ongoing Work, add a 'Closes' or 'Refs' line for the linked issues, and state the relationship to #15018, #14547, and DIS-2937. Add the Pull Request Checklist block and confirm whether the /pr-checklist skill was used.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 4f680f0 and b1c8063.

Files ignored due to path filters: 2
  • Cargo.lock is excluded by !**/*.lock
  • lib/bindings/python/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 37
  • .github/codeowners/areas.yaml
  • CODEOWNERS
  • Cargo.toml
  • lib/llm/Cargo.toml
  • lib/llm/src/discovery/model_manager.rs
  • lib/llm/src/hub.rs
  • lib/llm/src/lora.rs
  • lib/llm/src/lora/metrics_tests.rs
  • lib/llm/src/lora/subscription.rs
  • lib/llm/src/model_card.rs
  • lib/lora/Cargo.toml
  • lib/lora/src/cache.rs
  • lib/lora/src/config.rs
  • lib/lora/src/controller.rs
  • lib/lora/src/downloader.rs
  • lib/lora/src/filter.rs
  • lib/lora/src/huggingface.rs
  • lib/lora/src/lib.rs
  • lib/lora/src/load_estimator.rs
  • lib/lora/src/metrics.rs
  • lib/lora/src/predictor.rs
  • lib/lora/src/routing/hrw.rs
  • lib/lora/src/routing/mcf_allocator.rs
  • lib/lora/src/routing/min_cost_flow.rs
  • lib/lora/src/routing/mod.rs
  • lib/lora/src/routing/table.rs
  • lib/lora/src/runtime.rs
  • lib/lora/src/source.rs
  • lib/lora/src/state_tracker.rs
  • lib/lora/tests/lora_simulation/csv_export.rs
  • lib/lora/tests/lora_simulation/main.rs
  • lib/lora/tests/lora_simulation/plot_lora_churn.py
  • lib/lora/tests/lora_simulation/scenario_tests.rs
  • lib/lora/tests/lora_simulation/support.rs
  • lib/lora/tests/lora_simulation/topology_tests.rs
  • lib/lora/tests/lora_simulation/workloads.rs
  • lib/runtime/src/config/environment_names.rs
Files with no reviewable changes: 1
  • lib/llm/src/hub.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 8 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments: 1
lib/lora/src/runtime.rs: 1

38-38: Trivial · Maintainability & Code Quality · Low value

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Define the runtime LoRA capability taint once.

Line 38 hardcodes "dynamo.runtime-lora/v2". Line 191 builds the same taint with format! from protocol_version. The producer and the filter can drift apart when RUNTIME_LORA_PROTOCOL_VERSION changes. Workers would then stop matching the taint that the request side requires. Derive both from one helper or constant.

♻️ Proposed refactor
+pub fn runtime_lora_capability_taint(protocol_version: u16) -> String {
+    format!("dynamo.runtime-lora/v{protocol_version}")
+}
+
 ...
-        && config.taints().contains("dynamo.runtime-lora/v2")
+        && config
+            .taints()
+            .contains(runtime_lora_capability_taint(RUNTIME_LORA_PROTOCOL_VERSION).as_str())
 ...
-        format!("dynamo.runtime-lora/v{}", self.protocol_version)
+        runtime_lora_capability_taint(self.protocol_version)

Confirm that taints() returns a type whose contains accepts &str. Adjust the call if it does not.

Also applies to: 191-191

Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 9231944 and e27c2d6.

Files ignored due to path filters: 2
  • Cargo.lock is excluded by !**/*.lock
  • lib/bindings/python/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 5
  • lib/llm/src/lora.rs
  • lib/lora/Cargo.toml
  • lib/lora/src/lib.rs
  • lib/lora/src/runtime.rs
  • lib/runtime/src/config/environment_names.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 9 remain after this review.

@biswapanda
biswapanda requested a review from a team as a code owner November 3, 2026 19:28
Comment thread lib/lora/src/runtime.rs Resolved
Comment thread lib/lora/src/runtime.rs Resolved
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
@biswapanda

Copy link
Copy Markdown
Contributor Author

fixed in 56f36b9

Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
@biswapanda
biswapanda requested a review from a team as a code owner November 4, 2026 00:06
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
@biswapanda
biswapanda removed the request for review from a team November 4, 2026 02:33
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
@biswapanda
biswapanda removed the request for review from a team November 4, 2026 03:22
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants