Fix: Flux.2 reference images presented in random order#96
Merged
lstein merged 2 commits intolstein/feature/reorder-ref-imagesfrom Feb 27, 2026
Merged
Conversation
Items directly connected to a CollectInvocation were previously sorted by (iteration_path, source_node_id). Since source_node_id is a random UUID, this caused non-deterministic ordering for non-iterated direct connections (e.g. Flux.2 reference images). Fix: use insertion index as the secondary sort key instead of source_node_id, preserving the left-to-right visual order from the frontend. Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix random order of reference images in Flux.2 models
Fix: Flux.2 reference images presented in random order
Feb 27, 2026
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
CollectInvocationitems were sorted by(iteration_path, source_node_id)when building the collection. For non-iterated direct connections (the common case for Flux.2 reference images), all items share the same empty iteration path, making the secondary sort fall back tosource_node_id— a random UUID — producing non-deterministic ordering on every run.Fix: Replace
source_node_idas the tiebreaker with the edge's insertion index ininput_edges. Edges are appended in the order they're added to the graph, which reflects left-to-right visual order from the frontend.Related Issues / Discussions
QA Instructions
Merge Plan
Checklist
What's Newcopy (if doing a release after this PR)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.