Fix an issue with regional guidance and multiple quick-queued generations after moving bbox #8613
+49
−1
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.
The way this issue manifested for me was that every time i would move the bbox in the canvas and generate, the first couple generations would ignore the regional guidance completely, and then after those first couple, everything worked as expected and regional guidance was included. I looked into it a bit more and realized it only happened when i quickly queued up a few generations at once by clicking rapidly - if I clicked 3 times, the first 2 would ignore the regional layers and the 3rd image generation worked correctly.
What seems to be happening is:
After moving the canvas bbox, Invoke still handed out the previous regional-guidance mask because only two parts of the system knew anything had changed. The adapter’s cache key doesn’t include the bbox, so the next few graph builds reused the stale mask from before the move; if the user queued several runs back‑to‑back, every background enqueue except the last skipped rerasterizing altogether because another raster job was still in flight.
The fix makes the canvas manager invalidate each region adapter’s cached mask whenever the bbox (or a related setting) changes, and, if a reraster is already running, queues up and waits instead of bailing. Now the first run after a bbox edit forces a new mask, and rapid-fire enqueues just wait their turn, so every queued generation gets the correct regional prompt.
I don't know if this is the best way to fix this, but I figured it'd be helpful to post the bug investigation info and a fix that at least worked for me. I did use Codex to help investigate/write the fix, but I looked through the changes and associated code and nothing seems obviously wrong to me, at least.