[Bug] Cohere model discovery treats schema-invalid 200 responses as a valid hardcoded catalogue · Issue #337 · 404-PF/commit-echo · GitHub
Skip to content

[Bug] Cohere model discovery treats schema-invalid 200 responses as a valid hardcoded catalogue #337

Open

Description

@404-Page-Found

Description

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

  1. Run commit-echo init and select Cohere.
  2. 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.
  3. Continue through model discovery.
  4. 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

  1. added
    bugSomething isn't working
    p1High priority; blocks core functionality
    on Sep 24, 2026
  2. added this to the v0.4.0 milestone on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1High priority; blocks core functionality

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions