Skip to content

[BUG] Ollama model refresh stuck in loading, silently fails on errors, and uses stale base URL #877

Description

@navedmerchant

Describe the bug

When using the Ollama provider in the settings panel, the "Refresh Models" flow has several problems:

  1. Stuck loading state: The requestOllamaModels handler in the extension only posts an ollamaModels message back to the webview when models are found (Object.keys(ollamaModels).length > 0). When no models are returned — or when the fetch throws an error — no response is ever sent, so the webview stays stuck in a perpetual "loading" state with no feedback to the user.

  2. Silent failures on fetch errors: When the Ollama fetch fails (e.g. Ollama isn't running, wrong base URL, connection refused), the handler catches the error and silently logs it with console.debug. The user sees no error message and has no idea why the refresh produced no models.

  3. Stale base URL used for refresh: The refresh always uses the saved ollamaBaseUrl / ollamaApiKey from extension state, ignoring any unsaved edits the user has made in the settings form. If a user types a new base URL and clicks refresh before saving, the refresh queries the old URL — producing confusing results.

  4. No dedicated refresh button / status feedback: The Ollama settings panel has no visible refresh button with loading, success, or error status indicators, so users cannot tell whether a refresh is in progress, succeeded, or failed.

To Reproduce

Steps to reproduce the behavior:

  1. Open the Zoo Code settings panel and select the Ollama provider.
  2. Enter a base URL for an Ollama instance that is not running (or enter an incorrect URL).
  3. Trigger a model refresh (the panel refreshes models on mount / provider switch).
  4. Observe that no models appear and there is no error message or loading indicator — the panel gives no feedback at all.
  5. Edit the base URL to a correct value but click refresh before saving the setting.
  6. Observe that the refresh still queries the old (saved) URL, not the one currently typed in the form.

Expected behavior

  • The refresh should always post a response back to the webview, even when no models are found or the fetch errors, so the UI can transition out of the loading state.
  • Fetch errors should be logged to the output channel and the error message should be surfaced in the settings panel so the user understands why no models were returned.
  • The refresh should use the base URL and API key currently entered in the form (unsaved edits), not the stale saved state, so the user can validate a URL before committing it.
  • The Ollama panel should have a dedicated refresh button with visible loading / success / error status feedback.

Screenshots

N/A — the bug is about missing feedback and stale state, not a visual rendering issue.

Video

N/A

What version of zoo are you running

3.66.0

Additional context

The root cause is in the requestOllamaModels case of webviewMessageHandler.ts and the Ollama.tsx settings component. The handler silently swallows errors and conditionally suppresses empty responses, while the component relies on useEvent from react-use with no refresh status state machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions