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
Merge upstream/main into integration/upstream-main-2026-08-16
joshistoast5361ff25abbd
diff --cc invokeai/app/api/routers/utilities.pyindex 40115e324b,0ede5441c4..9db324ce44--- a/invokeai/app/api/routers/utilities.py+++ b/invokeai/app/api/routers/utilities.py@@@ -17,8 -19,8 +17,9 @@@ from invokeai.app.api.routers.image_movfrom invokeai.app.services.events.events_base import EventServiceBasefrom invokeai.app.services.image_files.image_files_common import ImageFileNotFoundExceptionfrom invokeai.app.services.model_records.model_records_base import UnknownModelException-from invokeai.app.util.dynamicprompts import find_missing_wildcards+from invokeai.app.services.wildcard_records.wildcard_records_common import build_wildcard_manager+from invokeai.app.util.dynamicprompts import expand_dynamic_prompt+ from invokeai.app.util.misc import SEED_MAX, get_random_seedfrom invokeai.backend.llava_onevision_pipeline import LlavaOnevisionPipelinefrom invokeai.backend.model_manager.taxonomy import ModelTypefrom invokeai.backend.text_llm_pipeline import DEFAULT_SYSTEM_PROMPT, ProgressCallback, TextLLMPipelinediff --cc invokeai/app/api/sockets.pyindex d4249bcb65,83f7be27f0..1e1327e17e--- a/invokeai/app/api/sockets.py+++ b/invokeai/app/api/sockets.py@@@ -626,10 -607,9 +626,11 @@@ class SocketIO)return- # Model install events feed an admin-only UI and may expose details about privileged- # operations, so keep the fork's admin-only routing. Other download events retain their- # existing broadcast behavior.- if isinstance(event_data, MODEL_INSTALL_EVENTS):+ # Model install and download events contain signed source URLs and server filesystem+ # paths. They feed the admin-only model manager UI and must not be broadcast to users.- if isinstance(event_data, (DownloadEventBase, ModelEventBase)):++ # Keep the explicit install tuple alongside the base classes: it documents the install++ # family registered by this server while the bases cover every download/model subtype.++ if isinstance(event_data, MODEL_INSTALL_EVENTS + (DownloadEventBase, ModelEventBase)):await self._sio.emit(event=event_name, data=event_data.model_dump(mode="json"), room="admin")returndiff --cc invokeai/app/api_app.pyindex 495ab10e99,b89746dcac..4f68fd3cd2--- a/invokeai/app/api_app.py+++ b/invokeai/app/api_app.py@@@ -28,9 -28,7 +28,8 @@@ from invokeai.app.api.routers importboards,client_state,custom_nodes,- download_queue,gallery,+ image_map,image_moves,images,model_manager,@@@ -411,10 -407,8 +410,9 @@@ app.add_middleware(GZipMiddleware, miniapp.include_router(auth.auth_router, prefix="/api")app.include_router(utilities.utilities_router, prefix="/api")app.include_router(model_manager.model_manager_router, prefix="/api")- app.include_router(download_queue.download_queue_router, prefix="/api")app.include_router(image_moves.image_moves_router, prefix="/api")app.include_router(images.images_router, prefix="/api")+app.include_router(image_map.image_map_router, prefix="/api")app.include_router(videos.videos_router, prefix="/api")app.include_router(gallery.gallery_router, prefix="/api")app.include_router(boards.boards_router, prefix="/api")diff --cc invokeai/app/services/boards/boards_default.pyindex 2048fcc322,8088e2b0e4..e7bfe4b887--- a/invokeai/app/services/boards/boards_default.py+++ b/invokeai/app/services/boards/boards_default.py@@@ -139,11 -115,24 +113,27 @@@ class BoardService(BoardServiceABC)board_records = self.__invoker.services.board_records.get_all(user_id, is_admin, order_by, direction, include_archived)- board_ids = [record.board_id for record in board_records]- summaries = self.__invoker.services.gallery.get_board_media_summaries(board_ids)- # One lookup for the whole listing, not one per row.- project_ids = self.__invoker.services.board_records.get_project_ids_for_boards(board_ids)- board_dtos = []+ return self._to_dtos(board_records, is_admin)++ def _to_dtos(self, board_records: list[BoardRecord], is_admin: bool) -> list[BoardDTO]:+ """Builds board DTOs for a listing with a fixed number of queries.++ Both the media summaries and (for admins) the owner display names are fetched for+ the whole page at once. The owner lookup used to run one `users.get` per board, so+ an admin listing 50 boards issued 50 extra queries for what is usually a handful of+ distinct owners.+ """+ summaries = self.__invoker.services.gallery.get_board_media_summaries(+ [record.board_id for record in board_records]+ )++ project_ids = self.__invoker.services.board_records.get_project_ids_for_boards(++ [record.board_id for record in board_records]++ )+ owners = (+ self.__invoker.services.users.get_many([record.user_id for record in board_records]) if is_admin else {}+ )++ board_dtos: list[BoardDTO] = []for r in board_records:summary = summaries[r.board_id]diff --cc invokeai/app/services/image_files/image_files_disk.pyindex d2674e768c,133c71ab05..d806ecd029--- a/invokeai/app/services/image_files/image_files_disk.py+++ b/invokeai/app/services/image_files/image_files_disk.py@@@ -178,43 -185,18 +185,53 @@@ class DiskImageFileStorage(ImageFileStoself.__set_cache(image_path, image)self.__set_cache(thumbnail_path, thumbnail_image)except Exception as e:+ # A thumbnail failure must not leave a full-size image with no thumbnail. The+ # names are normally new, but preserve any pre-existing files when save() is+ # used to overwrite an existing image.+ for path, existed in ((image_path, image_existed), (thumbnail_path, thumbnail_existed)):+ if path is not None and not existed:+ try:+ path.unlink(missing_ok=True)+ except OSError:+ pass+ self.evict_cache_paths([path for path in (image_path, thumbnail_path) if path is not None])raise ImageFileSaveException from e+ def copy(+ self,+ source_image_name: str,+ image_name: str,+ source_subfolder: str = "",+ image_subfolder: str = "",+ thumbnail_size: int = 256,+ ) -> None:+ """Duplicate an image's files under a new name, without decoding them.++ `shutil.copy2` is both cheapest and most faithful: every PNG chunk travels, including ones+ this application does not parse and would drop on a re-encode. Nothing is cached — a copy+ nobody has read yet has no business occupying a slot.+ """+ try:+ self.__validate_storage_folders()+ source_path = self.get_path(source_image_name, image_subfolder=source_subfolder)+ image_path = self.get_path(image_name, image_subfolder=image_subfolder)+ image_path.parent.mkdir(parents=True, exist_ok=True)+ shutil.copy2(source_path, image_path)++ source_thumbnail_path = self.get_path(source_image_name, thumbnail=True, image_subfolder=source_subfolder)+ thumbnail_path = self.get_path(image_name, thumbnail=True, image_subfolder=image_subfolder)+ thumbnail_path.parent.mkdir(parents=True, exist_ok=True)++ if source_thumbnail_path.exists():+ shutil.copy2(source_thumbnail_path, thumbnail_path)+ else:+ # A source predating thumbnails, or one whose thumbnail was lost. Rare enough to be+ # worth a decode rather than leaving the copy with a broken gallery tile.+ with Image.open(image_path) as copied:+ make_thumbnail(copied, thumbnail_size).save(thumbnail_path)+ except Exception as e:+ raise ImageFileSaveException from e+def delete(self, image_name: str, image_subfolder: str = "") -> None:token = self.stage_delete(image_name, image_subfolder)self.commit_delete(token)diff --cc invokeai/backend/model_manager/configs/main.pyindex e98b0979be,73b68f23fb..a77233c3e7--- a/invokeai/backend/model_manager/configs/main.py+++ b/invokeai/backend/model_manager/configs/main.py@@@ -29,8 -33,8 +33,9 @@@ from invokeai.backend.model_manager.taxFlux2VariantType,FluxVariantType,Krea2VariantType,+ MiniMaxH3VariantType,ModelFormat,+ ModelRepoVariant,ModelType,ModelVariantType,QwenImageVariantType,diff --cc invokeai/backend/model_manager/load/model_cache/model_cache.pyindex 1c062e2078,213e4bbd2a..3be3170f57--- a/invokeai/backend/model_manager/load/model_cache/model_cache.py+++ b/invokeai/backend/model_manager/load/model_cache/model_cache.py@@@ -669,11 -724,18 +730,23 @@@ class ModelCache# everything unlocked, so the only entry a self-reconcile could ever claim is the# model just admitted — evicting it out from under its own loader.)+ # Synced last, not right after the model is counted: request_budget_reconcile() above can+ # evict inline on a peer, and cache_used reads the shared budget's global usage, so syncing+ # before that loop would report a pre-reconcile (too high) figure.+ self._sync_current_stats()++ def _warn_once(self, topic: str, device: torch.device, message: str) -> None:+ """Log `message` the first time `topic` arises for `device`.++ Undecorated on purpose: only ever called from put(), which already holds the cache lock+ and records activity.+ """+ key = (topic, str(device))+ if key in self._warned_once:+ return+ self._warned_once.add(key)+ self._logger.warning(message)+def cached_model_keys(self) -> set[str]:"""Return the base model keys of every model currently resident in this cache.diff --cc invokeai/frontend/web/src/features/controlLayers/store/paramsSlice.tsindex e440fa339d,f7c8420dad..b9cc2c00c9--- a/invokeai/frontend/web/src/features/controlLayers/store/paramsSlice.ts+++ b/invokeai/frontend/web/src/features/controlLayers/store/paramsSlice.ts@@@ -1005,135 -974,219 +1008,256 @@@ export constsetAnimaScheduler,} = slice.actions;- export const paramsSliceConfig: SliceConfig<typeof slice> = {- slice,- schema: zParamsState,- getInitialState: getInitialParamsState,- persistConfig: {- migrate: (state) => {- assert(isPlainObject(state));+ /**+ * Last-resort repair for the persisted params slice, applied after the version steps have run.+ *+ * The `zParamsState.parse()` at the end of `migrate()` is all-or-nothing: a single missing required+ * key throws, and the caller in `store.ts` catches it and falls back to the initial state — silently+ * wiping every generation param the user had (prompts, prompt history, model selection, dimensions).+ * That has happened whenever a key was added to the schema with neither a `.default()` nor a seed in+ * the migration chain, which is what the Wan and post-v3 seeds above exist to undo.+ *+ * Repairing the offending key turns that into "one field sits at its default" instead of "the user+ * lost everything". Two kinds of damage are repaired, both per key:+ * - `backfilled`: the key is *absent* and the schema cannot fill it itself. Anything with+ * `.default()` / `.catch()` / `.optional()` is left to zod, so the schema's own default stays+ * authoritative.+ * - `reset`: the key is present but its value does not satisfy that field's schema. Whatever the+ * cause — a tightened field schema, a hand-edited blob, a half-applied migration — resetting the+ * one field is strictly better than the alternative, which is `store.ts` discarding all of them.+ * Note the granularity is one top-level key, so this is not always cheap: one malformed entry in+ * `positivePromptHistory` costs the whole history, and a `model` whose `base` has since been+ * removed from `zBaseModelType` (the external-API bases dropped in v6.9.0rc1, say) clears the+ * user's model selection. Both are still a single field rather than every field.+ *+ * This is a safety net, not a substitute for a migration step — it fills fields with *today's*+ * initial value, which is only the right answer for genuinely new fields. `paramsSlice.test.ts`+ * asserts nothing needs repairing for real persisted blobs, so a forgotten seed still fails CI.+ *+ * Exported for that test.+ */+ export const repairParamsState = (state: Record<string, unknown>): { backfilled: string[]; reset: string[] } => {+ const initial = getInitialParamsState() as unknown as Record<string, unknown>;+ const backfilled: string[] = [];+ const reset: string[] = [];- if (!('_version' in state)) {- // v0 -> v1, add _version and remove x/y from dimensions, lifting width/height to top level- state._version = 1;- state.dimensions.width = state.dimensions.rect.width;- state.dimensions.height = state.dimensions.rect.height;- }+ for (const [key, fieldSchema] of Object.entries(zParamsState.shape)) {+ // Never touch `_version`: it is the input to the version steps, so repairing it would stamp a+ // blob as current having run no step at all. A `_version` from the future (a downgrade) is+ // deliberately still fatal — that slice really was written by a newer schema.+ if (key === '_version') {+ continue;+ }- if (state._version === 1) {- // v1 -> v2, add positive prompt history- state._version = 2;- state.positivePromptHistory = [];+ if (state[key] === undefined) {+ // `undefined` is the only value that counts as missing: persisted JSON can't hold it, and+ // every nullable field in the schema uses `null` for "unset".+ if (!fieldSchema.safeParse(undefined).success) {+ state[key] = initial[key];+ backfilled.push(key);}+ continue;+ }- if (state._version === 2) {- // v2 -> v3, add standalone Qwen Image VAE and Qwen VL encoder fields- state._version = 3;- state.qwenImageVaeModel = null;- state.qwenImageQwenVLEncoderModel = null;- }+ if (!fieldSchema.safeParse(state[key]).success) {+ state[key] = initial[key];+ reset.push(key);+ }+ }- if (state._version === 3) {- // v3 -> v4, add Krea-2 standalone component and conditioning enhancer fields and the- // PiD (Pixel Diffusion Decoder) fields. Also seed the Wan component fields — they were- // added to the schema without a version bump while releases were still writing v3 blobs,- // and they're nullable with no default, so a genuine released-build v3 blob without them- // fails zParamsState.parse() and wipes the whole slice. Seed only when missing: dev-build- // v3 blobs written after the Wan merge already carry (possibly non-null) values.- state._version = 4;- state.krea2VaeModel = null;- state.krea2Qwen3VlEncoderModel = null;- state.krea2SeedVarianceEnabled = false;- state.krea2SeedVarianceStrength = 0.1;- state.krea2SeedVarianceRandomizePercent = 50;- state.krea2RebalanceEnabled = false;- state.krea2RebalanceMultiplier = 4;- state.krea2RebalanceWeights = '1.0,1.0,1.0,1.0,1.0,1.0,1.0,2.5,5.0,1.1,4.0,1.0';- state.pidMode = 'off';- state.pidDecoderModel = null;- state.gemma2EncoderModel = null;- state.pidSteps = 4;- state.wanTransformerLowNoise = state.wanTransformerLowNoise ?? null;- state.wanComponentSource = state.wanComponentSource ?? null;- state.wanVaeModel = state.wanVaeModel ?? null;- state.wanT5EncoderModel = state.wanT5EncoderModel ?? null;- state.wanGuidanceScaleLowNoise = state.wanGuidanceScaleLowNoise ?? null;- }+ return { backfilled, reset };+ };- if (state._version === 4) {- // v4 -> v5, merge the separate Klein / [dev] FLUX.2 VAE slots into one shared- // flux2VaeModel (both drew from the same FLUX.2 VAE pool — keep whichever was set) and- // seed the new standalone [dev] Mistral encoder slot. Both parents of the FLUX.2 [dev]- // merge shipped incompatible schemas under _version 4 (main added the PiD fields; the- // [dev] branch added the flux2 fields), so a v4 blob may be missing either side's keys —- // every seed here is conditional, and the PiD keys are re-seeded for blobs written by- // pre-merge [dev] builds. All are nullable-with-no-default, so any missing key would- // fail zParamsState.parse() and wipe the whole slice.- state._version = 5;- state.flux2VaeModel = state.flux2VaeModel ?? state.kleinVaeModel ?? state.flux2DevVaeModel ?? null;- state.flux2DevMistralEncoderModel = state.flux2DevMistralEncoderModel ?? null;- delete state.kleinVaeModel;- delete state.flux2DevVaeModel;- state.pidMode = state.pidMode ?? 'off';- state.pidDecoderModel = state.pidDecoderModel ?? null;- state.gemma2EncoderModel = state.gemma2EncoderModel ?? null;- state.pidSteps = state.pidSteps ?? 4;- }+ /**+ * Bring a persisted params blob up to the current `_version` in place.+ *+ * Every key added to `zParamsState` without a zod default must be seeded by the step for the version+ * that predates it, or upgrading users lose the whole slice — see `repairParamsState`. Note that+ * the *current* version has no step by definition, so a key added after the last bump needs a zod+ * default (as the ERNIE-Image and PiD fields have) rather than a seed.+ *+ * Exported so the tests can assert the version steps alone are complete, without the safety net+ * hiding a missing seed.+ */+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ export const applyParamsVersionMigrations = (state: any): void => {+ // Value check rather than `!('_version' in state)`. The two are equivalent on real input, since+ // the only production caller feeds this `JSON.parse` output, which cannot produce an explicit+ // `undefined` — but a value check is what the rest of this file uses, and with a presence check a+ // blob carrying `_version: undefined` would match no branch at all, reach the parse and take the+ // whole slice down.+ if (state._version === undefined) {+ // v0 -> v1, add _version and remove x/y from dimensions, lifting width/height to top level.+ // `dimensions.rect` is guarded: a truncated or hand-edited blob that lacks it would otherwise+ // throw a TypeError out of migrate() and cost the user the whole slice. What that leaves behind+ // — a `dimensions` object with no width/height — fails its own field schema, so+ // repairParamsState() swaps in the initial dimensions instead of letting the parse wipe+ // everything else along with it.+ state._version = 1;+ if (state.dimensions === undefined) {+ // The oldest v0 builds (v6.0.0a1 - v6.0.0rc3) had no `dimensions` key at all; it arrives in+ // v6.0.0rc4. Seeding it here rather than leaving it to the repair pass is what keeps the+ // version steps self-sufficient for the v0 tier.+ state.dimensions = getInitialParamsState().dimensions;+ } else if (state.dimensions && state.dimensions.rect) {+ state.dimensions.width = state.dimensions.rect.width;+ state.dimensions.height = state.dimensions.rect.height;+ }+ }- if (state._version === 5) {- // v5 -> v6, add the MiniMax H3 duration and output-mode fields.- //- // This step was written as v4 -> v5 on this branch, but main landed its own v4 -> v5- // (the FLUX.2 [dev] VAE/encoder merge) first. Keeping both as v4 -> v5 silently breaks- // the migration: the block above sets _version = 5, so a v4 blob would skip this one- // and reach zParamsState.parse() without the H3 keys — which are required with no- // default, so the parse throws and the whole params slice is wiped on upgrade. Running- // as v5 -> v6 covers both a v4 blob (via main's step) and any v5 blob already written- // by a released build.- state._version = 6;- // Seeded conditionally, like every other step here: a genuine v5 blob predates these keys,- // but a blob that already carries them must keep its values rather than be reset.- state.minimaxH3DurationSeconds = state.minimaxH3DurationSeconds ?? 5;- state.minimaxH3OutputMode = state.minimaxH3OutputMode ?? 'video';- }+ if (state._version === 1) {+ // v1 -> v2, add positive prompt history+ state._version = 2;+ state.positivePromptHistory = [];+ }- if (state._version === 6) {- // v6 -> v7, add the MiniMax H3 single-file transformer override.- //- // Written as v5 -> v6 on this branch, but the H3 duration/output-mode step above already- // occupies v5 -> v6 on main. Two steps sharing a version silently breaks the chain: the- // first sets _version = 6, the second never runs, and zParamsState.parse() then throws on- // the missing key and wipes the whole params slice. See the comment above for the same- // collision one version earlier.- state._version = 7;- state.minimaxH3TransformerModel = null;- }+ if (state._version === 2) {+ // v2 -> v3, add standalone Qwen Image VAE and Qwen VL encoder fields+ state._version = 3;+ state.qwenImageVaeModel = null;+ state.qwenImageQwenVLEncoderModel = null;- if (state._version === 7) {- // v7 -> v8, add the MiniMax H3 single-file text encoder override.- //- // Written as v6 -> v7 on this branch, but the transformer-override step above already- // occupies v6 -> v7 on main. Two steps sharing a version silently breaks the chain: the- // first sets _version = 7, the second never runs, and zParamsState.parse() then throws on- // the missing key and wipes the whole params slice.- state._version = 8;- state.minimaxH3TextEncoderModel = null;- }+ // Everything below was added to the schema while releases were still persisting v2 blobs+ // (v6.7.0 - v6.12.0), but without a version bump. None has a zod default, which makes them+ // required, so their absence fails the parse() at the end of migrate() and silently wipes the+ // whole slice on upgrade. Seed only when missing so that v2 blobs written by dev builds after+ // each field landed keep the values they already hold.+ //+ // The oldest v2 releases (v6.7.0 - v6.9.0) are missing these six as well as everything below.+ state.fluxScheduler = state.fluxScheduler ?? 'euler';+ state.zImageScheduler = state.zImageScheduler ?? 'euler';+ state.colorCompensation = state.colorCompensation ?? false;+ state.zImageVaeModel = state.zImageVaeModel ?? null;+ state.zImageQwen3EncoderModel = state.zImageQwen3EncoderModel ?? null;+ state.zImageQwen3SourceModel = state.zImageQwen3SourceModel ?? null;+ // Added by v6.10.0 - v6.12.0 and later.+ state.fluxDypePreset = state.fluxDypePreset ?? 'off';+ state.fluxDypeScale = state.fluxDypeScale ?? 2.0;+ state.fluxDypeExponent = state.fluxDypeExponent ?? 2.0;+ state.zImageShift = state.zImageShift ?? null;+ state.zImageSeedVarianceEnabled = state.zImageSeedVarianceEnabled ?? false;+ state.zImageSeedVarianceStrength = state.zImageSeedVarianceStrength ?? 0.1;+ state.zImageSeedVarianceRandomizePercent = state.zImageSeedVarianceRandomizePercent ?? 50;+ state.animaVaeModel = state.animaVaeModel ?? null;+ state.animaQwen3EncoderModel = state.animaQwen3EncoderModel ?? null;+ state.animaScheduler = state.animaScheduler ?? 'euler';+ // No `kleinVaeModel` seed: the v4 -> v5 step below folds that slot into `flux2VaeModel` and+ // deletes it, so it is no longer part of the schema and needs nothing here.+ state.kleinQwen3EncoderModel = state.kleinQwen3EncoderModel ?? null;+ state.qwenImageComponentSource = state.qwenImageComponentSource ?? null;+ state.qwenImageQuantization = state.qwenImageQuantization ?? 'none';+ state.qwenImageShift = state.qwenImageShift ?? null;+ }- if (!('hiDiffusionEnabled' in state)) {- state.hiDiffusionEnabled = false;- }- if (!('hiDiffusionRauNetEnabled' in state)) {- state.hiDiffusionRauNetEnabled = true;- }- if (!('hiDiffusionWindowAttnEnabled' in state)) {- state.hiDiffusionWindowAttnEnabled = true;- }- if (!('hiDiffusionT1Ratio' in state)) {- state.hiDiffusionT1Ratio = 0.4;+ if (state._version === 3) {+ // v3 -> v4, add Krea-2 standalone component and conditioning enhancer fields, and the+ // PiD (Pixel Diffusion Decoder) fields. Also seed the Wan component fields — they were+ // added to the schema without a version bump while releases were still writing v3 blobs,+ // and they're nullable with no default, so a genuine released-build (v6.13.x) v3 blob+ // without them fails zParamsState.parse() below, which wipes the whole slice on upgrade.+ // Seed only when missing: dev-build v3 blobs written after the Wan merge already carry+ // (possibly non-null) values.+ state._version = 4;+ state.krea2VaeModel = null;+ state.krea2Qwen3VlEncoderModel = null;+ state.krea2SeedVarianceEnabled = false;+ state.krea2SeedVarianceStrength = 0.1;+ state.krea2SeedVarianceRandomizePercent = 50;+ state.krea2RebalanceEnabled = false;+ state.krea2RebalanceMultiplier = 4;+ state.krea2RebalanceWeights = '1.0,1.0,1.0,1.0,1.0,1.0,1.0,2.5,5.0,1.1,4.0,1.0';+ state.pidMode = 'off';+ state.pidDecoderModel = null;+ state.gemma2EncoderModel = null;+ state.pidSteps = 4;+ state.wanTransformerLowNoise = state.wanTransformerLowNoise ?? null;+ state.wanComponentSource = state.wanComponentSource ?? null;+ state.wanVaeModel = state.wanVaeModel ?? null;+ state.wanT5EncoderModel = state.wanT5EncoderModel ?? null;+ state.wanGuidanceScaleLowNoise = state.wanGuidanceScaleLowNoise ?? null;+ }++ if (state._version === 4) {+ // v4 -> v5, merge the separate Klein / [dev] FLUX.2 VAE slots into one shared+ // flux2VaeModel (both drew from the same FLUX.2 VAE pool — keep whichever was set) and+ // seed the new standalone [dev] Mistral encoder slot. Both parents of the FLUX.2 [dev]+ // merge shipped incompatible schemas under _version 4 (main added the PiD fields; the+ // [dev] branch added the flux2 fields), so a v4 blob may be missing either side's keys —+ // every seed here is conditional, and the PiD keys are re-seeded for blobs written by+ // pre-merge [dev] builds. All are nullable-with-no-default, so any missing key would+ // fail zParamsState.parse() and wipe the whole slice.+ state._version = 5;+ state.flux2VaeModel = state.flux2VaeModel ?? state.kleinVaeModel ?? state.flux2DevVaeModel ?? null;+ state.flux2DevMistralEncoderModel = state.flux2DevMistralEncoderModel ?? null;+ delete state.kleinVaeModel;+ delete state.flux2DevVaeModel;+ state.pidMode = state.pidMode ?? 'off';+ state.pidDecoderModel = state.pidDecoderModel ?? null;+ state.gemma2EncoderModel = state.gemma2EncoderModel ?? null;+ state.pidSteps = state.pidSteps ?? 4;+ }++++ if (state._version === 5) {++ // v5 -> v6, add the MiniMax H3 duration and output-mode fields. These steps follow the++ // earlier versioned migrations above so released v4 and v5 blobs both advance safely.++ state._version = 6;++ state.minimaxH3DurationSeconds = state.minimaxH3DurationSeconds ?? 5;++ state.minimaxH3OutputMode = state.minimaxH3OutputMode ?? 'video';++ }++++ if (state._version === 6) {++ // v6 -> v7, add the MiniMax H3 single-file transformer override.++ state._version = 7;++ state.minimaxH3TransformerModel = null;++ }++++ if (state._version === 7) {++ // v7 -> v8, add the MiniMax H3 single-file text encoder override.++ state._version = 8;++ state.minimaxH3TextEncoderModel = null;++ }++++ if (!('hiDiffusionEnabled' in state)) {++ state.hiDiffusionEnabled = false;++ }++ if (!('hiDiffusionRauNetEnabled' in state)) {++ state.hiDiffusionRauNetEnabled = true;++ }++ if (!('hiDiffusionWindowAttnEnabled' in state)) {++ state.hiDiffusionWindowAttnEnabled = true;++ }++ if (!('hiDiffusionT1Ratio' in state)) {++ state.hiDiffusionT1Ratio = 0.4;++ }++ if (!('hiDiffusionT2Ratio' in state)) {++ state.hiDiffusionT2Ratio = 0.0;++ }+ };++ export const paramsSliceConfig: SliceConfig<typeof slice> = {+ slice,+ schema: zParamsState,+ getInitialState: getInitialParamsState,+ persistConfig: {+ migrate: (state) => {+ assert(isPlainObject(state));++ applyParamsVersionMigrations(state);++ const { backfilled, reset } = repairParamsState(state);+ if (backfilled.length > 0) {+ log.warn(+ { backfilled },+ `Backfilled ${backfilled.length} params key(s) missing from the persisted state: ${backfilled.join(', ')}. ` ++ `These need a zod default or a seed in the migration chain.`+ );}- if (!('hiDiffusionT2Ratio' in state)) {- state.hiDiffusionT2Ratio = 0.0;+++ if (reset.length > 0) {+ log.warn(+ { reset },+ `Reset ${reset.length} params key(s) whose persisted value no longer satisfies the schema: ${reset.join(', ')}.`+ );}return zParamsState.parse(state);diff --cc tests/app/services/image_files/test_image_files_disk.pyindex 934d4b7dd5,caccb34739..eca2c5ce3e--- a/tests/app/services/image_files/test_image_files_disk.py+++ b/tests/app/services/image_files/test_image_files_disk.py@@@ -7,7 -7,7 +7,8 @@@ from unittest.mock import MagicMock, paimport pytestfrom PIL import Image+from invokeai.app.api.extract_metadata_from_image import extract_metadata_from_image+ from invokeai.app.services.image_files.image_files_common import ImageFileSaveExceptionfrom invokeai.app.services.image_files.image_files_disk import DiskImageFileStorage, _should_use_png_rlefrom invokeai.app.services.image_records.image_records_common import ImageRecordNotFoundExceptionfrom invokeai.app.util.thumbnails import get_thumbnail_namediff --cc tests/app/test_invocation_event_socketio.pyindex d6d06c4de8,35dab858eb..93b156cc62--- a/tests/app/test_invocation_event_socketio.py+++ b/tests/app/test_invocation_event_socketio.py@@@ -151,57 -155,24 +155,80 @@@ async def test_model_load_events_are_emassert socketio._sio.emit.await_count == 2+async def test_model_install_events_are_emitted_only_to_admins() -> None:+ from invokeai.app.services.events.events_common import ModelInstallStartedEvent++ socketio = SocketIO(FastAPI())+ socketio._sio.emit = AsyncMock()++ event = ModelInstallStartedEvent(id=1, source={"type": "url", "url": "https://example.com/model.safetensors"})++ await socketio._handle_model_event(("model_install_started", event))++ socketio._sio.emit.assert_awaited_once_with(+ event="model_install_started", data=event.model_dump(mode="json"), room="admin"+ )+++async def test_generic_download_events_remain_broadcast() -> None:+ socketio = SocketIO(FastAPI())+ socketio._sio.emit = AsyncMock()++ from types import SimpleNamespace++ event = SimpleNamespace(model_dump=lambda mode="json": {"id": 1})++ await socketio._handle_model_event(("download_started", event))++ socketio._sio.emit.assert_awaited_once_with(event="download_started", data={"id": 1})+++async def test_llm_task_progress_is_emitted_once_to_owner_and_admin_rooms() -> None:+ from invokeai.app.services.events.events_common import LLMTaskProgressEvent++ socketio = SocketIO(FastAPI())+ socketio._sio.emit = AsyncMock()++ event = LLMTaskProgressEvent(+ task_id="task-1",+ user_id="owner-1",+ phase="generating",+ message="Generating",+ percentage=0.5,+ current_tokens=10,+ total_tokens=20,+ )++ await socketio._handle_llm_task_event(("llm_task_progress", event))++ socketio._sio.emit.assert_awaited_once_with(+ event="llm_task_progress",+ data=event.model_dump(mode="json"),+ room=["user:owner-1", "admin"],+ )+++++ @pytest.mark.anyio+ async def test_download_and_model_install_events_are_admin_only() -> None:+ socketio = SocketIO(FastAPI())+ socketio._sio.emit = AsyncMock()++ download_event = DownloadStartedEvent(source="https://example.com/model", download_path="/cache/model")+ install_event = ModelInstallStartedEvent(+ id=1,+ source=URLModelSource(url=AnyHttpUrl("https://example.com/model")),+ )++ await socketio._handle_model_event(("download_started", download_event))+ await socketio._handle_model_event(("model_install_started", install_event))++ socketio._sio.emit.assert_any_await(+ event="download_started", data=download_event.model_dump(mode="json"), room="admin"+ )+ socketio._sio.emit.assert_any_await(+ event="model_install_started", data=install_event.model_dump(mode="json"), room="admin"+ )+ assert socketio._sio.emit.await_count == 2