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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(workbench): expose diagnostics developer settings
joshistoast7bab0c2918a5
diff --git a/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.tsx b/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.tsxindex 7bb29d0cb0..ba12396dcd 100644--- a/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.tsx+++ b/invokeai/frontend/webv2/src/workbench/WorkbenchRuntime.tsx@@ -12,10 +12,12 @@ import {type ReconcileInput,} from './backend/queueCoordinator';import { socketHub } from './backend/socketHub';+import { configureDiagnostics } from './diagnostics/logger';import { addImagesToGalleryBoard } from './gallery/api';import { getQueueItemResultImages, resumeQueueProcessor } from './generation/api';import { sanitizeBatchCount } from './generation/batch';import { normalizeGenerateSettings } from './generation/settings';+import { useWorkbenchPreferenceSelector } from './settings/store';import {useWorkbenchDispatch,useWorkbenchHasHydrated,@@ -137,7 +139,13 @@ const routeBackendItemResults = async (dispatch({ backendItemId, images, projectId, queueItemId: queueItem.id, type: 'routeQueueItemPartialResults' });dispatch({ type: 'refreshBackendData' });} catch (error) {- dispatch({ message: toErrorMessage(error), type: 'recordError' });+ dispatch({+ area: 'queue-results',+ message: toErrorMessage(error),+ namespace: 'queue',+ projectId,+ type: 'recordError',+ });}};@@ -226,6 +234,12 @@ export const WorkbenchRuntime = () => {const dispatch = useWorkbenchDispatch();const hasHydrated = useWorkbenchHasHydrated();const backendConnectionStatus = useWorkbenchSelector((snapshot) => snapshot.state.backendConnection.status);+ const diagnosticsPreferences = useWorkbenchPreferenceSelector((preferences) => ({+ enabled: preferences.developerLogEnabled,+ level: preferences.developerLogLevel,+ namespaces: preferences.developerLogNamespaces,+ performanceTimingsEnabled: preferences.developerPerformanceTimingsEnabled,+ }));const queueRevision = useWorkbenchSelector(selectQueueRevision);const coordinatorRef = useRef<QueueCoordinator | null>(null);const stateRef = useRef(store.getState());@@ -242,6 +256,10 @@ export const WorkbenchRuntime = () => {[store]);+ useEffect(() => {+ configureDiagnostics(diagnosticsPreferences);+ }, [diagnosticsPreferences]);+// Mirror the shared socket's connection status (owned by the hub, above the// workbench) into workbench state so the editor's many `backendConnection`// consumers and the reconcile gate keep working unchanged. Seeds on mount so@@ -391,7 +409,12 @@ export const WorkbenchRuntime = () => {// Release pending items to the normal submission path; running items// cannot be re-attached without backend state, so fail them visibly// rather than leaving them stuck as running forever.- dispatch({ message: `Queue reconciliation failed: ${toErrorMessage(error)}`, type: 'recordError' });+ dispatch({+ area: 'queue-reconciliation',+ message: `Queue reconciliation failed: ${toErrorMessage(error)}`,+ namespace: 'queue',+ type: 'recordError',+ });for (const { project, queueItem } of openItems) {if (queueItem.status === 'pending') {@@ -441,7 +464,12 @@ export const WorkbenchRuntime = () => {coordinator.cancelRun({ backendBatchId: queueItem.backendBatchId, backendItemIds: queueItem.backendItemIds }).catch((error: unknown) => {- dispatch({ message: toErrorMessage(error), type: 'recordError' });+ dispatch({+ area: 'queue-cancel',+ message: toErrorMessage(error),+ namespace: 'queue',+ type: 'recordError',+ });});}}diff --git a/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx b/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsxindex c30e22ca7c..1f701e26b4 100644--- a/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx+++ b/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx@@ -619,7 +619,8 @@ const QueueSection = () => {};const DeveloperSection = () => {- const { developerLogEnabled, developerLogLevel, developerLogNamespaces } = useWorkbenchPreferences();+ const { developerLogEnabled, developerLogLevel, developerLogNamespaces, developerPerformanceTimingsEnabled } =+ useWorkbenchPreferences();const enabledNamespaces = useMemo(() => new Set(developerLogNamespaces), [developerLogNamespaces]);const toggleNamespace = useCallback(@@ -640,19 +641,23 @@ const DeveloperSection = () => {const updateDeveloperLogLevel = useCallback((value: string) => {updatePreferences({ developerLogLevel: value as DeveloperLogLevel });}, []);+ const updateDeveloperPerformanceTimingsEnabled = useCallback((checked: boolean) => {+ updatePreferences({ developerPerformanceTimingsEnabled: checked });+ }, []);return (- <SettingsSection description="Console logging controls for development builds." title="Developer">+ <SettingsSection+ description="Current-user diagnostics settings. Entries are still grouped by project and kept in memory only."+ title="Developer"+ ><SettingTogglechecked={developerLogEnabled}- comingSoon- description="Enable console logging for selected namespaces."- label="Enable developer logs"+ description="Record selected diagnostic log events in the Diagnostics widget."+ label="Record diagnostic logs"onChange={updateDeveloperLogEnabled}/><SettingSelect- comingSoon- description="Minimum log level written to the console."+ description="Minimum log level recorded in the Diagnostics widget."label="Log level"value={developerLogLevel}onChange={updateDeveloperLogLevel}@@ -663,6 +668,12 @@ const DeveloperSection = () => {</option>))}</SettingSelect>+ <SettingToggle+ checked={developerPerformanceTimingsEnabled}+ description="Record performance measurements such as workflow editor timing and project serialization costs."+ label="Collect performance timings"+ onChange={updateDeveloperPerformanceTimingsEnabled}+ /><Stack gap="2"><Text color="fg" fontSize="sm" fontWeight="500">Log namespaces@@ -697,7 +708,7 @@ const DeveloperNamespaceCheckbox = ({);return (- <Checkbox.Root checked={checked} disabled size="sm" onCheckedChange={handleCheckedChange}>+ <Checkbox.Root checked={checked} size="sm" onCheckedChange={handleCheckedChange}><Checkbox.HiddenInput /><Checkbox.Control /><Checkbox.Label color="fg.muted" fontSize="xs">diff --git a/invokeai/frontend/webv2/src/workbench/settings/store.test.ts b/invokeai/frontend/webv2/src/workbench/settings/store.test.tsindex 09dcbea437..42278a68b3 100644--- a/invokeai/frontend/webv2/src/workbench/settings/store.test.ts+++ b/invokeai/frontend/webv2/src/workbench/settings/store.test.ts@@ -119,7 +119,7 @@ describe('loadWorkbenchSettings', () => {const preferences = await store.loadWorkbenchSettings();expect(preferences.themeId).toBe('classic');- expect(preferences.developerLogLevel).toBe('debug');+ expect(preferences.developerLogLevel).toBe('warn');});it('serves the local copy when the backend is unreachable and retries next time', async () => {@@ -224,6 +224,24 @@ describe('normalizeProjectSettings', () => {});});+describe('normalizeWorkbenchPreferences diagnostics', () => {+ it('heals invalid diagnostics preferences to defaults', () => {+ expect(+ store.normalizeWorkbenchPreferences({+ developerLogEnabled: true,+ developerLogLevel: 'shout' as never,+ developerLogNamespaces: ['system', 'missing'] as never,+ developerPerformanceTimingsEnabled: true,+ })+ ).toMatchObject({+ developerLogEnabled: true,+ developerLogLevel: 'warn',+ developerLogNamespaces: ['system'],+ developerPerformanceTimingsEnabled: true,+ });+ });+});+describe('normalizeWorkbenchPreferences queue scope', () => {it('defaults queue jobs to all jobs for older preferences', () => {expect(store.normalizeWorkbenchPreferences({}).queueJobsScope).toBe('all');diff --git a/invokeai/frontend/webv2/src/workbench/settings/store.ts b/invokeai/frontend/webv2/src/workbench/settings/store.tsindex 4efc7ff33e..d38ff242d3 100644--- a/invokeai/frontend/webv2/src/workbench/settings/store.ts+++ b/invokeai/frontend/webv2/src/workbench/settings/store.ts@@ -72,8 +72,9 @@ export const DEFAULT_PREFERENCES: WorkbenchPreferences = {confirmImageDeletion: true,customHotkeys: {},developerLogEnabled: true,- developerLogLevel: 'debug',- developerLogNamespaces: [...DEVELOPER_LOG_NAMESPACES],+ developerLogLevel: 'warn',+ developerLogNamespaces: ['system', 'queue', 'workflows'],+ developerPerformanceTimingsEnabled: false,enableInformationalPopovers: true,enableModelDescriptions: true,language: 'en',@@ -95,7 +96,7 @@ interface WorkbenchSettingsSnapshot {}const store = createExternalStore<WorkbenchSettingsSnapshot>({- preferences: { ...DEFAULT_PREFERENCES, developerLogNamespaces: [...DEFAULT_PREFERENCES.developerLogNamespaces] },+ preferences: DEFAULT_PREFERENCES,scope: 'global',status: 'idle',});@@ -189,6 +190,10 @@ export const normalizeWorkbenchPreferences = (preferences?: WorkbenchPreferences? preferences.developerLogLevel: DEFAULT_PREFERENCES.developerLogLevel,developerLogNamespaces: normalizeDeveloperLogNamespaces(preferences?.developerLogNamespaces),+ developerPerformanceTimingsEnabled:+ typeof preferences?.developerPerformanceTimingsEnabled === 'boolean'+ ? preferences.developerPerformanceTimingsEnabled+ : DEFAULT_PREFERENCES.developerPerformanceTimingsEnabled,enableInformationalPopovers:typeof preferences?.enableInformationalPopovers === 'boolean'? preferences.enableInformationalPopovers