fix(media): parallel combo fan-out for image and video strategies - #13852
Merged
diegosouzapw merged 3 commits intoSep 29, 2026
Merged
diegosouzapw merged 3 commits into
diegosouzapw merged 3 commits into
Conversation
The parallel fan-out in executeImageCombo is correct and kept as-is. The same commit had removed runImageComboTargets, ImageComboTarget, ImageComboDispatchResult and RunImageComboTargetsOptions from imageCombo.ts entirely, but src/app/api/v1/images/edits/route.ts (not touched by this PR) still imports and calls exactly those symbols (runImageComboTargets, ImageComboDispatchResult) for its own combo fallback loop (diegosouzapw#12547) -- a TS2305 build-time break on /v1/images/edits. Restoring the shared sequential loop verbatim alongside the new parallel executeImageCombo() so both paths keep working unchanged. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw
merged commit Sep 29, 2026
11719f5
into
diegosouzapw:release/v3.8.51
9 of 16 checks passed
diegosouzapw
added a commit
that referenced
this pull request
Sep 29, 2026
…13852 image fan-out) Maintainer decision for the v3.8.51 release: the parallel image fan-out from #13852 dispatched (and billed) every leg on every request, even when the first target answered healthily — exactly what the #12982 regression test guarded. imageCombo.ts goes back to the shared runImageComboTargets loop (the next leg runs only after the previous one fails), the #12982 'valid first-leg response does not invoke later legs' test is restored unchanged, and the #13852 test that asserted concurrent image dispatch is dropped with the behavior it covered. The video fan-out from #13852 is untouched.
diegosouzapw
added a commit
that referenced
this pull request
Sep 29, 2026
…p, command-code none, contract drift) (#15111) Release-captain base-red fix (v3.8.51 release PR #11442, unit shards 7-8): two production defects (GPT-5.1+ sampling stripped by a static rule from #14133; Command Code 'none' effort clamped although #14692 routes Responses bodies that accept it) plus contract propagations; image combos restored to sequential priority per the maintainer's decision (the #13852 image fan-out billed every leg on every request). Focused suites green, typecheck clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Image and video combo strategies ran targets sequentially — a slow first target (e.g. AI Horde queue exhaustion, a provider that only fails after its full timeout) blocked every healthy sibling behind it. Both now fan out all targets concurrently via
Promise.raceagainstPromise.allSettled, so the first success wins immediately without waiting for slower siblings to finish. Terminal errors (400/401/403) surface when every target fails.Changes
open-sse/services/imageCombo.ts— replaced sequentialrunImageComboTargetsloop with a concurrentrunTargetfan-out +Promise.race([firstSuccess, Promise.allSettled(tasks)]); first healthy success picks the winner, terminal errors surface last; addedoptions?.generateImagefor test injection; dropped the now-unusedtargetModelbinding (lint gate).open-sse/services/videoCombo.ts— same parallel fan-out pattern; preserved per-target prompt-optional (I2V) and credential-resolution variants.tests/unit/combo/image-combo.test.ts— new test asserting parallel fan-out completes well before a slow first target's failure window.changelog.d/fixes/media-combo-parallel-fanout.md— changelog fragment.Test results
node --import tsx/esm --test tests/unit/combo/image-combo.test.ts— 10/10 pass.Split out of #13098 per review feedback (the
call_logspid-id fix is now its own PR, #13851).@diegosouzapw