Skip to content

[Bugfix][KVConnector] Fix MultiConnector bypassing compat shim for legacy child connectors#40702

Open
KrxGu wants to merge 1 commit intovllm-project:mainfrom
KrxGu:fix/40690-multiconnector-compat-shim
Open

[Bugfix][KVConnector] Fix MultiConnector bypassing compat shim for legacy child connectors#40702
KrxGu wants to merge 1 commit intovllm-project:mainfrom
KrxGu:fix/40690-multiconnector-compat-shim

Conversation

@KrxGu
Copy link
Copy Markdown
Contributor

@KrxGu KrxGu commented Apr 23, 2026

What's the problem?

MultiConnector.__init__ instantiates child connectors by calling connector_cls(config, role, kv_cache_config) directly. This means any child connector that still uses the pre-#27887 two-argument __init__(self, vllm_config, role) crashes with:

TypeError: __init__() takes 3 positional arguments but 4 were given

The same connector works fine at the top level because top-level construction goes through KVConnectorFactory.create_connector, which probes for kv_cache_config support and dispatches accordingly. MultiConnector skipped that path entirely.

Fix

Replace the direct connector_cls(...) call with KVConnectorFactory.create_connector(temp_config, role, kv_cache_config) so children get the same compat detection as top-level connectors. KVConnectorFactory was already imported in multi_connector.py - no new dependencies.

Tests

Added two regression tests to test_backwards_compatibility.py:

  • test_multiconnector_old_style_child_instantiation - a legacy 2-arg connector works as a MultiConnector child (raised TypeError before this fix)
  • test_multiconnector_new_style_child_unaffected - a modern 3-arg child still receives kv_cache_config correctly

Notes

  • The extra Creating v1 connector... log line per child is expected and informational.
  • The HMA check in create_connector is a no-op here because --kv-transfer-config disables the hybrid KV cache manager automatically.

Fixes #40690

Copilot AI review requested due to automatic review settings April 23, 2026 11:47
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added v1 bug Something isn't working kv-connector labels Apr 23, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses issue #40690 by ensuring that MultiConnector uses the KVConnectorFactory to instantiate child connectors. This change allows legacy connectors with two-argument constructors to function correctly as children within a MultiConnector. Additionally, regression tests have been added to verify compatibility for both old-style and new-style connectors. I have no feedback to provide.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes MultiConnector child instantiation to use the same backwards-compat constructor shim as top-level KV connector creation, preventing legacy 2-arg connectors from crashing when used as children.

Changes:

  • Route MultiConnector child creation through KVConnectorFactory.create_connector(...) instead of calling the child class directly.
  • Add regression tests covering legacy (2-arg) and modern (3-arg) child connectors inside MultiConnector.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
vllm/distributed/kv_transfer/kv_connector/v1/multi_connector.py Uses the factory for child connector creation so compat probing applies uniformly.
tests/v1/kv_connector/unit/test_backwards_compatibility.py Adds regression tests ensuring MultiConnector handles both legacy and new-style children correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread vllm/distributed/kv_transfer/kv_connector/v1/multi_connector.py Outdated
…ld connectors

MultiConnector was calling connector_cls(config, role, kv_cache_config) directly,
so any child connector still using the old 2-arg __init__(vllm_config, role) would
crash with TypeError even though the same connector works fine at the top level
(where it goes through the factory compat path).

Route child construction through KVConnectorFactory.create_connector instead.
The import was already there; no new dependencies added.

Fixes vllm-project#40690

Signed-off-by: KrxGu <krishom70@gmail.com>
@KrxGu KrxGu force-pushed the fix/40690-multiconnector-compat-shim branch from 9affd97 to 2a946dc Compare April 23, 2026 12:05
@KrxGu
Copy link
Copy Markdown
Contributor Author

KrxGu commented Apr 23, 2026

This PR is now ready for review and fixes the bug in question.

LGTM!!

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

Labels

bug Something isn't working kv-connector v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MultiConnector bypasses the deprecated-signature shim and breaks old-style child connectors

2 participants