Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
First review of this model-cache recovery fix (1 commit, 2 files).
get_cachedpreserves stale data on failure (lua/CopilotChat/client.lua:83-91) — anilfrom the filler now returns any previously cached value and leaves_expires_atuntouched, so the entry stays expired and is refetched on the next call instead of caching an empty result for the full 5-minute TTL. Because the innercacheis a plain table (not thedefaulttablewrapper),cache[key] or {}does not auto-vivify and_expires_atis only ever written alongsidecache[key], so the_expires_at > nowcomparison can't be reached with anil/table value.Client:modelsreports failure asnil(lua/CopilotChat/client.lua:243-255) — the auth-failure andget_models-failure branches nowreturn nil, and anilprovider result is passed through unchanged, engaging the recovery path. Genuinely successful empty lists are still cached.- New regression suite (
tests/client_spec.lua) — 243 lines covering first-fetch caching, retry after auth/model-fetch failure, the expiry boundary, stale preservation then recovery, preservation when auth refresh fails, persistent-failure retry without an internal loop, genuine empty-list caching, nil provider result not cached, independent per-provider caching, and an end-to-endautorecovery after an invalid JSON response.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Failed model discovery is cached as an empty list for five minutes,
hiding available models and replacing previously successful results.
Fix
This fixes failure caching, not the underlying invalid API response.
Tests
11 regression tests added; eight fail without the fix.
All 102 tests, StyLua, and whitespace checks pass.
Auto chat manually verified, including after restarting Neovim.
Related: #1343 also changes discovery error handling; this approach preserves
cached models and allows other providers to remain usable.