fix: github_copilot_sdk.py - prioritize BYOK_MODELS over API fetch when explicitly configured#71
Merged
Conversation
Comment on lines
+8137
to
+8144
| if effective_models.strip(): | ||
| model_list = [ | ||
| m.strip() for m in effective_models.split(",") if m.strip() | ||
| ] | ||
| await self._emit_debug_log( | ||
| f"BYOK: Using user-configured BYOK_MODELS ({len(model_list)} models)." | ||
| ) | ||
| elif effective_base_url: |
There was a problem hiding this comment.
The current logic checks effective_models.strip() to decide whether to skip the API fetch. However, if effective_models contains only delimiters (e.g., ", ,"), model_list will be empty, yet the API fetch will still be skipped because the condition is truthy. It is more robust to parse the models first and only skip the API fetch if the resulting list is non-empty.
model_list = [m.strip() for m in effective_models.split(",") if m.strip()]
if model_list:
await self._emit_debug_log(
f"BYOK: Using user-configured BYOK_MODELS ({len(model_list)} models)."
)
elif effective_base_url:
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.
Summary
BYOK_MODELSover API fetch when explicitly configured — if a user setsBYOK_MODELS, the plugin now uses that list directly and skips the/modelsAPI call toBYOK_BASE_URLBYOK_MODELSonly after API fetch failedBehavior Change
BYOK_BASE_URLsetBYOK_MODELSon failureBYOK_MODELSfirst, API fetch skippedBreaking change for users who have both
BYOK_BASE_URLandBYOK_MODELSconfigured: the dynamic model list from API fetch will no longer be used. If you want the API-fetched list, clearBYOK_MODELS.Test Plan
BYOK_BASE_URL— verify models are fetched via API as beforeBYOK_MODELSandBYOK_BASE_URL— verifyBYOK_MODELStakes precedence