Skip to content

fix(kv-router): reject overflowing worker rank ranges - #16366

Merged
jthomson04 merged 1 commit into
ai-dynamo:mainfrom
bojiang-li:fix/worker-rank-overflow
Oct 14, 2026
Merged

jthomson04 merged 1 commit into
ai-dynamo:mainfrom
bojiang-li:fix/worker-rank-overflow

Conversation

@bojiang-li

@bojiang-li bojiang-li commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Reject a worker configuration when its data parallel start rank plus rank count overflows u32. Validation runs before catalog or indexer changes, so an invalid batch entry cannot poison the partition and an invalid patch leaves the live worker and its booking intact.

Details

This extracts the overflow check and its two regression tests from #15010, as requested in review. It can land independently of the worker lifecycle and shutdown changes.

On macOS arm64 with Rust 1.96.1, both regressions fail on current main before the fix. With the fix, the KV router library suite with standalone-selection,standalone-slot-tracker,metrics passes: 1332 tests passed and 3 ignored. Strict Clippy for the library and tests, Rust formatting, and matching precommit hooks pass.

Where should the reviewer start?

The validation in prepare_worker in lib/kv-router/src/services/selection/core/workers.rs, followed by the batch and patch regression tests.

Related Issues

Relates to #16070 and #15053. Split from #15010.

AI assistance was used for implementation and local validation.

Summary by CodeRabbit

  • Bug Fixes
    • Workers with data-parallel rank ranges that exceed the supported limit are now rejected with a clear error instead of being accepted with invalid settings.
    • In batch additions, rejecting an invalid worker no longer prevents valid workers in the same batch from being added and selected.
    • Invalid updates to an existing worker leave its current rank settings, booking, and availability unchanged.

@bojiang-li
bojiang-li requested a review from a team as a code owner October 13, 2026 23:17
@copy-pr-bot

copy-pr-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@bojiang-li
bojiang-li temporarily deployed to external_collaborator October 13, 2026 23:17 — with GitHub Actions Inactive
@bojiang-li
bojiang-li temporarily deployed to external_collaborator October 13, 2026 23:17 — with GitHub Actions Inactive
@github-actions github-actions Bot added the fix label Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi bojiang-li! Thank you for contributing to ai-dynamo/dynamo.

Just a reminder: The NVIDIA Test Github Validation CI runs an essential subset of the testing framework to quickly catch errors.Your PR reviewers may elect to test the changes comprehensively before approving your changes.

🚀

@github-actions github-actions Bot added the external-contribution Pull request is from an external contributor label Oct 13, 2026
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: ai-dynamo/dynamo/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 54d33a78-73e3-4253-8dd5-f6b3b368e234
📥 Commits

Reviewing files that changed from the base of the PR and between 7037078 and c387a64.

📒 Files selected for processing: 2
  • lib/kv-router/src/services/selection/core/tests.rs
  • lib/kv-router/src/services/selection/core/workers.rs

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

Walkthrough

Worker preparation now rejects data-parallel rank ranges that overflow u32. Regression tests cover batch upsert and patch behavior, including the state of valid or existing workers.

Changes

Worker range validation

Layer / File(s) Summary
Reject overflowing data-parallel ranges
lib/kv-router/src/services/selection/core/workers.rs, lib/kv-router/src/services/selection/core/tests.rs
prepare_worker returns BadRequest when the data-parallel rank start plus size overflows u32. Tests verify that batch upsert rejects the invalid worker while retaining the valid worker, and that patch leaves the live worker’s rank, booking, and selectability unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to c387a

Worker configurations whose data-parallel rank range overflows u32 are now rejected with a 400 error, leaving live workers and other batch entries intact. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: rejecting overflowing worker rank ranges.
Description check Passed The description covers the overview, implementation details, review starting points, related issues, validation results, and AI assistance. The required Related Issues section is present with issue re…
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.
  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@jthomson04 jthomson04 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.

Thanks for splitting this out. Rejecting the overflowing range in prepare_worker, before any per-rank work, is the right place for it, and the two tests cover what matters: a bad record in a batch no longer poisons the rest, and a bad patch leaves the live worker and its bookings intact. LGTM.

@jthomson04

Copy link
Copy Markdown
Contributor

/ok to test c387a64

@jthomson04
jthomson04 enabled auto-merge (squash) October 14, 2026 00:13
@jthomson04
jthomson04 merged commit e184682 into ai-dynamo:main Oct 14, 2026
120 checks passed

This branch was previously deployed

1 inactive deployment
external_collaborator — c387a649 Deployed Oct 13, 2026 by bojiang-li via pr_reminder #13853
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contribution Pull request is from an external contributor fix size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants