fix(multiuser): do not let progress status of one user's session leak into another's#9353
Open
lstein wants to merge 3 commits into
Open
fix(multiuser): do not let progress status of one user's session leak into another's#9353lstein wants to merge 3 commits into
lstein wants to merge 3 commits into
Conversation
In multiuser mode, invocation-complete events are emitted to the admin room as well as the owner's room so that admins' gallery caches stay fresh. The gallery auto-switch handler treated every received event as the current user's own generation, so an admin's selected board would jump to another user's board whenever that user generated an image. Gate the auto-switch (board + image selection) on the event's user_id matching the logged-in user. Cache updates (board totals, image name lists) still run for all received events. Single-user mode, where there is no current user, is unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Invocation progress events drive personal UI only (the global progress bar, the workflow editor's current-image node, the image viewer's progress image). Emitting them to the admin room made an admin's progress display animate and sawtooth in response to other users' generations. No admin-facing feature consumes other users' progress, so emit progress events to the owner's room only. The remaining invocation events (started, complete, error) still go to admins since the gallery cache updates depend on them, but now via a single emit to [user room, admin room]. python-socketio dedupes recipients across a room list, so an admin who owns the queue item - including the "system" user in single-user mode, which is also an admin - receives exactly one copy instead of two. The old double delivery meant the second, image-stripped copy of a progress event clobbered the owner's own progress image, and completion events were processed twice. On the frontend, an invocation-complete event now only clears the progress indicator when the event belongs to the current user, sharing the ownership check introduced for gallery auto-switch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…iuser mode Three related fixes so that one user's generation activity no longer animates other users' (including admins') personal UI: 1. The queue status endpoint now returns per-user counts for every caller, admins included. A new is_admin flag on get_queue_status() disables current-item redaction for admins so they keep visibility of other users' current item while gaining their own user_pending/user_in_progress counts. Redaction remains fail-closed for callers that pass user_id without the flag. The frontend progress bar, busy favicon/tab title, and floating invoke button spinner now prefer the per-user counts over the global counts, so they only react to the user's own queue items. Queue status embedded in socket events never carries user counts; when patching the cache from an event, the previously-fetched per-user counts are retained instead of being nulled out. 2. Model load events now carry the user whose action triggered the load (threaded from the invocation context's queue item and the utility/convert endpoints) and are routed to that user's socket room instead of being broadcast to every connected client. These events only feed the loading-models spinner, which is personal UI. Model install/download events remain broadcast. schema.ts and openapi.json regenerated for the new event field. 3. On a queue item reaching a terminal status, the failure toast and progress indicator reset now only fire for the current user's own items - admins receive these events for all users and previously got other users' error toasts and had their in-flight progress display cleared. Single-user mode is unaffected throughout: there is no current user in the frontend auth state, the sole "system" user is in its own user room, and its per-user counts equal the global counts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
8210b50 to
c13e1e4
Compare
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
In multiuser mode, one user's generation activity leaked into other users' personal UI. The most visible symptom: when an unprivileged user generated an image to their private board, an admin's selected board would switch to that user's board and display the new image. Beyond that, other users' activity animated everyone's progress bar, busy favicon, and invoke-button spinner, cleared in-flight progress displays, and (for admins) raised other users' failure toasts.
Principle applied throughout: events may keep other users' caches fresh (and admins may observe all activity in the queue list), but personal UI — board/image selection, progress indicators, toasts — only follows the current user's own actions. Single-user mode is unaffected.
Changes
Gallery auto-switch
onInvocationCompletenow only auto-switches boards / selects the new image when the completion event belongs to the current user. Admins receive all users' completion events (needed to keep their gallery caches fresh) but no longer have their selection hijacked.Invocation event routing
InvocationProgressEventis emitted only to the owner's room. It drives personal UI exclusively (global progress bar, workflow editor current-image node, image viewer progress image), and no admin UI consumes other users' progress. This also removes the previous image-stripped admin copy.systemuser in single-user mode) now receives exactly one copy instead of two — the duplicate delivery previously clobbered the owner's progress image with the stripped admin copy and processed completions twice.Queue status counts
user_pending/user_in_progressfor every caller, admins included. A new fail-closedis_adminflag onget_queue_status()disables current-item redaction for admins so they keep visibility of other users' current item while gaining their own counts;user_idwithout the flag behaves exactly as before.Model load events
ModelLoadStartedEvent/ModelLoadCompleteEventnow carry theuser_idwhose action triggered the load (threaded from the invocation context's queue item and the prompt-expand / image-to-prompt / model-convert endpoints) and are routed to that user's room instead of broadcast to every client. Previously any user's model load forced everyone's progress bar into indeterminate mode. Install/download events remain broadcast (the model manager UI is not per-user).schema.ts/openapi.jsonregenerated for the new event field.Terminal-status side effects
Testing
onInvocationComplete(no board switch / progress clear for foreign events, caches still updated; own and single-user events unaffected), per-user count retention in queue status cache patches.🤖 Generated with Claude Code