fix(http): enhance fetch_versions to to fallback to config for tool options#7655
Merged
fix(http): enhance fetch_versions to to fallback to config for tool options#7655
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the HTTP backend's fetch_versions method to fallback to tool options from config files when the BackendArg.opts is empty. This addresses an issue where commands like ls-remote don't have options populated in the BackendArg, preventing remote versions from being fetched when version_list_url is only defined in config files.
Changes:
- Added a new
get_tool_optsmethod toConfigto retrieve tool options from the tool request set - Modified
fetch_versionsin the HTTP backend to accept aConfigparameter and fallback to config options when BackendArg options are empty - Updated
_list_remote_versionsto pass the config tofetch_versions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/config/mod.rs | Added imports for BackendArg and ToolVersionOptions; implemented get_tool_opts method to retrieve options from config |
| src/backend/http.rs | Modified fetch_versions to accept config parameter and implement fallback logic for empty opts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ptions in context of certain commands like `ls-remote` the `BackendArg.opts` might be empty which leads to remote versions not being fetched due to missing `version_list_url`.
Owner
|
bugbot run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In context of certain commands like
ls-remotetheBackendArg.optsmight be empty which leads to remote versions not being fetched due to missingversion_list_url.This is not the case for tools defined in the registry as those are explicitly serve as base options in
BackendArgbefore overridden by user defined tool options (not including configuration).Not sure if or how we could move this logic down to
BackendArggiven the async nature ofConfig.Also see discussion #7641
Note
Ensures HTTP backend can list remote versions even when
BackendArg.optslacksversion_list_urlby falling back to config-defined tool options.HttpBackend::fetch_versionsto acceptConfigand resolve options fromconfig.get_tool_optswhenversion_list_urlis missing_list_remote_versionsto passconfigintofetch_versionsConfig::get_tool_optsto retrieveToolVersionOptionsfor a givenBackendArgls-remoteworks without a registry by defining anhttp:zmxtool inmise.tomland clearing cacheWritten by Cursor Bugbot for commit fd8bdf4. This will update automatically on new commits. Configure here.