Skip to content

fix(models): key-rejected hint on model-list 401 + refresh bundled catalogs (fixes #269) - #271

Merged
ltmoerdani merged 1 commit into
mainfrom
fix/issue269-models-401-hint
Oct 27, 2026
Merged

ltmoerdani merged 1 commit into
mainfrom
fix/issue269-models-401-hint

Conversation

@ltmoerdani

Copy link
Copy Markdown
Owner

What

Fixes #269.

Two changes:

  1. 401 hint. The /models endpoints are a public catalog: anonymous requests get 200, an invalid Authorization: Bearer gets 401 (verified live on both gateways, deterministic across repeats). A 401 there always points at the stored key, so ModelListFetcher now detects the Model list request failed (401) shape and logs an actionable hint next to the fallback notice:

    [fetchModels] OpenCode Go: the stored API key was rejected (401). Update or clear it via "OpenCode Go: Manage Provider" — requests will keep failing until then.
    

    401 stays non-transient (one attempt, no retry) and the retry.ts classifier is untouched. The hint also fires when a fresh cached snapshot absorbs the failure, since the root cause is the same.

  2. Bundled catalog refresh (the offline fallback was a 2026-09-08 snapshot):

    • Go: 27 → 38 models, mirroring the live catalog on 2026-10-27. Adds deepseek-v4.1-flash (the model the reporter couldn't find), gpt-6-luna, grok-4.7, kimi-k3.1-pro, mimo-v2.6-flash/pro, step-5-preview, beam-free, claude-haiku-5-5, gemini-4-argon, minimax-m2.5, minimax-m3.1-flash, iceman-contributor-free. Drops deepseek-v4-flash and deepseek-v4-flash-vision-exp (dead upstream on Go; the plain id still appears on Zen, so it is deliberately not blocklisted).
    • Zen: 42 → 72 models, live catalog minus the policy-hidden free tier, the non-chat jev-* decision API, and junk entries (test, claude-opus-5-5-backup).

Forensics from the issue

The reporter's Zen log filters exactly 38 models, which matches the pre-#266 freeOnly keep-free filter rather than current main. Their session was running pre-0.7.10 code (VS Code swaps extensions only on reload). On current main the fallback shows stale models instead of a nearly-empty picker; the stale catalog was the problem either way. Details in docs/issues/117-20261027-issue269-models-401-hint-and-bundled-refresh.md.

Verification

  • npm run compile clean
  • npm test 561/561 (2 new tests in src/test/modelList401Hint.test.ts)
  • npm run lint 7/7
  • Live probes: both /models endpoints anonymous 200 / invalid bearer 401, ×3

…talogs (fixes #269)

The /models endpoints are a public catalog (anonymous 200; invalid bearer
401, verified live on both gateways), so a 401 there always means the
stored key was rejected - never a list/gateway problem. Log an actionable
hint pointing at Manage Provider; 401 stays non-transient (one attempt).

Bundled fallbacks refreshed to the live gateway catalogs (2026-10-27):
Go 27 -> 38 (adds deepseek-v4.1-flash etc, drops dead deepseek-v4-flash /
-vision-exp - plain id still live on Zen, not blocklisted), Zen 42 -> 72
(live minus policy-hidden free tier, non-chat jev-*, junk ids).

2 new tests (561/561). Docs: docs/issues/117-20261027.
@ltmoerdani
ltmoerdani merged commit e959a86 into main Oct 27, 2026
2 checks passed
@ltmoerdani
ltmoerdani deleted the fix/issue269-models-401-hint branch October 27, 2026 02:37
ltmoerdani added a commit that referenced this pull request Oct 27, 2026
…DME row

Architecture map: modelList 185→235, definitions 238→364 (PR #271), new modelList401Hint.test row. Devlog: issue #269 entry with forensics and merge state. README: the freeOnly settings row still described the setting as functional — it has been deprecated and ignored since #265/#266 (0.7.10). Issue doc 117: PR #271 link + merge commit in Related.
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.

[BUG] fetchModel return 401 request failed

1 participant