Skip to content

fix(providers): show save errors and flag model ids after an API format change - #175

Merged
GoDiao merged 1 commit into
mainfrom
fix/provider-form-errors
Oct 24, 2026
Merged

GoDiao merged 1 commit into
mainfrom
fix/provider-form-errors

Conversation

@GoDiao

@GoDiao GoDiao commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Follow-up to #159.

What changed

  • Provider form shows save errors. When the server rejects a save (for example a 400), the form now shows the server's message next to the buttons and stays open. Before, the error only went to console.error, so Save looked like it did nothing. This was already the case on main.
  • Model discovery keeps 400 for upstream client errors. feat(providers): support arbitrary model lists and optional fast models #159 ended up mapping every discovery failure to 502, because our review asked for that by mistake. An upstream 4xx (such as a wrong API key) returns 400 again; other failures return 502. Both keep the MODEL_DISCOVERY_FAILED code.
  • Hint after an API format change. When the API format changes while the model list has entries, the form suggests fetching models again. Some providers return different ids per format: OpenRouter lists nvidia/nemotron-3-ultra-550b-a55b:free for OpenAI requests and anthropic/nvidia/nemotron-3-ultra-550b-a55b:free[1m] for Anthropic requests, and an id from one format fails with 400 in the other. The hint goes away after a successful fetch or when the format is changed back. The list itself is not changed.
  • CHANGELOG. Adds the missing entry for feat(providers): support arbitrary model lists and optional fast models #159, including that the migrated providers.json can't be read by older versions and the providers.json.bak-before-migration-* backup must be restored before downgrading.

How it was tested

  • New tests: a rejected save shows the error and keeps the modal open, then a retry closes it; an upstream 401 returns 400 and an upstream 503 returns 502; the format-change hint appears and clears after a fetch. The save-error, 401 and hint tests fail without the change; the 503 test also passes before it and guards against a regression.
  • bun run lint and the desktop tests pass (1259 passed). bun test: 1357 passed; the 10 failures locally are the ripgrep-dependent tests, because ripgrep isn't on PATH on this machine. CI installs it.
  • Manually in the dev app with an isolated config dir and a copy of a real pre-feat(providers): support arbitrary model lists and optional fast models #159 providers.json (OpenRouter): migration, editing and saving, model discovery in both formats, chatting with the OpenAI Chat and Anthropic formats, and the format-change hint.

…at change

- The provider form shows the server's error when a save is rejected and
  stays open, instead of a Save button that does nothing.
- Model discovery returns 400 again when the upstream rejects the request
  (4xx) and 502 for other failures.
- Changing the API format while the list has models shows a hint to fetch
  models again, since providers like OpenRouter return different ids per
  format.
@GoDiao
GoDiao force-pushed the fix/provider-form-errors branch from 2ce22d5 to c29388f Compare October 24, 2026 19:37
@GoDiao
GoDiao merged commit 3928782 into main Oct 24, 2026
4 checks passed
@GoDiao
GoDiao deleted the fix/provider-form-errors branch October 24, 2026 19:42
@GoDiao GoDiao mentioned this pull request Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant