fix: retry cloud model catalog sync when first account becomes active#206
Open
clarezoe wants to merge 1 commit into
Open
fix: retry cloud model catalog sync when first account becomes active#206clarezoe wants to merge 1 commit into
clarezoe wants to merge 1 commit into
Conversation
fetchAndMergeModelCatalog() was only called once at startup. If no active account existed at that moment, the cloud catalog sync was skipped entirely and never retried — meaning newly available upstream models (e.g. Claude Fable 5) wouldn't appear in /v1/models until a manual restart with an already-active account. Add _modelCatalogSynced flag + trySyncModelCatalog() fire-and-forget wrapper that coalesces concurrent calls. Call it from every account activation path: addAccountByKey, addAccountByToken, addAccountByEmail, setAccountStatus, resetAccountErrors, reportSuccess, and maybeRecoverErrorAccount. Co-Authored-By: Oz <oz-agent@warp.dev>
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
fetchAndMergeModelCatalog()was only called once at startup. If no active account existed at that moment, the cloud catalog sync was skipped entirely and never retried — meaning newly available upstream models (e.g. Claude Fable 5, redeployed 2026-07-01) wouldn't appear in/v1/modelsuntil a manual restart with an already-active account.Root Cause
In
src/auth.js,fetchAndMergeModelCatalog()runs once duringinitAuth(). It finds the first active account and, if none exists, logs'No active account for model catalog fetch'and returns. There is no retry path — accounts added later never trigger a re-sync.Fix
Add a
_modelCatalogSyncedflag and atrySyncModelCatalog()fire-and-forget wrapper that coalesces concurrent calls. Call it from every account activation path:addAccountByKey— adding API key accountaddAccountByToken— adding token accountaddAccountByEmail— email loginsetAccountStatus(id, 'active')— manual status changeresetAccountErrors— error reset recoveryreportSuccess— auto-recovery on successful requestmaybeRecoverErrorAccount— half-open recoverytrySyncModelCatalog()checks:_modelCatalogSynced) → skip_modelCatalogSyncPromise) → skipfetchAndMergeModelCatalog()in the backgroundVerification
Tested on production deployment. After restart with no active accounts at startup, adding the first account triggered the sync automatically:
Claude Fable 5 variants (
claude-5-fable-low/medium/high/xhigh/max) now appear in/v1/models.