Description
The setup wizard treats model discovery as successful whenever fetchModels() resolves. It does not handle a successful response that contains zero models.
For OpenAI-compatible and Cohere providers, an empty model array can be returned without an HTTP/protocol error, but promptModel() immediately feeds the empty array into the interactive select() prompt. There is no manual-model fallback unless fetchModels() throws.
Location
src/commands/init.ts:161-184 — promptModel()
src/providers/openai-compatible.ts:99-123 — fetchModels()
src/providers/cohere.ts — fetchModels()
Relevant code
models = await fetchModels(...);
// no empty-list check
...
const selectedModel = await select({
message: 'Select a model:',
options: models.map((model) => ({ value: model, label: model })),
initialValue: existingConfig?.model,
});
The catch branch that provides Enter model name manually: runs only when fetchModels() rejects.
Steps to Reproduce
- Configure an OpenAI-compatible or Cohere endpoint whose model-list request returns HTTP 200 with an empty array.
- Run
commit-echo init.
- Model discovery reports success.
- The setup wizard then attempts to display a model selection prompt with no options instead of asking for a model name.
Expected Behavior
An empty model list should fall back to the existing manual model-entry flow.
Actual Behavior
The wizard reaches an empty select() options array and cannot proceed normally through model selection.
Suggested Fix
Treat models.length === 0 as a discovery failure (or a distinct empty-result state) and invoke the manual model prompt. Add tests for HTTP 200 empty model lists for every provider that performs model discovery.
Impact
Provider endpoints that do not expose a populated model catalogue can make the primary init setup wizard unusable even though the endpoint itself is reachable and otherwise compatible.
Reviewed against current main at 6c01ad0a853501e9617a3af0a5db3b515dd8ed53.
Description
The setup wizard treats model discovery as successful whenever
fetchModels()resolves. It does not handle a successful response that contains zero models.For OpenAI-compatible and Cohere providers, an empty model array can be returned without an HTTP/protocol error, but
promptModel()immediately feeds the empty array into the interactiveselect()prompt. There is no manual-model fallback unlessfetchModels()throws.Location
src/commands/init.ts:161-184—promptModel()src/providers/openai-compatible.ts:99-123—fetchModels()src/providers/cohere.ts—fetchModels()Relevant code
The catch branch that provides
Enter model name manually:runs only whenfetchModels()rejects.Steps to Reproduce
commit-echo init.Expected Behavior
An empty model list should fall back to the existing manual model-entry flow.
Actual Behavior
The wizard reaches an empty
select()options array and cannot proceed normally through model selection.Suggested Fix
Treat
models.length === 0as a discovery failure (or a distinct empty-result state) and invoke the manual model prompt. Add tests for HTTP 200 empty model lists for every provider that performs model discovery.Impact
Provider endpoints that do not expose a populated model catalogue can make the primary
initsetup wizard unusable even though the endpoint itself is reachable and otherwise compatible.Reviewed against current
mainat6c01ad0a853501e9617a3af0a5db3b515dd8ed53.