Repository navigation
feat(gallery): reveal external generations that opt in with gallery:reveal - #9879
Open
lstein wants to merge 1 commit into
Conversation
…eveal Completed items enqueued with destination "gallery:reveal" by another client select their board and last saved image in a visible tab, standing down whenever the user is busy or has navigated; hidden tabs defer until shown. Image-map cluster selections hold a locator request so reveals never supersede them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Stacked on #9876, which makes the gallery refresh when another client (e.g. a chatbot using the REST API) completes a generation for the signed-in user. This PR lets such a client ask for its result to be shown.
An external client opts in by enqueuing with
destination: "gallery:reveal"(POST /api/v1/queue/default/enqueue_batch). When such an item completes for the signed-in user (any user in single-user mode), with a non-web-UI origin and not as a workflow-call child, a visible tab selects the board of the item's last saved (non-intermediate) image and then the image, through the same path as Find in Gallery. Preview follows the selection and the grid scrolls to it; a polite live-region message announces it once.destination: "gallery"stays refresh-only, because the legacy UI sends it for its own workflow and upscale runs.The reveal never takes the Gallery from the user. It stands down when the user is typing (window focused and an editable field focused), the active project has an open run in this tab, a text or semantic search is active, more than one item is selected, a Find in Gallery or image-map selection is in flight, or the Gallery navigation changed since the completion arrived. These are checked again immediately before the first Gallery change. The newest completion wins. A hidden tab defers the newest request and re-evaluates everything when shown.
Image-map cluster selections now hold a gallery locator request while resolving, so nothing can supersede them mid-flight.
The contract for external clients is documented in
features/gallery/README.md("Realtime refresh and external reveal").Related Issues / Discussions
Stacked on #9876.
QA Instructions
pnpm check:release(ininvokeai/frontend/webv2): passes. Run on Node 24.18.0 (.nvmrcpins 22.14.0). Two browser tests were flaky in earlier runs and passed on rerun:ConceptRow.browser.test.tsx(also flaky on unmodifiedmain) andGalleryImageGrid.browser.test.tsx(failed once while files were being edited; passed 3/3 in isolation and in the final full run).blank_imagegraph (is_intermediate: false, optionalboard) withorigin: "external:test":destination: "gallery:reveal": the image's board and the image are selected, including after browsing to another board, and with focus left in a prompt field while the script runs in another window;Review
Resolved: the opt-in originally reused
"gallery", which the legacy UI also sends, so it now has its own value. The reveal could override user navigation or cancel an in-flight Find in Gallery; it now captures the navigation state on arrival, never supersedes, and checks again right before mutating. Active searches and multi-selections were overwritten; the reveal now stands down for both. Bursts could reveal an older item; newest-wins is now enforced. The result read fetched more than needed and now stops at the first saved image. Failures were silent and are now logged. The announcement was sticky and is now one-shot. Hidden tabs dropped reveals and now defer them. An over-strict typing check is fixed. A cluster-selection race is closed.Known limitations, documented in the README:
parent_item_id, so a workflow-call child completion supersedes an in-flight reveal before it is identified as a child.Checklist
What's Newcopy (if doing a release after this PR)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.