Skip to content

fix(provider): cross-check models.dev deprecated status against gateway to prevent hiding live models - #185

Merged
ltmoerdani merged 3 commits into
ltmoerdani:mainfrom
Barragek0:patch-1
Aug 22, 2026
Merged

fix(provider): cross-check models.dev deprecated status against gateway to prevent hiding live models#185
ltmoerdani merged 3 commits into
ltmoerdani:mainfrom
Barragek0:patch-1

Conversation

@Barragek0

@Barragek0 Barragek0 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

📝 What does this change?

Closes #182

models.dev status: deprecated was hiding live models from the picker. laguna-s-2.1-free is live and working on the gateway but models.dev incorrectly marks it deprecated. The extension's shouldHideDeprecatedModel filter was hiding it unconditionally.

The fix cross-checks models.dev deprecated status against the live gateway response. shouldHideDeprecatedModel now only hides when both agree: models.dev says deprecated AND the gateway confirms the model is absent. Offline/fallback paths fail open (no live data → don't hide on stale metadata).

This preserves the original #3 protection (gateway can list broken models, models.dev deprecated catches them) while fixing #182 (gateway lists working models, stale models.dev falsely hides them).

Note on deepseek-v4-flash-free: The reporter's original example is actually an upstream problem — the gateway lists the model but requests fail with "Model is unavailable". Neither models.dev nor the gateway is a reliable source of truth for availability. Our fix correctly shows the model (gateway lists it) and surfaces the error clearly when it fails. The real fix for deepseek is upstream.

Files changed

File Change
src/provider/settings.ts shouldHideDeprecatedModel gains liveModelIds?: ReadonlySet<string> parameter; returns false when live set confirms the model is present or when no live data is available
src/provider/modelList.ts filterAvailableModels signature gains liveModelIds?; gateway fetch builds Set(ids) and passes it through
src/provider/OpenCodeProvider.ts filterAvailableModels threads liveModelIds to shouldHideDeprecatedModel; fetcher wiring updated
src/test/deprecatedFilter.test.ts 8 unit tests covering all branches (non-Zen vendor, not deprecated, absent status, offline fail-open, live gateway present, live gateway absent, agent-variant vendor, empty live set)
docs/issues/78-20260822-issue182-deprecated-model-gateway-crosscheck.md Full issue documentation with root cause, solution, verification matrix
CHANGELOG.md Added fix entry under [Unreleased]
ARCHITECTURE-MAP.md Updated model discovery step 3 description

Verification

Model Gateway models.dev Actually works? Before fix After fix
laguna-s-2.1-free ✅ listed deprecated ✅ Yes ❌ hidden ✅ shown
deepseek-v4-flash-free ✅ listed deprecated ❌ No (400) ❌ hidden ✅ shown*
ring-2.6-1t-free ❌ absent deprecated ❌ No ✅ hidden ✅ hidden
trinity-large-preview-free ❌ absent deprecated ❌ No ✅ hidden ✅ hidden

* Shown but fails at runtime — upstream issue, not solvable from extension side.

🧪 How did you test it?

  • npm run compile
  • npm run lint (6 checks) ✅
  • npm test (305+ unit tests including 8 new deprecatedFilter tests) ✅
  • npm run package ✅ (VSIX built)
  • Live gateway check: laguna-s-2.1-free confirmed working ✅
  • deepseek-v4-flash-free confirmed broken upstream (400 error) ✅

✅ Checklist

  • npm run compile passes
  • npm run lint passes
  • npm test passes
  • npm run package produces a VSIX
  • I tested it works
  • I updated docs/CHANGELOG if needed

@Barragek0

Barragek0 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

I've left a comment in the base issue that this PR closes explaining the issue further and why I think this PR is the right approach.

@Barragek0
Barragek0 marked this pull request as ready for review August 22, 2026 17:16
@Barragek0 Barragek0 changed the title Cross-check models.dev deprecated status against gateway to prevent hiding live models fix(provider): cross-check models.dev deprecated status against gateway to prevent hiding live models Aug 22, 2026
@ltmoerdani

Copy link
Copy Markdown
Owner

Clean fix. i went through the diff and the cross-check approach makes sense. keeping the #3 protection while un-hiding models the gateway still serves is the right call, and failing open when there's no live data is what i'd want too.

good catch on deepseek-v4-flash-free being upstream. saves us from chasing a bug we can't fix on our side.

one small thing, not a blocker. with fail-open, models that were previously hidden via stale deprecated flags will now show up in the fallback/offline path too. fallbackModels is a curated list so i think the impact is minimal, but wanted to note the trade-off in case someone hits it later.

tests cover all the branches, docs and changelog are in place, CI green. merging this as-is.

@ltmoerdani
ltmoerdani merged commit f0b3c04 into ltmoerdani:main Aug 22, 2026
2 checks passed
@Barragek0
Barragek0 deleted the patch-1 branch August 22, 2026 21:37
ltmoerdani added a commit that referenced this pull request Aug 23, 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.

[BUG] Deepseek does not show free models.

2 participants