You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Cohere model discovery treats schema-invalid 200 responses as a valid hardcoded catalogue #337
CohereProvider.fetchModels() treats any successful JSON response without a models array as a successful model-discovery result and silently substitutes a hardcoded list.
That means an HTTP 200 response with an unexpected schema, proxy-generated JSON, or an API-version mismatch is reported by init as successful discovery even though the provider did not return a catalogue.
Location
src/providers/cohere.ts — fetchModels()
src/commands/init.ts — model prompt and discovery handling
Steps to Reproduce
Run commit-echo init and select Cohere.
Point the endpoint or a test fixture at a server that returns HTTP 200 with a JSON body such as {} or another schema without models.
Continue through model discovery.
Observe that the wizard offers the hardcoded model list rather than falling back to manual entry or reporting a discovery problem.
Expected Behavior
An unexpected successful response should be treated as discovery failure. The wizard should either surface the schema mismatch or use the existing manual model-entry path.
Actual Behavior
The command silently invents a model catalogue from hardcoded defaults and proceeds as though discovery succeeded.
Suggested Fix
Validate the response schema. If models is absent or malformed, throw a provider-discovery error and let promptModel() use its manual model fallback. Keep fallback behavior explicit rather than silently substituting an unrelated catalogue.
Add a regression test for an HTTP 200 schema mismatch.
Impact
Users can be guided into invalid or obsolete Cohere model configurations while the setup wizard reports successful discovery. This also masks provider or API-version compatibility problems.
Reviewed against current main at 131c914195ec863197197eec024558012c03240d659.
Activity