Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

feat: show queue progress in top bar

joshistoasta930d6faa50c
diff --git a/invokeai/frontend/webv2/src/workbench/backend/modelLoadStore.ts b/invokeai/frontend/webv2/src/workbench/backend/modelLoadStore.ts
new file mode 100644
index 0000000000..2f3e4f6810
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/backend/modelLoadStore.ts
@@ -0,0 +1,61 @@
+import { useSyncExternalStore } from 'react';
+
+export interface ModelLoadInfo {
+ label: string;
+}
+
+const listeners = new Set<() => void>();
+
+let activeLoads: ModelLoadInfo[] = [];
+
+const emit = (): void => {
+ for (const listener of listeners) {
+ listener();
+ }
+};
+
+const subscribe = (listener: () => void): (() => void) => {
+ listeners.add(listener);
+
+ return () => {
+ listeners.delete(listener);
+ };
+};
+
+const getModelLoadLabel = (payload: unknown): string => {
+ const record = payload && typeof payload === 'object' ? (payload as Record<string, unknown>) : {};
+ const config = record.config && typeof record.config === 'object' ? (record.config as Record<string, unknown>) : {};
+ const name = typeof config.name === 'string' && config.name.trim() ? config.name.trim() : 'model';
+ const extras = [config.base, config.type, record.submodel_type].filter(
+ (value): value is string => typeof value === 'string' && value.trim().length > 0
+ );
+
+ return extras.length ? `${name} (${extras.join(', ')})` : name;
+};
+
+export const modelLoadStore = {
+ started(payload: unknown): void {
+ activeLoads = [...activeLoads, { label: getModelLoadLabel(payload) }];
+ emit();
+ },
+ completed(payload: unknown): void {
+ const label = getModelLoadLabel(payload);
+ const index = activeLoads.findIndex((load) => load.label === label);
+
+ if (index >= 0) {
+ activeLoads = activeLoads.filter((_, loadIndex) => loadIndex !== index);
+ } else {
+ activeLoads = activeLoads.slice(1);
+ }
+
+ emit();
+ },
+ reset(): void {
+ if (activeLoads.length > 0) {
+ activeLoads = [];
+ emit();
+ }
+ },
+};
+
+export const useModelLoads = (): ModelLoadInfo[] => useSyncExternalStore(subscribe, () => activeLoads);
diff --git a/invokeai/frontend/webv2/src/workbench/backend/progressStore.ts b/invokeai/frontend/webv2/src/workbench/backend/progressStore.ts
index 1fe47ecb28..ed44b184ff 100644
--- a/invokeai/frontend/webv2/src/workbench/backend/progressStore.ts
+++ b/invokeai/frontend/webv2/src/workbench/backend/progressStore.ts
@@ -10,12 +10,17 @@ import { useSyncExternalStore } from 'react';
*/
export interface QueueItemProgress {
+ /** 1-based image slot currently executing inside this local batch. */
+ activeItemIndex?: number;
+ completedItemCount?: number;
message: string;
/** 0..1, or null while indeterminate. */
percentage: number | null;
+ totalItemCount?: number;
}
export interface QueueItemProgressSink {
+ clearAll?(): void;
set(queueItemId: string, progress: QueueItemProgress): void;
clear(queueItemId: string): void;
}
@@ -38,6 +43,12 @@ const subscribe = (listener: () => void): (() => void) => {
};
export const queueItemProgressStore: QueueItemProgressSink = {
+ clearAll() {
+ if (progressByQueueItemId.size > 0) {
+ progressByQueueItemId.clear();
+ emit();
+ }
+ },
clear(queueItemId) {
if (progressByQueueItemId.delete(queueItemId)) {
emit();
diff --git a/invokeai/frontend/webv2/src/workbench/backend/queueCoordinator.test.ts b/invokeai/frontend/webv2/src/workbench/backend/queueCoordinator.test.ts
index 66f96e65f2..38de96116c 100644
--- a/invokeai/frontend/webv2/src/workbench/backend/queueCoordinator.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/backend/queueCoordinator.test.ts
@@ -247,7 +247,13 @@ describe('queueCoordinator', () => {
percentage: 0.5,
});
- expect(harness.progressEntries.get('local-1')).toEqual({ message: 'Denoising', percentage: 0.5 });
+ expect(harness.progressEntries.get('local-1')).toEqual({
+ activeItemIndex: 1,
+ completedItemCount: 0,
+ message: 'Denoising',
+ percentage: 0.5,
+ totalItemCount: 1,
+ });
const resultsPromise = harness.coordinator.waitForResults('local-1', '2026-06-10T00:00:00Z');
@@ -257,6 +263,37 @@ describe('queueCoordinator', () => {
expect(harness.progressEntries.has('local-1')).toBe(false);
});
+ it('tracks the active image index inside a submitted batch', async () => {
+ harness.api.enqueueGenerateGraph.mockResolvedValue({ batchId: 'batch-1', itemIds: [1, 2] });
+ harness.coordinator.connect();
+
+ await harness.coordinator.submitGenerate('local-1', generateRequest);
+
+ expect(harness.progressEntries.get('local-1')).toEqual({
+ activeItemIndex: 1,
+ completedItemCount: 0,
+ message: '',
+ percentage: null,
+ totalItemCount: 2,
+ });
+
+ const resultsPromise = harness.coordinator.waitForResults('local-1', '2026-06-10T00:00:00Z');
+
+ harness.socket.fire('queue_item_status_changed', createStatusEvent({ item_id: 1 }));
+
+ expect(harness.progressEntries.get('local-1')).toEqual({
+ activeItemIndex: 2,
+ completedItemCount: 1,
+ message: '',
+ percentage: null,
+ totalItemCount: 2,
+ });
+
+ harness.socket.fire('queue_item_status_changed', createStatusEvent({ item_id: 2 }));
+
+ await resultsPromise;
+ });
+
describe('reconcile', () => {
it('adopts pending items the backend already accepted, by origin', async () => {
harness.api.listAllQueueItems.mockResolvedValue([
diff --git a/invokeai/frontend/webv2/src/workbench/backend/queueCoordinator.ts b/invokeai/frontend/webv2/src/workbench/backend/queueCoordinator.ts
index 3fe2b198c8..bb2ee1d4b2 100644
--- a/invokeai/frontend/webv2/src/workbench/backend/queueCoordinator.ts
+++ b/invokeai/frontend/webv2/src/workbench/backend/queueCoordinator.ts
@@ -19,6 +19,7 @@ import {
type TerminalBackendQueueItemStatus,
} from './events';
import { ApiError, getAuthToken, getBackendSocketUrl } from './http';
+import { modelLoadStore } from './modelLoadStore';
import { queueItemProgressStore, type QueueItemProgressSink } from './progressStore';
const SOCKET_PATH = '/ws/socket.io';
@@ -110,6 +111,14 @@ interface RunState {
outcomePromises: Promise<TerminalOutcome>[];
}
+interface RunProgressState {
+ activeBackendItemId?: number;
+ backendItemIds: number[];
+ completedBackendItemIds: Set<number>;
+ message: string;
+ percentage: number | null;
+}
+
interface WaitState {
localQueueItemId: string;
settle: (outcome: TerminalOutcome) => void;
@@ -169,6 +178,7 @@ export const createQueueCoordinator = (
const sweepIntervalMs = options.sweepIntervalMs ?? SAFETY_SWEEP_INTERVAL_MS;
const runs = new Map<string, RunState>();
+ const runProgress = new Map<string, RunProgressState>();
const waits = new Map<number, WaitState>();
/**
* Terminal events that arrived for items nobody tracks yet. Closes the race
@@ -209,6 +219,30 @@ export const createQueueCoordinator = (
}
};
+ const publishRunProgress = (localQueueItemId: string): void => {
+ const state = runProgress.get(localQueueItemId);
+
+ if (!state) {
+ return;
+ }
+
+ const activeBackendItemId =
+ state.activeBackendItemId !== undefined && !state.completedBackendItemIds.has(state.activeBackendItemId)
+ ? state.activeBackendItemId
+ : undefined;
+ const activeItemIndex = activeBackendItemId
+ ? state.backendItemIds.indexOf(activeBackendItemId) + 1
+ : Math.min(state.completedBackendItemIds.size + 1, state.backendItemIds.length);
+
+ progress.set(localQueueItemId, {
+ activeItemIndex: Math.max(1, activeItemIndex),
+ completedItemCount: state.completedBackendItemIds.size,
+ message: state.message,
+ percentage: state.percentage,
+ totalItemCount: state.backendItemIds.length,
+ });
+ };
+
const settleWait = (backendItemId: number, outcome: TerminalOutcome): void => {
const wait = waits.get(backendItemId);
@@ -218,7 +252,16 @@ export const createQueueCoordinator = (
}
waits.delete(backendItemId);
- progress.clear(wait.localQueueItemId);
+ const state = runProgress.get(wait.localQueueItemId);
+
+ if (state) {
+ state.activeBackendItemId = undefined;
+ state.completedBackendItemIds.add(backendItemId);
+ state.message = '';
+ state.percentage = null;
+ publishRunProgress(wait.localQueueItemId);
+ }
+
wait.settle(outcome);
};
@@ -248,6 +291,14 @@ export const createQueueCoordinator = (
backendItemIds,
outcomePromises: backendItemIds.map((backendItemId) => trackBackendItem(localQueueItemId, backendItemId)),
});
+
+ runProgress.set(localQueueItemId, {
+ backendItemIds,
+ completedBackendItemIds: new Set(),
+ message: '',
+ percentage: null,
+ });
+ publishRunProgress(localQueueItemId);
};
/** Slow safety net for events lost to disconnects; runs on reconnect and on a long interval. */
@@ -294,7 +345,16 @@ export const createQueueCoordinator = (
const wait = waits.get(event.item_id);
if (wait) {
- progress.set(wait.localQueueItemId, { message: event.message, percentage: event.percentage });
+ const state = runProgress.get(wait.localQueueItemId);
+
+ if (state) {
+ state.activeBackendItemId = event.item_id;
+ state.message = event.message;
+ state.percentage = event.percentage;
+ publishRunProgress(wait.localQueueItemId);
+ } else {
+ progress.set(wait.localQueueItemId, { message: event.message, percentage: event.percentage });
+ }
}
};
@@ -314,19 +374,31 @@ export const createQueueCoordinator = (
notifyConnection('connecting');
socket.on('connect', () => {
+ modelLoadStore.reset();
+ progress.clearAll?.();
notifyConnection('connected');
socket?.emit('subscribe_queue', { queue_id: 'default' });
scheduleGalleryRefresh();
void sweep();
});
socket.on('connect_error', (error: { message: string }) => {
+ modelLoadStore.reset();
+ progress.clearAll?.();
notifyConnection('disconnected', error.message);
});
socket.on('disconnect', (reason: string) => {
+ modelLoadStore.reset();
+ progress.clearAll?.();
notifyConnection('disconnected', reason);
});
socket.on('queue_item_status_changed', handleStatusChanged);
socket.on('invocation_progress', handleProgress);
+ socket.on('model_load_started', (payload: never) => {
+ modelLoadStore.started(payload);
+ });
+ socket.on('model_load_complete', (payload: never) => {
+ modelLoadStore.completed(payload);
+ });
// Model install lifecycle events are broadcast to every connected client
// (no room subscription needed); forward them to the installs store so the
@@ -454,6 +526,7 @@ export const createQueueCoordinator = (
return imagesPerItem.flat();
} finally {
runs.delete(localQueueItemId);
+ runProgress.delete(localQueueItemId);
progress.clear(localQueueItemId);
}
};
diff --git a/invokeai/frontend/webv2/src/workbench/components/TopBar.tsx b/invokeai/frontend/webv2/src/workbench/components/TopBar.tsx
index 1ec30452ee..fdd9461158 100644
--- a/invokeai/frontend/webv2/src/workbench/components/TopBar.tsx
+++ b/invokeai/frontend/webv2/src/workbench/components/TopBar.tsx
@@ -1,16 +1,35 @@
-import { Badge, Flex, Group, Icon, Menu, NumberInput, Portal, Separator } from '@chakra-ui/react';
+import {
+ Badge,
+ Flex,
+ Group,
+ HStack,
+ Icon,
+ Menu,
+ NumberInput,
+ Portal,
+ Progress,
+ Separator,
+ Stack,
+ Text,
+} from '@chakra-ui/react';
import { ChevronDownIcon, ListOrderedIcon, PauseIcon, PlayIcon, XIcon } from 'lucide-react';
import { InvokeControl } from './InvokeControl';
import { LayoutPresetMenu } from './LayoutPresetMenu';
import { ProjectTabs } from './ProjectTabs';
-import { IconButton } from './ui/Button';
+import { Button, IconButton } from './ui/Button';
+import { useModelLoads, type ModelLoadInfo } from '../backend/modelLoadStore';
import { AccountMenu } from '../auth/components/AccountMenu';
+import { useQueueItemProgress, type QueueItemProgress } from '../backend/progressStore';
+import { getDestinationLabel, getSourceLabel } from '../invocation';
+import { getQueueItemExpectedImageCount, getQueueProgressBarState, getQueueSummary } from '../queueSummary';
import { useWorkbenchPreferences } from '../settings/store';
+import type { QueueItem } from '../types';
import { useWorkbench } from '../WorkbenchContext';
import { DEFAULT_THEME_ID, THEMES_BY_ID } from '../../theme/themes';
import { Tooltip } from './ui/Tooltip';
import { Link } from '@tanstack/react-router';
+import { useOpenWorkbenchWidget } from '../useOpenWorkbenchWidget';
/** Workbench top bar: brand, global Invoke command cluster, project tabs, layout + account controls. */
export const TopBar = () => (
@@ -98,20 +117,207 @@ const BatchCountField = () => {
};
const QueueInfo = () => {
- const { activeProject } = useWorkbench();
- const activeCount = activeProject.queue.items.filter(
- (item) => item.status === 'pending' || item.status === 'running'
- ).length;
- const totalCount = activeProject.queue.items.length;
+ const { activeProject, state } = useWorkbench();
+ const modelLoads = useModelLoads();
+ const openWorkbenchWidget = useOpenWorkbenchWidget();
+ const baseSummary = getQueueSummary(activeProject.queue.items);
+ const runningProgress = useQueueItemProgress(baseSummary.runningQueueItemId ?? '');
+ const summary = getQueueSummary(activeProject.queue.items, runningProgress);
+ const runningItem = summary.runningQueueItemId
+ ? activeProject.queue.items.find((item) => item.id === summary.runningQueueItemId)
+ : undefined;
+ const progressState = getQueueProgressBarState({
+ isConnected: state.backendConnection.status === 'connected',
+ isRunning: Boolean(runningItem),
+ loadingModelsCount: modelLoads.length,
+ progress: runningProgress,
+ });
+ const onClick = () => {
+ openWorkbenchWidget('queue');
+ };
return (
- <Badge variant="outline" h="9" borderColor="border.subtle" fontSize="xs" fontWeight="700" gap="1" px="2">
- <ListOrderedIcon size="14" />
- {activeCount}/{totalCount}
- </Badge>
+ <Tooltip
+ content={
+ <QueueInfoTooltip
+ item={runningItem}
+ modelLoads={modelLoads}
+ progress={runningProgress}
+ total={summary.total}
+ current={summary.current}
+ />
+ }
+ contentProps={{ maxW: '22rem', p: '0' }}
+ openDelay={200}
+ showArrow
+ >
+ <Button
+ aria-label={`Queue progress ${summary.current} of ${summary.total}`}
+ variant="outline"
+ h="9"
+ borderColor="border.subtle"
+ fontSize="xs"
+ fontWeight="700"
+ gap="1"
+ overflow="hidden"
+ position="relative"
+ px="2"
+ onClick={onClick}
+ >
+ <Icon as={ListOrderedIcon} boxSize="4" flexShrink="0" />
+ {summary.current}/{summary.total}
+ <QueueBadgeProgressBar state={progressState} />
+ </Button>
+ </Tooltip>
+ );
+};
+
+const QueueBadgeProgressBar = ({ state }: { state: ReturnType<typeof getQueueProgressBarState> }) => {
+ const isIdle = state.kind === 'idle';
+
+ return (
+ <Progress.Root
+ aria-label={isIdle ? 'Invoke progress idle' : 'Invoke progress'}
+ bottom="0"
+ colorPalette="accent"
+ h={1}
+ insetInline={0}
+ max={1}
+ pointerEvents="none"
+ position="absolute"
+ value={state.value}
+ visibility={state.kind !== 'idle' ? 'visible' : 'hidden'}
+ >
+ <Progress.Track bg={isIdle ? 'border.subtle' : 'bg.emphasized'} h="full">
+ <Progress.Range bg="accent.solid" />
+ </Progress.Track>
+ </Progress.Root>
+ );
+};
+
+const QueueInfoTooltip = ({
+ current,
+ item,
+ modelLoads,
+ progress,
+ total,
+}: {
+ current: number;
+ item?: QueueItem;
+ modelLoads: ModelLoadInfo[];
+ progress: QueueItemProgress | null;
+ total: number;
+}) => {
+ if (modelLoads.length > 0 && total === 0) {
+ return <ModelLoadsTooltipContent modelLoads={modelLoads} />;
+ }
+
+ if (total === 0) {
+ return (
+ <Stack gap="1" p="3">
+ <Text fontSize="xs" fontWeight="800">
+ Queue idle
+ </Text>
+ <Text color="fg.subtle" fontSize="2xs">
+ No active or pending generation batches.
+ </Text>
+ </Stack>
+ );
+ }
+
+ if (!item) {
+ return (
+ <Stack gap="2" p="3">
+ <Text fontSize="xs" fontWeight="800">
+ {modelLoads.length ? 'Loading models' : 'Waiting to start'}
+ </Text>
+ <Text color="fg.subtle" fontSize="2xs">
+ {total} image{total === 1 ? '' : 's'} queued.
+ </Text>
+ {modelLoads.length ? <ModelLoadList modelLoads={modelLoads} /> : null}
+ </Stack>
+ );
+ }
+
+ const generateValues = item.snapshot.widgetStates.generate.values;
+ const prompt = typeof generateValues.positivePrompt === 'string' ? generateValues.positivePrompt.trim() : '';
+ const expectedCount = getQueueItemExpectedImageCount(item);
+ const activeItemIndex = Math.min(expectedCount, Math.max(1, progress?.activeItemIndex ?? 1));
+ const activeBackendItemId = item.backendItemIds?.[activeItemIndex - 1];
+ const progressLabel = modelLoads.length
+ ? `Loading ${modelLoads.length} model${modelLoads.length === 1 ? '' : 's'}.`
+ : progress?.message?.trim() || 'Backend accepted batch; waiting for progress event.';
+
+ return (
+ <Stack gap="2" p="3" minW="18rem">
+ <HStack justify="space-between" gap="3">
+ <Text fontSize="xs" fontWeight="800">
+ Loading image {current}/{total}
+ </Text>
+ <Badge colorPalette="blue" fontSize="2xs">
+ {item.status}
+ </Badge>
+ </HStack>
+ <Stack gap="1">
+ <Text color="fg.subtle" fontSize="2xs">
+ {progressLabel}
+ </Text>
+ {modelLoads.length ? <ModelLoadList modelLoads={modelLoads} /> : null}
+ {progress?.percentage !== null && progress?.percentage !== undefined ? (
+ <Progress.Root aria-label="Current image progress" max={1} size="xs" value={progress.percentage}>
+ <Progress.Track>
+ <Progress.Range />
+ </Progress.Track>
+ </Progress.Root>
+ ) : null}
+ </Stack>
+ <Stack gap="1" color="fg.subtle" fontSize="2xs">
+ <Text>
+ Batch image {activeItemIndex}/{expectedCount}
+ {activeBackendItemId !== undefined ? ` · backend item ${activeBackendItemId}` : ''}
+ </Text>
+ <Text fontFamily="mono" truncate>
+ Queue item {item.id}
+ </Text>
+ {item.backendBatchId ? (
+ <Text fontFamily="mono" truncate>
+ Backend batch {item.backendBatchId}
+ </Text>
+ ) : null}
+ <Text truncate>
+ {getSourceLabel(item.snapshot.sourceId)} to {getDestinationLabel(item.snapshot.destination)} ·{' '}
+ {item.snapshot.graph.label || item.snapshot.graph.id}
+ </Text>
+ </Stack>
+ {prompt ? (
+ <Text color="fg.muted" fontSize="2xs" lineClamp={2}>
+ {prompt}
+ </Text>
+ ) : null}
+ </Stack>
);
};
+const ModelLoadsTooltipContent = ({ modelLoads }: { modelLoads: ModelLoadInfo[] }) => (
+ <Stack gap="2" p="3" minW="18rem">
+ <Text fontSize="xs" fontWeight="800">
+ Loading {modelLoads.length} model{modelLoads.length === 1 ? '' : 's'}
+ </Text>
+ <ModelLoadList modelLoads={modelLoads} />
+ </Stack>
+);
+
+const ModelLoadList = ({ modelLoads }: { modelLoads: ModelLoadInfo[] }) => (
+ <Stack gap="0.5" color="fg.muted" fontSize="2xs">
+ {modelLoads.slice(0, 3).map((modelLoad, index) => (
+ <Text key={`${modelLoad.label}:${index}`} truncate>
+ {modelLoad.label}
+ </Text>
+ ))}
+ {modelLoads.length > 3 ? <Text>{modelLoads.length - 3} more...</Text> : null}
+ </Stack>
+);
+
/**
* Queue status + cancel cluster placeholder.
*
diff --git a/invokeai/frontend/webv2/src/workbench/queueSummary.test.ts b/invokeai/frontend/webv2/src/workbench/queueSummary.test.ts
new file mode 100644
index 0000000000..59d9d4d17f
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/queueSummary.test.ts
@@ -0,0 +1,192 @@
+import { describe, expect, it } from 'vitest';
+
+import type { QueueItem } from './types';
+import type { QueueItemProgress } from './backend/progressStore';
+import { getQueueProgressBarState, getQueueProgressBarValue, getQueueSummary } from './queueSummary';
+
+const createQueueItem = ({
+ backendItemIds,
+ batchCount = 1,
+ id,
+ status = 'pending',
+ submittedAt,
+}: {
+ backendItemIds?: number[];
+ batchCount?: number;
+ id: string;
+ status?: QueueItem['status'];
+ submittedAt: string;
+}): QueueItem => ({
+ backendItemIds,
+ cancellable: true,
+ id,
+ snapshot: {
+ canvas: {
+ document: { height: 1024, layers: [], width: 1024 },
+ stagingArea: {
+ areThumbnailsVisible: false,
+ isVisible: false,
+ pendingImageIds: [],
+ pendingImages: [],
+ selectedImageIndex: 0,
+ },
+ version: 1,
+ },
+ destination: 'gallery',
+ graph: { edges: [], id: 'graph-1', label: 'Graph', nodes: [], updatedAt: submittedAt, version: 1 },
+ sourceId: 'generate',
+ submittedAt,
+ widgetStates: {
+ generate: { id: 'generate', label: 'Generate', values: { batchCount }, version: 1 },
+ } as QueueItem['snapshot']['widgetStates'],
+ },
+ status,
+});
+
+describe('getQueueSummary', () => {
+ it('counts image slots inside the running batch', () => {
+ const summary = getQueueSummary([
+ createQueueItem({
+ backendItemIds: [1, 2, 3, 4],
+ batchCount: 4,
+ id: 'batch-1',
+ status: 'running',
+ submittedAt: '2026-06-10T00:00:00.000Z',
+ }),
+ ]);
+
+ expect(summary).toEqual({ current: 1, runningQueueItemId: 'batch-1', total: 4 });
+ });
+
+ it('keeps the running ordinal stable when newer work is queued', () => {
+ const summary = getQueueSummary([
+ createQueueItem({
+ batchCount: 4,
+ id: 'batch-2',
+ status: 'pending',
+ submittedAt: '2026-06-10T00:01:00.000Z',
+ }),
+ createQueueItem({
+ backendItemIds: [1, 2, 3, 4],
+ batchCount: 4,
+ id: 'batch-1',
+ status: 'running',
+ submittedAt: '2026-06-10T00:00:00.000Z',
+ }),
+ ]);
+
+ expect(summary).toEqual({ current: 1, runningQueueItemId: 'batch-1', total: 8 });
+ });
+
+ it('uses live progress to advance within a batch', () => {
+ const progress: QueueItemProgress = {
+ activeItemIndex: 2,
+ completedItemCount: 1,
+ message: '',
+ percentage: null,
+ totalItemCount: 4,
+ };
+ const summary = getQueueSummary(
+ [
+ createQueueItem({
+ backendItemIds: [1, 2, 3, 4],
+ batchCount: 4,
+ id: 'batch-1',
+ status: 'running',
+ submittedAt: '2026-06-10T00:00:00.000Z',
+ }),
+ createQueueItem({
+ batchCount: 4,
+ id: 'batch-2',
+ status: 'pending',
+ submittedAt: '2026-06-10T00:01:00.000Z',
+ }),
+ ],
+ progress
+ );
+
+ expect(summary).toEqual({ current: 2, runningQueueItemId: 'batch-1', total: 8 });
+ });
+
+ it('returns zeroes when all batches are terminal', () => {
+ const summary = getQueueSummary([
+ createQueueItem({ batchCount: 4, id: 'batch-1', status: 'completed', submittedAt: '2026-06-10T00:00:00.000Z' }),
+ ]);
+
+ expect(summary).toEqual({ current: 0, runningQueueItemId: null, total: 0 });
+ });
+});
+
+describe('getQueueProgressBarValue', () => {
+ it('returns an idle state when there is no active work', () => {
+ expect(
+ getQueueProgressBarState({ isConnected: true, isRunning: false, loadingModelsCount: 0, progress: null })
+ ).toEqual({ kind: 'idle', value: 0 });
+ });
+
+ it('matches legacy indeterminate conditions', () => {
+ expect(
+ getQueueProgressBarState({ isConnected: true, isRunning: false, loadingModelsCount: 1, progress: null })
+ ).toEqual({ kind: 'indeterminate', value: null });
+ expect(
+ getQueueProgressBarValue({ isConnected: true, isRunning: false, loadingModelsCount: 1, progress: null })
+ ).toBeNull();
+ expect(
+ getQueueProgressBarValue({ isConnected: true, isRunning: true, loadingModelsCount: 0, progress: null })
+ ).toBeNull();
+ expect(
+ getQueueProgressBarValue({
+ isConnected: true,
+ isRunning: true,
+ loadingModelsCount: 0,
+ progress: { message: '', percentage: null },
+ })
+ ).toBeNull();
+ expect(
+ getQueueProgressBarValue({
+ isConnected: true,
+ isRunning: true,
+ loadingModelsCount: 0,
+ progress: { message: '', percentage: 0 },
+ })
+ ).toBeNull();
+ });
+
+ it('returns determinate progress when backend reports a non-zero percentage', () => {
+ expect(
+ getQueueProgressBarState({
+ isConnected: true,
+ isRunning: true,
+ loadingModelsCount: 0,
+ progress: { message: 'Denoising', percentage: 0.42 },
+ })
+ ).toEqual({ kind: 'determinate', value: 0.42 });
+ expect(
+ getQueueProgressBarValue({
+ isConnected: true,
+ isRunning: true,
+ loadingModelsCount: 0,
+ progress: { message: 'Denoising', percentage: 0.42 },
+ })
+ ).toBe(0.42);
+ });
+
+ it('resets to zero while disconnected', () => {
+ expect(
+ getQueueProgressBarState({
+ isConnected: false,
+ isRunning: true,
+ loadingModelsCount: 1,
+ progress: { message: 'Denoising', percentage: 0.42 },
+ })
+ ).toEqual({ kind: 'idle', value: 0 });
+ expect(
+ getQueueProgressBarValue({
+ isConnected: false,
+ isRunning: true,
+ loadingModelsCount: 1,
+ progress: { message: 'Denoising', percentage: 0.42 },
+ })
+ ).toBe(0);
+ });
+});
diff --git a/invokeai/frontend/webv2/src/workbench/queueSummary.ts b/invokeai/frontend/webv2/src/workbench/queueSummary.ts
new file mode 100644
index 0000000000..6325100e02
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/queueSummary.ts
@@ -0,0 +1,101 @@
+import type { QueueItem } from './types';
+import type { QueueItemProgress } from './backend/progressStore';
+
+export interface QueueSummary {
+ current: number;
+ runningQueueItemId: string | null;
+ total: number;
+}
+
+export type QueueProgressBarState =
+ | { kind: 'determinate'; value: number }
+ | { kind: 'idle'; value: 0 }
+ | { kind: 'indeterminate'; value: null };
+
+export const getQueueProgressBarState = ({
+ isConnected,
+ isRunning,
+ loadingModelsCount,
+ progress,
+}: {
+ isConnected: boolean;
+ isRunning: boolean;
+ loadingModelsCount: number;
+ progress: QueueItemProgress | null;
+}): QueueProgressBarState => {
+ if (!isConnected) {
+ return { kind: 'idle', value: 0 };
+ }
+
+ if (loadingModelsCount > 0) {
+ return { kind: 'indeterminate', value: null };
+ }
+
+ if (isRunning && (!progress || progress.percentage === null || progress.percentage === 0)) {
+ return { kind: 'indeterminate', value: null };
+ }
+
+ if (isRunning) {
+ return { kind: 'determinate', value: progress?.percentage ?? 0 };
+ }
+
+ return { kind: 'idle', value: 0 };
+};
+
+export const getQueueProgressBarValue = (params: Parameters<typeof getQueueProgressBarState>[0]): number | null =>
+ getQueueProgressBarState(params).value;
+
+export const isOpenQueueItem = (item: QueueItem): boolean => item.status === 'pending' || item.status === 'running';
+
+export const getQueueItemExpectedImageCount = (item: QueueItem): number => {
+ if (item.backendItemIds?.length) {
+ return item.backendItemIds.length;
+ }
+
+ const batchCount = item.snapshot.widgetStates.generate?.values.batchCount;
+
+ return typeof batchCount === 'number' && Number.isFinite(batchCount) ? Math.max(1, Math.round(batchCount)) : 1;
+};
+
+const compareQueuePosition = (a: QueueItem, b: QueueItem): number => {
+ const aTime = Date.parse(a.snapshot.submittedAt);
+ const bTime = Date.parse(b.snapshot.submittedAt);
+
+ return (Number.isFinite(aTime) ? aTime : 0) - (Number.isFinite(bTime) ? bTime : 0);
+};
+
+const getRunningImageOrdinal = (item: QueueItem, progress: QueueItemProgress | null): number => {
+ const expectedCount = getQueueItemExpectedImageCount(item);
+ const completedCount = progress?.completedItemCount ?? 0;
+ const activeIndex = progress?.activeItemIndex ?? completedCount + 1;
+
+ return Math.min(expectedCount, Math.max(1, activeIndex));
+};
+
+export const getQueueSummary = (items: QueueItem[], progress: QueueItemProgress | null = null): QueueSummary => {
+ const openItems = items.filter(isOpenQueueItem).sort(compareQueuePosition);
+ const total = openItems.reduce((sum, item) => sum + getQueueItemExpectedImageCount(item), 0);
+
+ if (total === 0) {
+ return { current: 0, runningQueueItemId: null, total: 0 };
+ }
+
+ const runningItem = openItems.find((item) => item.status === 'running');
+
+ if (!runningItem) {
+ return { current: 0, runningQueueItemId: null, total };
+ }
+
+ let current = 0;
+
+ for (const item of openItems) {
+ if (item.id === runningItem.id) {
+ current += getRunningImageOrdinal(item, progress);
+ break;
+ }
+
+ current += getQueueItemExpectedImageCount(item);
+ }
+
+ return { current: Math.min(current, total), runningQueueItemId: runningItem.id, total };
+};
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/queue/QueueWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/queue/QueueWidgetView.tsx
index 69167d71da..dcefd6ca15 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/queue/QueueWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/queue/QueueWidgetView.tsx
@@ -28,7 +28,7 @@ export const QueueWidgetView = ({ presentation, region }: WidgetViewProps) => {
const QueueItemLiveProgress = ({ queueItemId }: { queueItemId: string }) => {
const progress = useQueueItemProgress(queueItemId);
- if (!progress) {
+ if (!progress || (!progress.message && progress.percentage === null)) {
return null;
}