fix(delegate-task): consume fallback chain on sendSyncPrompt failure (#2691)
setSessionFallbackChain stored the fallback chain but the sync path never consumed it when sendSyncPrompt returned an error. Added a retry loop that iterates getNextFallback() until the prompt succeeds or the chain is exhausted, preserving the finally-block cleanup. 🤖 Generated with OhMyOpenCode assistance https://github.com/code-yeongyu/oh-my-opencode
This commit is contained in:
@@ -32,7 +32,16 @@ function createReachabilityChecker(state: ModelFallbackState): (entry: FallbackE
|
||||
export function getNextReachableFallback(
|
||||
sessionID: string,
|
||||
state: ModelFallbackState,
|
||||
): { providerID: string; modelID: string; variant?: string } | null {
|
||||
): {
|
||||
providerID: string
|
||||
modelID: string
|
||||
variant?: string
|
||||
reasoningEffort?: string
|
||||
temperature?: number
|
||||
top_p?: number
|
||||
maxTokens?: number
|
||||
thinking?: { type: "enabled" | "disabled"; budgetTokens?: number }
|
||||
} | null {
|
||||
const isReachable = createReachabilityChecker(state)
|
||||
|
||||
while (state.attemptCount < state.fallbackChain.length) {
|
||||
@@ -63,6 +72,11 @@ export function getNextReachableFallback(
|
||||
providerID,
|
||||
modelID,
|
||||
variant: fallback.variant,
|
||||
reasoningEffort: fallback.reasoningEffort,
|
||||
temperature: fallback.temperature,
|
||||
top_p: fallback.top_p,
|
||||
maxTokens: fallback.maxTokens,
|
||||
thinking: fallback.thinking,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user