fix(cli): surface invalid Kilo indexing.model as an error instead of silently falling back#12128
fix(cli): surface invalid Kilo indexing.model as an error instead of silently falling back#12128rakshith1928 wants to merge 9 commits into
Conversation
Throw a structured error when an explicit invalid indexing.model is set for the kilo provider so the misconfiguration is surfaced instead of silently falling back.
Catch the structured model error during indexing initialization and report it as an Indexing Error status so the invalid configuration is visible to the user.
Update the startup test to expect an Indexing Error status with the descriptive message when an explicit unsupported Kilo indexing model is configured.
Add a startup test asserting a configured valid Kilo indexing model is passed through to initialization without raising an error.
Documents the user-facing behavior change where an invalid Kilo indexing.model is surfaced as an indexing Error status instead of silently falling back.
| const cfgInput = await model(enrichKilo(input(merged, global), auth), auth) | ||
| let cfgInput: Awaited<ReturnType<typeof model>> | ||
| try { | ||
| cfgInput = await model(enrichKilo(input(merged, global), auth), auth) |
There was a problem hiding this comment.
[WARNING]: Disabled Kilo indexing can now report an error
Because cfgInput.enabled is not checked until the later disabled branch, this call validates the configured model even when indexing is disabled. A config such as { enabled: false, provider: "kilo", model: "removed/model" } now throws here and returns Error instead of the expected Disabled status, so disabling indexing no longer suppresses startup validation. Suggest short-circuiting disabled input before model() or bypassing explicit-model validation when enabled is false.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
There was a problem hiding this comment.
Thanks — this is now fixed. The IndexingModelError throw in model() was firing before the disabled check. Guarded it with input.enabled !== false so a disabled Kilo config with a bad explicit model falls through to the existing disabled branch and reports Disabled instead of Error.
- src/kilocode/indexing.ts: throw condition is now catalog.models.length > 0 && !chosen && input.enabled !== false
- Added new test: does not validate the indexing model when indexing is disabled ; no IndexingModelError logged
Also updated the PR body.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summaries (2 snapshots, latest commit bb4a71d)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit bb4a71d)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit ad2cc71)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Fix these issues in Kilo Cloud Files Reviewed (3 files)
Reviewed by gpt-5.6-sol · Input: 52.9K · Output: 3.8K · Cached: 216.7K Review guidance: REVIEW.md from base branch |
A disabled Kilo indexing config with an invalid explicit model previously threw IndexingModelError and surfaced an Error status, bypassing the disabled branch. Guard the throw with input.enabled so disabled configs are reported as Disabled as before.
marius-kilocode
left a comment
There was a problem hiding this comment.
Disabled indexing still resolves the Kilo model catalog before reaching the Disabled branch. The input.enabled !== false condition prevents IndexingModelError, but it does not prevent the fetch or other catalog-resolution errors.
I reproduced this with enabled: false and indexing.kilo.baseUrl: "not a url": expected Disabled, received Error. baseUrl is only validated as a string, and URL construction throws before the catalog helper can return its empty fallback. Disabled indexing also makes an unnecessary network request and can incur catalog retry delays.
Can we return before catalog resolution when indexing is disabled? The minimal change is:
if (input.embedderProvider !== "kilo" || !input.enabled) return inputThen the inner condition can become catalog.models.length > 0 && !chosen, which also removes the new boolean-comparison lint warning. Please add a regression test that makes catalog resolution throw, or asserts fetch is not called, while disabled and still reaches the Disabled status.
|
Thanks for the review I will look into this. |
Return early from model() when indexing is disabled so a disabled Kilo config no longer resolves the embedding model catalog (and its baseUrl) or surfaces a model-validation error. Adds a regression test asserting a disabled config with an invalid kilo.baseUrl reaches Disabled without calling fetch.
|
Done. model() now returns early when disabled, so no catalog fetch/URL error. Inner condition reverted to catalog.models.length > 0 && !chosen (no boolean-comparison lint warning). Added a regression test: disabled + bad kilo.baseUrl still reaches Disabled and fetch is never called. 19 tests pass; typecheck/lint clean. |
…validation # Conflicts: # packages/opencode/src/kilocode/indexing.ts
Issue
Fixes #12121
Context
When a user sets an invalid indexing.model for the Kilo embedding provider, Kilo previously silently fell back to the hosted default model (mistralai/mistral-embed-2312). This masked a real configuration mistake: the user believed a specific model was in use, but indexing actually ran on a different (default) model with no signal that the configured value was invalid.
The correct behavior is to surface the misconfiguration as an indexing Error status so the user sees exactly what's wrong (the offending model name) in the indexing panel/GET /indexing/status, instead of silently substituting a model.
Scope is limited to the Kilo provider. Other providers (mistral, openai, ollama, …) resolve their model at embedder request time and fail there with an API error, so they are intentionally left unchanged.
Implementation
Changes are all in packages/opencode/src/kilocode/indexing.ts:
Tradeoff to note: the error is swallowed in boot() deliberately (to keep init() resolving like the existing initialize-rejection path), so it's observed via the status message and a spy on the cached kilocode-indexing logger.
Screenshots / Video
N/A , no visual change beyond the existing indexing status text (state Error, message Failed to initialize: Invalid indexing.model)
Start │ Resolve model │ Find chosen │ ├── Found → Return │ └── Not found │ Warn │ ┌────┴────┐ │ │ default no default found (empty catalog) │ │ Use default Unset │ │ Return Return undefinedStart │ User configured model? │ ├── Yes │ │ │ Find model │ │ │ ├── Found → Return │ │ │ ├── Not found + catalog available │ │ │ │ │ ▼ │ │ Throw IndexingModelError │ │ │ └── Not found + catalog empty │ │ │ Fall through to default hunt │ └── No │ Find default model │ ├── Found → Return │ └── Not found │ Warn (if modelId/dimension set) │ Return modelId: undefined, modelDimension: undefinedHow to Test
Manual/local verification
Reviewer test steps
Blocked checks and substitute verification
Checklist
Get in Touch
@travix26 Discord