Skip to content

/models command returns only partial model list — missing pagination support #6009

Description

@nsfoxer

Description

The /models command and background catalog refresh issue a single GET /v1/models request without handling OpenAI-style cursor pagination (has_more / after), so only the first page of results is returned. When a provider has more models than the default page size, most models are silently dropped.

Steps to reproduce

  1. Configure a provider with a large model roster (e.g. OpenCode Go)
  2. Run /models or codewhale models
  3. Observe that the returned list is much shorter than the provider actually offers

Expected behavior

All available models from the provider are listed.

Actual behavior

Only the first page (~10–20 models) is returned; remaining models are missing.

Impact

Always happens for providers whose model count exceeds one page. Most models are unavailable for selection.

Environment

  • OS: Windows 11
  • codewhale version: 0.9.13
  • Install method: source build
  • Model/provider: OpenCode Go (and any provider with > default page size)
  • Terminal app: Windows Terminal
  • Shell: PowerShell

Logs, screenshots, or recordings

Relevant code in crates/tui/src/client.rs:

  • ModelsListResponse struct (~line 3319) only has a data field — missing has_more and last_id
  • list_models() (~line 2432) and fetch_catalog_delta() (~line 2514) both issue a single request with no pagination loop

OpenAI /v1/models paginated response shape:

{
  "object": "list",
  "data": [...],
  "has_more": true,
  "last_id": "model-xxx"
}

When has_more is true, the client must request the next page with ?after=<last_id> until has_more becomes false.

Activity

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 working

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions