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:
YeonGyu-Kim
2026-04-12 02:30:32 +09:00
parent aed8dbfa3e
commit c5c5bc36bc
4 changed files with 248 additions and 6 deletions
+15 -1
View File
@@ -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,
}
}