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).
This commit is contained in:
@@ -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<typeof createOpencodeClient>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user