Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

The model metadata fetcher cleared its cache when the server returned an empty but successful response, leaving users without available models during transient failures.

Changes

  • Guard against empty responses: Skip cache updates when data.length === 0 and existing models are present
  • Reset fetch timer: Set _lastFetchTime = 0 on empty responses to enable immediate retry instead of waiting 10 minutes
  • Log warning: Added diagnostic logging when preserving cache due to empty response

Implementation

const data: IModelAPIResponse[] = (await response.json()).data;

// Preserve last-known-good cache if server returns empty list
if (data.length === 0 && this._familyMap.size > 0) {
	this._logService.warn(`Server returned empty model list, preserving existing cache ${requestId}`);
	this._lastFetchTime = 0;  // Allow immediate retry
	return;
}

// Build and swap in new maps...

This follows the existing pattern for rate-limit handling at line 260.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 30, 2026 00:39
Added a check to prevent clearing the model cache when the server returns an empty but successful response. This ensures the last-known-good cache is preserved during transient server issues or misconfigurations, similar to the existing rate-limit protection.

Co-authored-by: zhichli <57812115+zhichli@users.noreply.github.com>
When the server returns an empty model list, reset _lastFetchTime to 0 to allow retrying sooner rather than waiting the full 10-minute refresh interval. This ensures users don't get stuck with stale data during temporary server issues.

Co-authored-by: zhichli <57812115+zhichli@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on model metadata cache refresh implementation Preserve model cache on empty server responses Jan 30, 2026
Copilot AI requested a review from zhichli January 30, 2026 00:45
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.

2 participants