From ff1b15d533fc60f6f85370ccd6770282f02e83de Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 16 May 2026 00:53:15 +0900 Subject: [PATCH] fix(model-suggestion-retry): release reservation before retry attempt After BLOCKER-2's post-dispatch hold landed (the gate now keeps the reservation through the hold window regardless of whether the dispatch threw), the synchronous retry path inside promptSyncWithModelSuggestionRetry hit 'reserved' on its own second attempt because the first attempt's post-dispatch hold was still active. The first attempt's failure is ProviderModelNotFoundError, which is a synchronous SDK rejection - the prompt never reached the server, so there is no durable session state worth protecting from a duplicate injection. Release the post-dispatch reservation hold explicitly before the suggested-model retry so the second attempt can dispatch immediately. Fixes test regression introduced by the gate hardening (BLOCKER-2 fix). --- src/shared/model-suggestion-retry.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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,