Skip to content

Conversation

@alec-flowers
Copy link
Contributor

@alec-flowers alec-flowers commented Aug 21, 2025

Overview:

Previously, we would always set a default for the --kv-event-config to publish events when kv caching was enabled in dynamo. We now will let a user override our default.

Details:

Where should the reviewer start?

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • closes GitHub issue: #xxx

Summary by CodeRabbit

  • New Features
    • Smarter default configuration for prefix-caching event publishing when no user config is provided.
  • Bug Fixes
    • Respects user-provided event configuration, preventing unintended overrides when prefix caching is enabled.
  • Refactor
    • Centralized creation of event configuration to simplify and align behavior with related settings.
  • Chores
    • Improved log messages to clearly indicate when user configuration is used versus when defaults are applied.

@alec-flowers alec-flowers enabled auto-merge (squash) August 21, 2025 23:21
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 21, 2025

Walkthrough

Introduces create_kv_events_config to centralize KV events config creation for prefix caching. overwrite_args now conditionally sets kv_events_config based on this helper, respecting user-provided configs. Maintains existing kv_transfer_config handling and adds targeted logging for default vs user-specified KV events configuration.

Changes

Cohort / File(s) Summary of Changes
KV events config refactor
components/backends/vllm/src/dynamo/vllm/args.py
Added create_kv_events_config(config) -> Optional[KVEventsConfig]; updated overwrite_args to delegate KV events config construction; conditional injection when prefix caching enabled and no user config; preserved kv_transfer_config handling; added logging for user-provided vs default KV events config; new endpoint format uses tcp://*:{config.kv_port - dp_rank}.

Sequence Diagram(s)

sequenceDiagram
    participant UserConfig as User Config
    participant Overwrite as overwrite_args
    participant Helper as create_kv_events_config
    participant Logger as Logger

    UserConfig->>Overwrite: Provide Config (prefix caching on/off, kv_events_config?)
    Overwrite->>Helper: create_kv_events_config(config)
    alt prefix caching disabled OR user provided kv_events_config
        Helper-->>Overwrite: None
        Overwrite->>Logger: Note user-provided or disabled (no defaults applied)
    else prefix caching enabled and no user config
        Helper-->>Overwrite: KVEventsConfig(enable=True, publisher="zmq", endpoint="tcp://*:{kv_port - dp_rank}")
        Overwrite->>Logger: Note Dynamo default KV events config created
        Overwrite->>Overwrite: Set defaults["kv_events_config"] = returned config
    end
    Overwrite->>Overwrite: Handle kv_transfer_config via existing helper (unchanged)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit taps keys with whiskered delight,
Routing KV whispers through sockets just right.
If users bring maps, I hop out the way—
Else I draw paths for a cached-breeze day.
Ears perked to logs, I bound and I blend,
Default trails set, then off I wend. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
components/backends/vllm/src/dynamo/vllm/args.py (1)

274-275: dp_rank offset remains necessary for ZmqEventPublisher endpoint

  • vLLM’s ZmqEventPublisher binds to the exact port specified in its endpoint parameter—it does not auto-increment or offset the port by data_parallel_rank (docs.vllm.ai).
  • Therefore, subtracting (or otherwise offsetting) dp_rank from your base port is required whenever you launch multiple data-parallel ranks on the same host to avoid binding conflicts.

Recommended update:

- endpoint=f"tcp://*:{config.kv_port - dp_rank}",  # vLLM will iterate dp_rank for us, so we need to subtract it out TODO: fix in vLLM
+ endpoint=f"tcp://*:{config.kv_port - dp_rank}",  # offset port by dp_rank to allow multiple DP ranks on one host; vLLM uses the endpoint as-is
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 105436c and 67e1c05.

📒 Files selected for processing (1)
  • components/backends/vllm/src/dynamo/vllm/args.py (2 hunks)
🔇 Additional comments (3)
components/backends/vllm/src/dynamo/vllm/args.py (3)

263-267: Respects user-provided --kv-event-config (good behavior change).

Line 264 correctly short-circuits when a user supplies kv_events_config, so we no longer overwrite CLI intent. This aligns with the PR objective.


340-347: Conditional defaults now honor CLI intent.

Only setting defaults["kv_events_config"] when the helper returns a value ensures we don’t override a user-specified --kv-event-config. This achieves the PR’s stated goal.


340-347: I’m inspecting the implementation of create_kv_events_config to confirm its default‐injection logic. Once I’ve verified the port math (base = kv_port - dp_rank) and CLI override behavior, I’ll finalize the test recommendation.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Alec <[email protected]>
@alec-flowers alec-flowers force-pushed the aflowers/kv-events-config-update branch from ebc92ef to 1949a4f Compare August 21, 2025 23:29
@alec-flowers alec-flowers merged commit b5fa0a3 into main Aug 21, 2025
11 of 13 checks passed
@alec-flowers alec-flowers deleted the aflowers/kv-events-config-update branch August 21, 2025 23:55
hhzhang16 pushed a commit that referenced this pull request Aug 27, 2025
KrishnanPrash pushed a commit that referenced this pull request Sep 2, 2025
nnshah1 pushed a commit that referenced this pull request Sep 8, 2025
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