Skip to content

fix(multiuser): keep queue badge & progress bar live across users#9313

Closed
lstein wants to merge 1 commit into
invoke-ai:mainfrom
lstein:fix-multiuser-badge-count
Closed

fix(multiuser): keep queue badge & progress bar live across users#9313
lstein wants to merge 1 commit into
invoke-ai:mainfrom
lstein:fix-multiuser-badge-count

Conversation

@lstein

@lstein lstein commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

In multiuser mode, a non-admin user's queue count badge (X/Y) and the progress bar get stuck whenever another user has jobs in the queue.

Reproduction

  1. User A queues 2 jobs; User B immediately queues 2 jobs.
  2. User A's badge shows 2/2 (wrong — should be 2/4); User B's shows 2/4 (correct).
  3. As jobs drain, User A counts down to 0/2 and freezes with the progress bar animating indefinitely. User B counts down to 0/4 and clears cleanly.

Root cause

queue_item_status_changed and batch_enqueued events are emitted only to the owning user's socket room (correct, for privacy — they carry unsanitized user_id/batch_id/session_id). But the frontend badge and progress bar only refetch the global queue status in response to those events. So a non-admin only ever learns about queue changes from their own jobs. Once their jobs finish, they receive no further signal — the global total (the /Y) and the in_progress count freeze.

The queue order explains the exact symptoms: the user who queued first captured the global total before the second user's jobs existed; once their own jobs finished they stopped refetching. The stuck spinner is ProgressBar.tsx reading a frozen in_progress > 0 while lastProgressEvent is null.

Fix

Broadcast a content-free queue_counts_changed event to the whole queue room whenever counts change (a status transition or an enqueue). It carries only queue_id — no user_id, batch_id, session_id, or counts — so every subscriber simply refetches GET /queue/{id}/status, which already redacts per-user data. Nothing private is leaked. It fires only on status/enqueue events, never on high-frequency invocation-progress events.

Changes

  • invokeai/app/api/sockets.py_broadcast_queue_counts_changed() helper, called from the status-changed and batch-enqueued branches of _handle_queue_event.
  • invokeai/frontend/web/src/services/events/types.ts — type the new event.
  • invokeai/frontend/web/src/services/events/setEventListeners.tsx — handler invalidating only SessionQueueStatus.

Testing

  • Manually verified with two users (2 + 2 jobs): both badges now settle on 2/4, count down together, and clear with no lingering spinner.
  • tsc --noEmit, eslint --max-warnings=0, prettier --check all pass.
  • ruff check and ruff format --check pass.

🤖 Generated with Claude Code

In multiuser mode, queue item status changes and batch-enqueued events are
emitted only to the owning user's socket room (for privacy). The frontend badge
and progress bar only refetch the global queue status in response to those
events, so a non-admin only learns about queue changes from their *own* jobs.
Once their jobs finish they get no further signal: the global total (the "/Y"
in "X/Y") and the in_progress count freeze, leaving the badge wrong and the
progress bar animating indefinitely.

Broadcast a content-free `queue_counts_changed` event to the whole queue room
whenever counts change (a status transition or an enqueue). It carries only the
queue_id — no user_id, batch_id, session_id, or counts — so every subscriber can
refetch GET /queue/{id}/status, which already redacts per-user data. Nothing
private is leaked, and it never fires on high-frequency invocation progress
events.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added api python PRs that change python files frontend PRs that change frontend files labels Jun 29, 2026
@lstein

lstein commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #9314, which uses a branch hosted on invoke-ai/InvokeAI directly instead of my personal fork. Same commit.

@lstein lstein closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api frontend PRs that change frontend files python PRs that change python files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant