Refactor remote plugin to accept multiply connector#2666
Refactor remote plugin to accept multiply connector#2666maobaolong merged 5 commits intoLMCache:devfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the remote storage capabilities of LMCache by refactoring its plugin system to support multiple, independently configurable remote storage connectors. This change moves away from a single Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
1bf5708 to
a4c0731
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the remote storage plugin system to support multiple connectors, deprecating the old remote_url in favor of a remote_storage_plugins list. The new system allows multiple instances of the same connector type and mixing different types. However, the implementation introduces critical security vulnerabilities related to arbitrary code execution and path traversal, stemming from dynamic loading of plugin modules from potentially untrusted configuration sources and the use of unvalidated filesystem paths for storage connectors. Additionally, there is a critical issue with the mooncakestore connector not correctly supporting multiple instances, and inconsistencies in the updated documentation need to be addressed to avoid user confusion.
cece3c0 to
3c158d9
Compare
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
3c158d9 to
560e317
Compare
|
@maobaolong Good job! A minor question, is these AI review comments make sense? if it not make sense, we can mark it as resolved. |
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
02b9678 to
4e653f6
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4e653f6. Configure here.
| loop=context.loop, | ||
| local_cpu_backend=context.local_cpu_backend, | ||
| config=context.config, | ||
| ) |
There was a problem hiding this comment.
DynamicConnectorAdapter omits plugin_name from connector creation
Medium Severity
DynamicConnectorAdapter.create_connector doesn't pass context.plugin_name to the dynamically loaded RemoteConnector class. This prevents custom RemoteConnector subclasses from resolving per-instance configuration (e.g., from extra_config), breaking multi-instance support for dynamic plugins, unlike builtin adapters.
Reviewed by Cursor Bugbot for commit 4e653f6. Configure here.
* Refactor remote plugin to accept multiply connector. Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Skip module_path/class_name check for built-in adapters Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Add document related Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Fix to use DynamicConnectorAdapter to load external connector plugin Signed-off-by: baoloongmao <baoloongmao@tencent.com> --------- Signed-off-by: baoloongmao <baoloongmao@tencent.com>


What this PR does / why we need it:
Special notes for your reviewers:
If applicable:
Note
Medium Risk
Touches remote connector selection and
RemoteBackendinitialization/reconnect paths; misconfiguration or adapter matching bugs could break remote storage connectivity, though legacyremote_urlremains supported.Overview
Adds first-class support for configuring multiple remote backends via
remote_storage_plugins, including instance-qualified names likefs.primary/fs.backup, and routes each entry to its ownRemoteBackend(usingplugin://...URLs internally).Extends the connector/plugin system to understand plugin naming (
extract_plugin_type,ConnectorContext.plugin_name), updates built-in adapters (fs,mooncakestore) andRemoteBackendto work in plugin mode while keeping legacyremote_urlworking with a deprecation warning, and allows dynamic plugins to specify either aConnectorAdapteror aRemoteConnectorvia a newDynamicConnectorAdapter. Docs and FS connector tests are updated to cover the new configuration patterns and multi-instance behavior.Reviewed by Cursor Bugbot for commit 4e653f6. Bugbot is set up for automated code reviews on this repo. Configure here.