fix: expand AUTODETECT for tabAutocompleteModel in JSON config path#12504
Open
riyonp23 wants to merge 1 commit into
Open
fix: expand AUTODETECT for tabAutocompleteModel in JSON config path#12504riyonp23 wants to merge 1 commit into
riyonp23 wants to merge 1 commit into
Conversation
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
4 tasks
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="core/config/load.ts">
<violation number="1" location="core/config/load.ts:379">
P2: AUTODETECT expansion logic is duplicated from the earlier `config.models` loop, and drift already exists between the two copies (e.g., the pre-existing CustomLLMClass shadowing bug in `config.models` is avoided here, but other behavioral differences like free-trial inline filtering remain). Extract a shared helper to prevent future regressions.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| return; | ||
| } | ||
|
|
||
| if (llm.model === "AUTODETECT") { |
Contributor
There was a problem hiding this comment.
P2: AUTODETECT expansion logic is duplicated from the earlier config.models loop, and drift already exists between the two copies (e.g., the pre-existing CustomLLMClass shadowing bug in config.models is avoided here, but other behavioral differences like free-trial inline filtering remain). Extract a shared helper to prevent future regressions.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At core/config/load.ts, line 379:
<comment>AUTODETECT expansion logic is duplicated from the earlier `config.models` loop, and drift already exists between the two copies (e.g., the pre-existing CustomLLMClass shadowing bug in `config.models` is avoided here, but other behavioral differences like free-trial inline filtering remain). Extract a shared helper to prevent future regressions.</comment>
<file context>
@@ -372,15 +372,75 @@ async function intermediateToFinalConfig({
+ return;
+ }
+
+ if (llm.model === "AUTODETECT") {
+ try {
+ const modelNames = await llm.listModels();
</file context>
e19c4ee to
effcdce
Compare
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.
Fixes #12400
Description
The JSON config path (
config.json) never expanded anAUTODETECTplaceholder intabAutocompleteModel. When users configuredmodel: "AUTODETECT"for autocomplete, the placeholder LLM went straight intomodelsByRole.autocompleteunchanged, causing Continue to send the literal string"AUTODETECT"to the provider at request time. The YAML config path was already handling this correctly.Fixed by mirroring the existing AUTODETECT expansion logic from the
config.modelsloop into thetabAutocompleteModelsblock incore/config/load.ts. Also exportedintermediateToFinalConfigfor testability.AI Code Review
@continue-reviewChecklist
Screen recording or screenshot
Not applicable — this is a backend config parsing fix with no UI changes.
Tests
Added
core/config/load.vitest.tswith 3 new cases:AUTODETECTexpands correctly — asserts noAUTODETECTentry remains inmodelsByRole.autocompleteand both expanded models are present withisFromAutoDetect: trueAUTODETECTconfig passes through unchangedlistModels()rejection — asserts theAUTODETECTplaceholder does not leak through andconsole.warnwas emittedAll 3 pass. Existing
core/config/yaml/models.vitest.ts(8 cases) still passes — YAML path unaffected.Note: While working on this I noticed a pre-existing unrelated bug in
load.ts:316–334—const models = modelNames.map(...)shadows the outermodels: BaseLLM[]in the CustomLLM AUTODETECT branch, so expanded models never reach the outer array. Left it untouched to keep this PR focused. Worth a separate issue.Summary by cubic
Fixes the JSON config path so
tabAutocompleteModelexpandsAUTODETECTinstead of sending the literal string to providers. Mirrors YAML behavior and adds coverage to prevent regressions.Bug Fixes
AUTODETECTfortabAutocompleteModelin the JSON path (built-in andCustomLLM), correctly populatingmodelsByRole.autocomplete.listModels()failure, drop the placeholder and warn, ensuring"AUTODETECT"never reaches a provider.Refactors
intermediateToFinalConfigfor testability.Written for commit effcdce. Summary will update on new commits. Review in cubic