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
fix(webv2): fail closed everywhere, and give the VAE facet a reader
Alexander Eichhorn542e3163df78
diff --git a/invokeai/backend/architectures/capabilities.py b/invokeai/backend/architectures/capabilities.pyindex 72a0355919..8ca4857c97 100644--- a/invokeai/backend/architectures/capabilities.py+++ b/invokeai/backend/architectures/capabilities.py@@ -25,7 +25,8 @@ from invokeai.backend.architectures.facets.features import ()from invokeai.backend.architectures.facets.latent_space import LatentSpaceFacetfrom invokeai.backend.architectures.facets.modality import GenerationModeKind, ModalityFacet-from invokeai.backend.architectures.registry import generative_bases, require+from invokeai.backend.architectures.facets.vae import VaeFacet+from invokeai.backend.architectures.registry import generative_bases, get, requirefrom invokeai.backend.model_manager.configs.default_settings import MainModelDefaultSettingsfrom invokeai.backend.model_manager.taxonomy import BaseModelType@@ -80,6 +81,30 @@ class ArchitectureFeatures(BaseModel):model_config = ConfigDict(extra="forbid")+class VaeAcceptance(BaseModel):+ """One VAE this architecture's decode accepts."""++ base: BaseModelType+ latent_channels: int | None = Field(+ default=None,+ description="Null unless the base ships VAEs of more than one latent width; only wan does.",+ )++ model_config = ConfigDict(extra="forbid")+++class ArchitectureVae(BaseModel):+ """Which VAEs an architecture's decode accepts, beyond its own base.++ Served because the clients keep their own copy of this and it drifts: widening a backend list+ without the picker leaves a VAE that loads but cannot be chosen.+ """++ accepted: list[VaeAcceptance]++ model_config = ConfigDict(extra="forbid")++class ArchitectureCapabilities(BaseModel):"""One row of the table."""@@ -93,6 +118,9 @@ class ArchitectureCapabilities(BaseModel):defaults: MainModelDefaultSettings | None = Field(default=None, description="Recommended generation parameters, if the architecture has any.")+ vae: ArchitectureVae | None = Field(+ default=None, description="Null where the architecture declares no VAE compatibility beyond its own base."+ )model_config = ConfigDict(extra="forbid")@@ -144,6 +172,18 @@ def architecture_capabilities() -> list[ArchitectureCapabilities]:rendered = ArchitectureModality(modes=sorted(modality.modes), metadata_slug=modality.metadata_slug)rendered_features = _features_of(features, latent_space.primary.spatial_compression)+ # Optional: most architectures accept only their own base, which needs no row.+ vae_facet = get(base, VaeFacet)+ rendered_vae = (+ ArchitectureVae(+ accepted=[+ VaeAcceptance(base=c.base, latent_channels=c.latent_channels)+ for c in sorted(vae_facet.accepted, key=lambda c: (c.base.value, c.latent_channels or 0))+ ]+ )+ if vae_facet is not None+ else None+ )rows.append(ArchitectureCapabilities(@@ -151,6 +191,7 @@ def architecture_capabilities() -> list[ArchitectureCapabilities]:modality=rendered,features=rendered_features,defaults=defaults.resolve(),+ vae=rendered_vae,))for variant in sorted(v for v in defaults.by_variant if v is not None):@@ -163,6 +204,7 @@ def architecture_capabilities() -> list[ArchitectureCapabilities]:modality=rendered,features=rendered_features,defaults=defaults.by_variant[variant],+ vae=rendered_vae,))return rowsdiff --git a/invokeai/frontend/web/openapi.json b/invokeai/frontend/web/openapi.jsonindex 6e0b121cd8..f919e35b16 100644--- a/invokeai/frontend/web/openapi.json+++ b/invokeai/frontend/web/openapi.json@@ -17712,6 +17712,17 @@}],"description": "Recommended generation parameters, if the architecture has any."+ },+ "vae": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/ArchitectureVae"+ },+ {+ "type": "null"+ }+ ],+ "description": "Null where the architecture declares no VAE compatibility beyond its own base."}},"additionalProperties": false,@@ -17879,6 +17890,22 @@"title": "ArchitectureModality","description": "What this architecture can produce, and what it calls it in image metadata."},+ "ArchitectureVae": {+ "properties": {+ "accepted": {+ "items": {+ "$ref": "#/components/schemas/VaeAcceptance"+ },+ "type": "array",+ "title": "Accepted"+ }+ },+ "additionalProperties": false,+ "type": "object",+ "required": ["accepted"],+ "title": "ArchitectureVae",+ "description": "Which VAEs an architecture's decode accepts, beyond its own base.\n\nServed because the clients keep their own copy of this and it drifts: widening a backend list\nwithout the picker leaves a VAE that loads but cannot be chosen."+ },"BaseMetadata": {"properties": {"name": {@@ -97616,6 +97643,30 @@"title": "VAE_Diffusers_Wan_Config","description": "Model config for Wan 2.2 VAE in diffusers folder layout (AutoencoderKLWan)."},+ "VaeAcceptance": {+ "properties": {+ "base": {+ "$ref": "#/components/schemas/BaseModelType"+ },+ "latent_channels": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "title": "Latent Channels",+ "description": "Null unless the base ships VAEs of more than one latent width; only wan does."+ }+ },+ "additionalProperties": false,+ "type": "object",+ "required": ["base"],+ "title": "VaeAcceptance",+ "description": "One VAE this architecture's decode accepts."+ },"ValidationError": {"properties": {"loc": {diff --git a/invokeai/frontend/web/src/services/api/schema.ts b/invokeai/frontend/web/src/services/api/schema.tsindex 1e9d9b460b..a67d24a89d 100644--- a/invokeai/frontend/web/src/services/api/schema.ts+++ b/invokeai/frontend/web/src/services/api/schema.ts@@ -5174,6 +5174,8 @@ export type components = {features: components["schemas"]["ArchitectureFeatures"];/** @description Recommended generation parameters, if the architecture has any. */defaults?: components["schemas"]["MainModelDefaultSettings"] | null;+ /** @description Null where the architecture declares no VAE compatibility beyond its own base. */+ vae?: components["schemas"]["ArchitectureVae"] | null;};/*** ArchitectureFeatures@@ -5275,6 +5277,17 @@ export type components = {*/metadata_slug?: string | null;};+ /**+ * ArchitectureVae+ * @description Which VAEs an architecture's decode accepts, beyond its own base.+ *+ * Served because the clients keep their own copy of this and it drifts: widening a backend list+ * without the picker leaves a VAE that loads but cannot be chosen.+ */+ ArchitectureVae: {+ /** Accepted */+ accepted: components["schemas"]["VaeAcceptance"][];+ };/*** BaseMetadata* @description Adds typing data for discriminated union.@@ -43366,6 +43379,18 @@ export type components = {*/latent_channels: 16 | 48;};+ /**+ * VaeAcceptance+ * @description One VAE this architecture's decode accepts.+ */+ VaeAcceptance: {+ base: components["schemas"]["BaseModelType"];+ /**+ * Latent Channels+ * @description Null unless the base ships VAEs of more than one latent width; only wan does.+ */+ latent_channels?: number | null;+ };/** ValidationError */ValidationError: {/** Location */diff --git a/invokeai/frontend/webv2/src/features/generation/core/__fixtures__/architectureCapabilities.json b/invokeai/frontend/webv2/src/features/generation/core/__fixtures__/architectureCapabilities.jsonindex f10337d012..2be96eaa17 100644--- a/invokeai/frontend/webv2/src/features/generation/core/__fixtures__/architectureCapabilities.json+++ b/invokeai/frontend/webv2/src/features/generation/core/__fixtures__/architectureCapabilities.json@@ -40,6 +40,26 @@"guidance": null,"cpu_only": null,"fp8_storage": null+ },+ "vae": {+ "accepted": [+ {+ "base": "anima",+ "latent_channels": null+ },+ {+ "base": "flux",+ "latent_channels": null+ },+ {+ "base": "qwen-image",+ "latent_channels": null+ },+ {+ "base": "wan",+ "latent_channels": 16+ }+ ]}},{@@ -83,7 +103,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "ernie-image",@@ -126,7 +147,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "flux",@@ -169,7 +191,8 @@"guidance": 3.5,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "flux",@@ -212,7 +235,8 @@"guidance": 30.0,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "flux",@@ -255,7 +279,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "flux2",@@ -298,7 +323,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "flux2",@@ -341,7 +367,8 @@"guidance": 3.5,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "flux2",@@ -384,7 +411,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "flux2",@@ -427,7 +455,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "ideogram-4",@@ -470,7 +499,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "krea-2",@@ -513,6 +543,18 @@"guidance": null,"cpu_only": null,"fp8_storage": null+ },+ "vae": {+ "accepted": [+ {+ "base": "anima",+ "latent_channels": null+ },+ {+ "base": "qwen-image",+ "latent_channels": null+ }+ ]}},{@@ -556,6 +598,18 @@"guidance": null,"cpu_only": null,"fp8_storage": null+ },+ "vae": {+ "accepted": [+ {+ "base": "anima",+ "latent_channels": null+ },+ {+ "base": "qwen-image",+ "latent_channels": null+ }+ ]}},{@@ -599,7 +653,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "qwen-image",@@ -642,6 +697,18 @@"guidance": null,"cpu_only": null,"fp8_storage": null+ },+ "vae": {+ "accepted": [+ {+ "base": "anima",+ "latent_channels": null+ },+ {+ "base": "qwen-image",+ "latent_channels": null+ }+ ]}},{@@ -685,7 +752,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "sd-2",@@ -728,7 +796,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "sd-3",@@ -771,7 +840,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "sdxl",@@ -814,7 +884,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "sdxl-refiner",@@ -857,7 +928,8 @@"guidance": null,"cpu_only": null,"fp8_storage": null- }+ },+ "vae": null},{"base": "wan",@@ -900,6 +972,18 @@"guidance": null,"cpu_only": null,"fp8_storage": null+ },+ "vae": {+ "accepted": [+ {+ "base": "wan",+ "latent_channels": 16+ },+ {+ "base": "wan",+ "latent_channels": 48+ }+ ]}},{@@ -943,6 +1027,18 @@"guidance": null,"cpu_only": null,"fp8_storage": null+ },+ "vae": {+ "accepted": [+ {+ "base": "wan",+ "latent_channels": 16+ },+ {+ "base": "wan",+ "latent_channels": 48+ }+ ]}},{@@ -986,6 +1082,14 @@"guidance": null,"cpu_only": null,"fp8_storage": null+ },+ "vae": {+ "accepted": [+ {+ "base": "flux",+ "latent_channels": null+ }+ ]}},{@@ -1029,6 +1133,14 @@"guidance": null,"cpu_only": null,"fp8_storage": null+ },+ "vae": {+ "accepted": [+ {+ "base": "flux",+ "latent_channels": null+ }+ ]}}]diff --git a/invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.ts b/invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.tsindex af219f45ef..5f57adc376 100644--- a/invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.ts@@ -59,6 +59,14 @@ export interface ArchitectureCapabilitiesRow {cpu_only: boolean | null;fp8_storage: boolean | null;} | null;+ /**+ * Which VAEs this architecture's decode accepts beyond its own base, or null where it accepts+ * only its own. `latent_channels` is null unless the base ships VAEs of more than one width;+ * today only `wan` does, and its two are different decoders.+ */+ vae: {+ accepted: { base: string; latent_channels: number | null }[];+ } | null;}const FALLBACK_STEPS = 30;diff --git a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.tsindex 7202df8374..17de282230 100644--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts@@ -1,4 +1,11 @@-import { seedArchitectureCapabilities } from '@features/generation/core/architectureCapabilities.testing';+import {+ resetArchitectureCapabilities,+ setArchitectureCapabilities,+} from '@features/generation/core/architectureCapabilities';+import {+ architectureCapabilitiesFixture,+ seedArchitectureCapabilities,+} from '@features/generation/core/architectureCapabilities.testing';import { describe, expect, it } from 'vitest';import type {@@ -1254,3 +1261,39 @@ describe('the guidance slider value from a model record', () => {}});});++describe('without the capability table', () => {+ /**+ * The gate has to sit where every enqueue path passes, not only where the Generate widget looks.+ * `getGenerationValidationReasons` is that place: graph.ts, compileCanvasGraph.ts and+ * previewGraph.ts all call it. Gating only the widget's resolver left the canvas and the topbar+ * compiling against FALLBACK_GENERATION_CONFIG — a grid of 8 for bases that reject anything but+ * 16, which is the enqueue failure this feature exists to prevent.+ */+ it('blocks every model, including ones that are otherwise fine', () => {+ const model = createModel('flux', { variant: 'dev' });+ const settings = createSettings(model);++ // Seeded by the file-level fixture; drop it to stand in for a failed or in-flight fetch.+ resetArchitectureCapabilities();++ const reasons = getGenerationValidationReasons(model, settings);++ expect(reasons.length).toBeGreaterThan(0);+ // Not "needs a supported model": that is the answer the fallback gives, and it sends the reader+ // looking at their model instead of at the backend.+ expect(reasons[0]).toMatch(/capabilities/i);+ });++ it('stops blocking once the table arrives', () => {+ const model = createModel('flux', { variant: 'dev' });+ const settings = createSettings(model);++ resetArchitectureCapabilities();+ expect(getGenerationValidationReasons(model, settings)[0]).toMatch(/capabilities/i);++ setArchitectureCapabilities(architectureCapabilitiesFixture);++ expect(getGenerationValidationReasons(model, settings)[0] ?? '').not.toMatch(/capabilities/i);+ });+});diff --git a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.tsindex 0767f192df..fe8d652e5f 100644--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts@@ -8,6 +8,7 @@ import type { BaseGenerationConfig, GuidanceLabel } from '@features/generation/cimport {getArchitectureFeatures,getArchitectureGenerationConfig,+ hasArchitectureCapabilities,} from '@features/generation/core/architectureCapabilities';import {isSupportedGenerateBase,@@ -32,6 +33,7 @@ import {isAnimaQwen3Encoder,isAnimaVae,isKrea2Vae,+ isQwenImageFamilyVae,isClipVariant,isDiffusersMainForBase,isFlux2DiffusersSourceForModel,@@ -983,7 +985,7 @@ const getBaseComponentSectionPolicy = ({...vaeSlot('Optional override, or required with a non-Diffusers model and no component source.',- isVaeForBases(['qwen-image'])+ isQwenImageFamilyVae),required: (ctx) => !isBundledOrDiffusersSourceSatisfied(ctx),missingMessage: 'Generate needs a VAE for non-Diffusers Qwen Image models.',@@ -1613,6 +1615,16 @@ const getModelFamilyValidationReasons = (model: MainModelConfig, settings: Gener};export const getGenerationValidationReasons = (model: GenerateModelConfig, settings: GenerateSettings): string[] => {+ // Before anything else, and before the unsupported-model reason: without the capability table+ // every answer below is the fallback's, not the architecture's -- a grid of 8 for a base that+ // rejects anything but 16, and "no supported model" for a model that is perfectly supported.+ // This is the one function all three compile paths share (graph.ts, compileCanvasGraph.ts,+ // previewGraph.ts), so gating here is what makes the canvas and the topbar fail closed too,+ // rather than only the Generate widget's own resolver.+ if (!hasArchitectureCapabilities()) {+ return ['Model capabilities have not loaded yet. Generation is blocked until they arrive.'];+ }+if (!isSupportedGenerateModel(model)) {return ['Generate needs a supported model before it can be invoked.'];}diff --git a/invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.test.ts b/invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.test.tsindex 8afbc426f4..2c282513e7 100644--- a/invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.test.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.test.ts@@ -215,7 +215,9 @@ describe('the support matrix and the served capabilities', () => {expect(declaredSupported.length).toBeGreaterThan(0);for (const base of declaredSupported) {- expect(getRegionalGuidanceSupport(base), base).not.toBeNull();+ // `toBeTruthy`, not `not.toBeNull`: a base with no row reaches this as `undefined`, which+ // passes a null check and made this guard inert for exactly the drift it exists to catch.+ expect(getRegionalGuidanceSupport(base), base).toBeTruthy();}});});diff --git a/invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts b/invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.tsindex 1f80915208..534c922526 100644--- a/invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts@@ -54,7 +54,12 @@ const REGIONAL_GUIDANCE_SUPPORT: Record<RegionalGuidanceBase, RegionalGuidanceSu* in. Only the *answer* comes from the capability table now.*/export const isRegionalGuidanceSupportedForBase = (base: string): base is RegionalGuidanceBase =>- getArchitectureFeatures(base)?.supports_regional_guidance ?? false;+ // Both halves, or the predicate is unsound: it narrows to the key set of the matrix below, while+ // the backend's answer is what decides. A base the backend newly declares supported but that has+ // no row here would satisfy the old check, and `REGIONAL_GUIDANCE_SUPPORT[base]` would then hand+ // back `undefined` typed as a support object. Requiring the row keeps the type honest and makes+ // the drift a missing feature rather than a crash.+ (getArchitectureFeatures(base)?.supports_regional_guidance ?? false) && base in REGIONAL_GUIDANCE_SUPPORT;/*** The per-base support matrix, or `null` for a base with no regional path.diff --git a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.ts b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.tsindex f0a78c754d..b5e063f7f5 100644--- a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.ts@@ -1,6 +1,10 @@+import {+ seedArchitectureCapabilities,+ architectureCapabilitiesFixture,+} from '@features/generation/core/architectureCapabilities.testing';import { describe, expect, it } from 'vitest';-import type { ComponentModelConfig, GenerateModelConfig } from './types';+import type { ComponentModelConfig, GenerateModelConfig, VaeModelConfig } from './types';import {getCompatibleSelectedComponentKey,@@ -37,6 +41,8 @@ const FLUX1_SDNQ_COMPONENTS = [...STANDARD_SDNQ_COMPONENTS, 'text_encoder_2', 'tconst submodelsWithout = (components: readonly string[], missing: string): Record<string, object> =>Object.fromEntries(components.filter((component) => component !== missing).map((component) => [component, {}]));+seedArchitectureCapabilities();+describe('Generate component compatibility', () => {it('only treats SDNQ folders with every required pipeline component as self-contained', () => {const complete = candidate({@@ -179,3 +185,42 @@ describe('isVaeForBases', () => {expect(isVaeForBases(['flux'])({ base: 'flux', type: 'main' } as never)).toBe(false);});});++describe('the VAE filters and the backend declarations', () => {+ /**+ * webv2 keeps its own copy of which VAE bases a model accepts, and the backend now declares the+ * same fact in `VaeFacet`. Two copies drift: this PR widened qwen-image to accept the anima+ * registration and the picker kept refusing it, so a VAE the backend would have loaded could not+ * be selected. Binding the filter to the served table is what makes the next widening show up+ * here instead of in a user's model list.+ */+ it('accepts every VAE base the backend declares for that architecture', () => {+ const declared = architectureCapabilitiesFixture.filter((row) => row.vae);+ expect(declared.length).toBeGreaterThan(0);++ for (const row of declared) {+ const model = {+ base: row.base,+ key: `${row.base}-main`,+ name: row.base,+ type: 'main' as const,+ } as unknown as GenerateModelConfig;++ for (const accepted of row.vae!.accepted) {+ const vae = {+ base: accepted.base,+ key: `${accepted.base}-vae`,+ name: `${accepted.base} vae`,+ type: 'vae' as const,+ // Only wan distinguishes VAEs by latent width; the others leave it null.+ ...(accepted.latent_channels === null ? {} : { latent_channels: accepted.latent_channels }),+ } as unknown as VaeModelConfig;++ expect(+ isVaeCompatibleWithGenerateModel(model, vae),+ `${row.base} should accept a VAE registered under ${accepted.base}`+ ).toBe(true);+ }+ }+ });+});diff --git a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.tsindex 25bd4c30ea..fdb9a7300a 100644--- a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts@@ -4,6 +4,8 @@ export type GenerateComponentCandidate = {base: string;format?: string;key?: string;+ /** VAE latent width. Only `wan` ships more than one, and its two are different decoders. */+ latent_channels?: number | null;submodels?: Record<string, unknown> | null;type: string;variant?: unknown;@@ -139,7 +141,15 @@ export const getCompatibleDiffusersComponentSource = <T extends GenerateComponen): T | undefined =>source && isCompatibleDiffusersComponentSourceForModel(selectedModel, source) ? source : undefined;-export const isAnimaVae = isVaeForBases(['anima', 'qwen-image', 'flux']);+/**+ * Anima's decode takes an `AutoencoderKLWan` or a `FluxAutoEncoder`, and the Wan-family file is the+ * same 194-tensor checkpoint whichever base it was installed under — see the `VaeFacet` in+ * `architectures/defs/anima.py`, which is where this list is declared. The 48-channel Wan VAE is a+ * different decoder, so the width is part of the condition rather than the base alone.+ */+export const isAnimaVae: GenerateComponentFilter = (model) =>+ model.type === 'vae' &&+ (['anima', 'qwen-image', 'flux'].includes(model.base) || (model.base === 'wan' && model.latent_channels === 16));/*** Krea-2 decodes with the Qwen-Image VAE (16-channel), which is why its graph reuses@@ -148,7 +158,16 @@ export const isAnimaVae = isVaeForBases(['anima', 'qwen-image', 'flux']);* `krea2_model_loader`'s own `ui_model_base=[QwenImage, Anima]`. Restricting this to* `qwen-image` hides a working VAE that the backend would have accepted.*/-export const isKrea2Vae = isVaeForBases(['qwen-image', 'anima']);+/**+ * Qwen-Image's VAE, wherever it is registered from.+ *+ * The same weights ship registered under either base, which is why the backend's `VaeFacet` for+ * qwen-image accepts both — see `architectures/defs/qwen_image.py`. Krea-2 decodes with this VAE+ * too, so it shares the predicate rather than keeping a second list that can drift from it.+ */+export const isQwenImageFamilyVae = isVaeForBases(['qwen-image', 'anima']);++export const isKrea2Vae = isQwenImageFamilyVae;export const isVaeCompatibleWithGenerateModel = (model: GenerateModelConfig, vae: VaeModelConfig): boolean => {if (model.type === 'external_image_generator') {@@ -161,7 +180,7 @@ export const isVaeCompatibleWithGenerateModel = (model: GenerateModelConfig, vaecase 'z-image':return isVaeForBases(['flux'])(vae);case 'qwen-image':- return isVaeForBases(['qwen-image'])(vae);+ return isQwenImageFamilyVae(vae);case 'krea-2':return isKrea2Vae(vae);case 'flux2':diff --git a/invokeai/frontend/webv2/src/workbench/activeInvocationSubmission.test.ts b/invokeai/frontend/webv2/src/workbench/activeInvocationSubmission.test.tsindex dafa826db9..91297354a4 100644--- a/invokeai/frontend/webv2/src/workbench/activeInvocationSubmission.test.ts+++ b/invokeai/frontend/webv2/src/workbench/activeInvocationSubmission.test.ts@@ -1,6 +1,7 @@import type { MainModelConfig } from '@features/generation/contracts';import type { AccountScope } from '@platform/state/accountLifecycle';+import { seedArchitectureCapabilities } from '@features/generation/core/architectureCapabilities.testing';import { getDefaultGenerateSettings } from '@features/generation/settings';import { describe, expect, it } from 'vitest';@@ -10,6 +11,10 @@ import { submitActiveInvocation, type ActiveInvocationSubmissionRuntime } from 'import { isCanvasInvocationPreparing } from './canvasInvocationPreparation';import { createInitialWorkbenchState, workbenchReducer } from './workbenchState.testing';+// Generation policy now fails closed without the capability table, and a submission cannot+// happen before app boot has fetched it. Seeding it here is what the running app does.+seedArchitectureCapabilities();+const owner = { signal: new AbortController().signal } as AccountScope;const createArgs = (state = createInitialWorkbenchState()) => {diff --git a/invokeai/frontend/webv2/src/workbench/graphPreviewInvocation.test.ts b/invokeai/frontend/webv2/src/workbench/graphPreviewInvocation.test.tsindex d9498da053..014e1f1cc5 100644--- a/invokeai/frontend/webv2/src/workbench/graphPreviewInvocation.test.ts+++ b/invokeai/frontend/webv2/src/workbench/graphPreviewInvocation.test.ts@@ -5,6 +5,7 @@ import type {ComponentModelConfig,} from '@features/generation/contracts';+import { seedArchitectureCapabilities } from '@features/generation/core/architectureCapabilities.testing';import { getDefaultGenerateSettings } from '@features/generation/settings';import { captureAccountScope } from '@platform/state/accountLifecycle';import { createInitialWorkbenchState, workbenchReducer } from '@workbench/workbenchState.testing';@@ -13,6 +14,10 @@ import { describe, expect, it, vi } from 'vitest';import { resolveAndSubmitGraphPreviewInvocation } from './graphPreviewInvocation';+// Generation policy now fails closed without the capability table, and a submission cannot+// happen before app boot has fetched it. Seeding it here is what the running app does.+seedArchitectureCapabilities();+const animaModel: MainModelConfig = { base: 'anima', key: 'anima-model', name: 'Anima', type: 'main' };const animaVae: VaeModelConfig = { base: 'qwen-image', key: 'anima-vae', name: 'Anima VAE', type: 'vae' };const qwen3Encoder: ComponentModelConfig = {diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.test.tsindex 86e35f06a0..30c2d2605f 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts@@ -17,6 +17,7 @@ import {legacyGeneratedImageToGalleryItem,registerImageCluster,} from '@features/gallery/contracts';+import { seedArchitectureCapabilities } from '@features/generation/core/architectureCapabilities.testing';import { MAX_PROMPT_HISTORY } from '@features/generation/settings';import { createDefaultUpscaleWidgetValues } from '@features/upscale';import { getDocumentLeaves } from '@workbench/canvas-engine/api';@@ -48,6 +49,10 @@ import {workbenchReducer as reduceWorkbench,} from './workbenchState.testing';+// Generation policy now fails closed without the capability table, and a submission cannot+// happen before app boot has fetched it. Seeding it here is what the running app does.+seedArchitectureCapabilities();+const generationDeviceMock = vi.hoisted(() => ({options: [] as { device: string; name: string }[],}));