diff --git a/src/shared/model-suggestion-retry.ts b/src/shared/model-suggestion-retry.ts index ab0ab5365..19d2079f6 100644 --- a/src/shared/model-suggestion-retry.ts +++ b/src/shared/model-suggestion-retry.ts @@ -5,7 +5,11 @@ import { PROMPT_TIMEOUT_MS, type PromptRetryOptions, } from "./prompt-timeout-context" -import { promptAfterSessionIdle, promptAsyncAfterSessionIdle } from "./prompt-async-gate" +import { + promptAfterSessionIdle, + promptAsyncAfterSessionIdle, + releasePromptAsyncReservation, +} from "./prompt-async-gate" type Client = ReturnType @@ -169,6 +173,11 @@ export async function promptSyncWithModelSuggestionRetry( throw error } + // The first attempt failed synchronously with ProviderModelNotFoundError, which means the + // prompt did not reach the server. Release the post-dispatch reservation hold so the + // immediate retry can dispatch without waiting for the hold window to expire. + releasePromptAsyncReservation(args.path.id, "model-suggestion-retry:sync") + log("[model-suggestion-retry] Model not found, retrying with suggestion", { original: `${suggestion.providerID}/${suggestion.modelID}`, suggested: suggestion.suggestion,