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.

chore: remove ad-hoc planning and PR review markdown files (#9132)

Alexander Eichhorn883ef1a9033c
diff --git a/3-LAYER-FLATTENING.md b/3-LAYER-FLATTENING.md
deleted file mode 100644
index 552156130d..0000000000
--- a/3-LAYER-FLATTENING.md
+++ /dev/null
@@ -1,199 +0,0 @@
-# 3-Layer Flattening System — Design Document
-
-## Problem
-
-Each canvas entity (raster layer, control layer, inpaint mask, regional guidance) creates its own `Konva.Layer`, which in turn creates a separate HTML `<canvas>` element in the DOM. With many layers, the browser must composite all of these canvas elements on every frame, leading to significant GPU/CPU overhead and sluggish interactions.
-
-## Goal
-
-Reduce the number of active `<canvas>` elements from **N** (one per entity) to **3** (constant), regardless of how many entities exist. This provides a dramatic performance improvement especially on lower-end devices.
-
-## Architecture
-
-### The 3-Layer System
-
-```
-┌─────────────────────────────────────┐
-│ Konva.Layer: "behind" │ ← All entities below the active one,
-│ (flattened composite of layers │ flattened into a single canvas
-│ behind the active entity) │
-├─────────────────────────────────────┤
-│ Konva.Layer: "active" │ ← The currently selected entity,
-│ (the entity being edited) │ fully interactive with all
-│ │ sub-modules (transformer, etc.)
-├─────────────────────────────────────┤
-│ Konva.Layer: "ahead" │ ← All entities above the active one,
-│ (flattened composite of layers │ flattened into a single canvas
-│ above the active entity) │
-└─────────────────────────────────────┘
-```
-
-Plus the existing **background layer** and **preview layer** (bbox, staging area, tool) which are unchanged.
-
-### Key Concepts
-
-**Flattening**: Render multiple entity layers into a single off-screen canvas, then display that canvas as a single `Konva.Image` node on the composite `Konva.Layer`. This is similar to what `CanvasCompositorModule.getCompositeCanvas()` already does for generation.
-
-**Active Entity**: The entity currently selected by the user. This entity keeps its own dedicated `Konva.Layer` so it can be interactively edited (brush strokes, transforms, filters, SAM segmentation, etc.).
-
-**Re-flattening**: When the user switches the active entity, the "behind" and "ahead" composites must be regenerated. This can be done incrementally (add/remove one entity from composite) or fully (re-render all).
-
-## Implementation Plan
-
-### Phase 1: New Module — `CanvasLayerFlatteningModule`
-
-Create a new module at `konva/CanvasLayerFlatteningModule.ts`:
-
-```typescript
-class CanvasLayerFlatteningModule extends CanvasModuleBase {
- // The two composite Konva.Layers
- behindLayer: Konva.Layer;
- aheadLayer: Konva.Layer;
-
- // Cached composite canvases
- behindCanvas: HTMLCanvasElement | null;
- aheadCanvas: HTMLCanvasElement | null;
-
- // Konva.Image nodes to display the composites
- behindImage: Konva.Image;
- aheadImage: Konva.Image;
-
- // Track which entity is active
- activeEntityId: string | null;
-}
-```
-
-**Responsibilities:**
-
-1. Subscribe to `selectedEntityIdentifier` changes
-2. On entity selection change, re-flatten the "behind" and "ahead" composites
-3. Manage the two composite `Konva.Layer` nodes on the stage
-4. Ensure individual entity adapters DON'T add their own `Konva.Layer` to the stage (except the active one)
-
-### Phase 2: Modify Entity Adapter Lifecycle
-
-**Current flow** (in `CanvasEntityAdapterBase` constructor):
-
-```typescript
-this.konva = {
- layer: new Konva.Layer({ ... }),
-};
-this.manager.stage.addLayer(this.konva.layer);
-```
-
-**New flow:**
-
-- Entity adapters still create a `Konva.Layer` (needed for rendering to off-screen canvas via `getCanvas()`)
-- But they do NOT add it to the stage by default
-- Only the **active entity** has its layer added to the stage
-- The flattening module manages which entity is "live" on stage
-
-### Phase 3: Composite Rendering
-
-Reuse the existing compositing logic from `CanvasCompositorModule.getCompositeCanvas()`:
-
-```typescript
-flattenBehind(activeIndex: number): HTMLCanvasElement {
- const behindAdapters = this.getOrderedAdapters().slice(0, activeIndex);
- // Filter to only enabled/visible adapters
- const canvas = document.createElement('canvas');
- // ... render each adapter's getCanvas() onto the composite
- return canvas;
-}
-```
-
-**Blend modes**: Each raster layer can have a `globalCompositeOperation`. When flattening, these must be applied in order during compositing (same as `getCompositeCanvas` already does).
-
-**Opacity**: Each layer's opacity must be respected during compositing.
-
-**Adjustments**: Per-layer adjustments (brightness, contrast, curves) must be baked into the flattened result.
-
-### Phase 4: Incremental Updates
-
-When only the active entity changes content (brush strokes, image generation), the "behind" and "ahead" composites don't need to change. This is the common case and should be fast.
-
-When a non-active entity changes (rare during editing), the affected composite must be regenerated. This can be detected via entity state subscriptions.
-
-**Cache invalidation strategy:**
-
-- Hash the state of all entities in each composite (similar to `getCompositeHash()` in compositor)
-- Only re-flatten when the hash changes
-- Cache the flattened canvas in the `CanvasCacheModule`
-
-### Phase 5: Entity Selection Switch
-
-When the user selects a different entity:
-
-1. Remove the previously active entity's `Konva.Layer` from the stage
-2. Render the previously active entity into the appropriate composite (behind or ahead)
-3. Extract the newly active entity from its composite
-4. Add the newly active entity's `Konva.Layer` to the stage
-5. Re-render both composites without the newly active entity
-6. Restore z-order: behind → active → ahead
-
-**Optimization**: If the new selection is adjacent to the old one, only one composite needs to change by adding/removing one entity.
-
-### Phase 6: Handle Edge Cases
-
-**Entity types across composites:**
-The draw order is: raster layers → control layers → regions → inpaint masks. All entity types participate in flattening. The "behind" composite includes all entities below the active one regardless of type, and "ahead" includes all above.
-
-**Isolated preview modes:**
-When filtering/transforming/segmenting, only the active entity should be visible. The composites should be hidden (same as current behavior).
-
-**Staging preview:**
-During generation staging with `isolatedStagingPreview`, only raster layers should be visible. The composites need to only include raster layer content.
-
-**Disabled entities:**
-Disabled entities are skipped during flattening (not rendered into composites).
-
-**Entity type visibility:**
-If a type is globally hidden (e.g., all control layers hidden), those entities are excluded from composites.
-
-## Files to Modify
-
-| File | Change |
-| ----------------------------------------------- | ------------------------------------------------------- |
-| `konva/CanvasLayerFlatteningModule.ts` | **NEW** — Core flattening logic |
-| `konva/CanvasManager.ts` | Register new module, integrate into lifecycle |
-| `konva/CanvasEntity/CanvasEntityAdapterBase.ts` | Don't auto-add layer to stage; expose attach/detach API |
-| `konva/CanvasEntityRendererModule.ts` | Delegate layer arrangement to flattening module |
-| `konva/CanvasCompositorModule.ts` | Reuse/share compositing utilities |
-| `konva/CanvasStageModule.ts` | No change needed (addLayer/stage management stays) |
-
-## Performance Expectations
-
-| Metric | Before | After |
-| ---------------------- | ---------------------------- | -------------------------------------------------- |
-| Canvas elements in DOM | N + 2 (background + preview) | 5 (background + behind + active + ahead + preview) |
-| Browser composite cost | O(N) per frame | O(1) per frame |
-| Layer switch cost | O(1) | O(N) one-time re-flatten |
-| Active layer edit cost | O(1) | O(1) unchanged |
-
-The trade-off is that switching the selected entity requires a one-time re-flatten, but this can be made fast with caching and incremental updates. The per-frame rendering cost drops from O(N) to O(1), which is the dominant performance factor.
-
-## Risks and Mitigations
-
-1. **Visual fidelity**: Flattened composites must exactly match the per-layer rendering. Use the same compositing pipeline (`getCompositeCanvas`) to ensure consistency.
-
-2. **Blend mode accuracy**: CSS `mix-blend-mode` on individual canvas elements may differ slightly from `globalCompositeOperation` during canvas compositing. Test thoroughly with all blend modes.
-
-3. **Re-flatten latency**: For 50+ layers with complex content, flattening may take 50-100ms. Mitigate with:
- - Async flattening in a Web Worker (see README: "Perf: Konva in a web worker")
- - Show a brief transition indicator during re-flatten
- - Incremental flattening (only re-render changed entities)
-
-4. **Memory**: Two extra composite canvases at full resolution. For a 4K canvas, this is ~32MB per composite. Acceptable for modern systems.
-
-## Dependencies
-
-- Konva's `layer.toCanvas()` or manual canvas rendering via `getCanvas()` on each adapter
-- `CanvasCompositorModule` compositing utilities (hash computation, canvas compositing)
-- `CanvasCacheModule` for caching flattened results
-
-## References
-
-- Current compositing: `konva/CanvasCompositorModule.ts` lines 204-247
-- README future enhancement: `controlLayers/README.md` lines 196-206
-- Entity adapter rendering: `konva/CanvasEntity/CanvasEntityAdapterBase.ts`
-- Entity z-order management: `konva/CanvasEntityRendererModule.ts` lines 105-146
diff --git a/FP8_IMPLEMENTATION_PLAN.md b/FP8_IMPLEMENTATION_PLAN.md
deleted file mode 100644
index d3e73cbcaf..0000000000
--- a/FP8_IMPLEMENTATION_PLAN.md
+++ /dev/null
@@ -1,293 +0,0 @@
-# FP8 Layerwise Casting - Implementation
-
-## Summary
-
-Add per-model `fp8_storage` option to model default settings that enables diffusers' `enable_layerwise_casting()` to store weights in FP8 (`float8_e4m3fn`) while casting to fp16/bf16 during inference. This reduces VRAM usage by ~50% per model with minimal quality loss.
-
-Supported: SD1/SD2/SDXL/SD3, Flux, Flux2, CogView4, Z-Image, VAE (diffusers-based), ControlNet, T2IAdapter.
-Not applicable: Text Encoders, LoRA, GGUF, BnB, custom classes.
-
-## Related Issues / Discussions
-
-- https://github.com/invoke-ai/InvokeAI/issues/7148
-- Based on approach from https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/14031
-- Uses diffusers' native `enable_layerwise_casting()` (available in diffusers 0.36.0)
-
-## QA Instructions
-
-1. Set `fp8_storage: true` in a model's `default_settings` (via API or Model Manager UI)
-2. Load the model and generate an image
-3. Verify VRAM usage is reduced compared to normal loading
-4. Verify image quality is acceptable (minimal degradation expected)
-5. Verify Text Encoders are NOT affected (excluded by submodel type filter)
-6. Verify non-CUDA devices gracefully ignore the setting
-
-### Test Matrix
-
-- [ ] SD1.5 Diffusers with `fp8_storage=true` - load and generate
-- [ ] SDXL Diffusers with `fp8_storage=true` - load and generate
-- [ ] Flux Diffusers with `fp8_storage=true` - load and generate
-- [ ] Flux2 Diffusers with `fp8_storage=true` - load and generate
-- [ ] CogView4 with `fp8_storage=true` - load and generate
-- [ ] Z-Image Diffusers with `fp8_storage=true` - load and generate
-- [ ] VAE with `fp8_storage=true` - check quality
-- [ ] ControlNet with `fp8_storage=true` - load and generate
-- [ ] VRAM comparison: with vs. without `fp8_storage`
-- [ ] Image quality comparison: FP8 vs fp16/bf16
-- [ ] MPS/CPU: verify `fp8_storage` is silently ignored
-- [ ] Flux Checkpoint (custom class): verify FP8 is gracefully skipped (not a ModelMixin)
-- [ ] Text Encoder submodels: verify FP8 is NOT applied
-- [ ] GGUF/BnB models: verify FP8 is gracefully skipped
-
-## Checklist
-
-- [x] _The PR has a short but descriptive title, suitable for a changelog_
-- [ ] _Tests added / updated (if applicable)_
-- [ ] _Changes to a redux slice have a corresponding migration_
-- [ ] _Documentation added / updated (if applicable)_
-- [ ] _Updated `What's New` copy (if doing a release after this PR)_
-
----
-
-## All Changed Files
-
-### Backend - Model Configs
-
-#### `invokeai/backend/model_manager/configs/main.py` (Modified)
-
-Added `fp8_storage` field to `MainModelDefaultSettings`:
-
-```diff
- cpu_only: bool | None = Field(default=None, description="Whether this model should run on CPU only")
-+ fp8_storage: bool | None = Field(
-+ default=None,
-+ description="Store weights in FP8 to reduce VRAM usage (~50% savings). Weights are cast to compute dtype during inference.",
-+ )
-```
-
-#### `invokeai/backend/model_manager/configs/controlnet.py` (Modified)
-
-Added `fp8_storage` field to `ControlAdapterDefaultSettings`:
-
-```diff
- class ControlAdapterDefaultSettings(BaseModel):
- preprocessor: str | None
-+ fp8_storage: bool | None = Field(
-+ default=None,
-+ description="Store weights in FP8 to reduce VRAM usage (~50% savings). Weights are cast to compute dtype during inference.",
-+ )
- model_config = ConfigDict(extra="forbid")
-```
-
-### Backend - Model Loading
-
-#### `invokeai/backend/model_manager/load/load_default.py` (Modified)
-
-Added two helper methods to `ModelLoader` base class:
-
-- `_should_use_fp8(config, submodel_type)` - Checks if FP8 should be applied:
- - Returns `False` if not CUDA
- - Returns `False` for excluded submodel types (TextEncoder, TextEncoder2, TextEncoder3, Tokenizer, Tokenizer2, Tokenizer3, Scheduler, SafetyChecker)
- - Returns `True` if `config.default_settings.fp8_storage is True`
-
-- `_apply_fp8_layerwise_casting(model, config, submodel_type)` - Applies FP8 if conditions met:
- - Checks `_should_use_fp8()` first
- - Only applies to `diffusers.ModelMixin` instances (gracefully skips custom classes)
- - Calls `model.enable_layerwise_casting(storage_dtype=torch.float8_e4m3fn, compute_dtype=self._torch_dtype)`
- - Logs info message on success
-
-#### `invokeai/backend/model_manager/load/model_loaders/generic_diffusers.py` (Modified)
-
-Added `_apply_fp8_layerwise_casting` call after `from_pretrained()`. This covers T2IAdapter and other generic diffusers models.
-
-```diff
-+ result = self._apply_fp8_layerwise_casting(result, config, submodel_type)
- return result
-```
-
-#### `invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py` (Modified)
-
-Added FP8 call in `_load_model()` after `from_pretrained()`:
-
-```diff
-+ result = self._apply_fp8_layerwise_casting(result, config, submodel_type)
- return result
-```
-
-Added FP8 calls in `_load_from_singlefile()` for both the requested submodel and cached submodels:
-
-```diff
- if submodel := getattr(pipeline, subtype.value, None):
-+ self._apply_fp8_layerwise_casting(submodel, config, subtype)
- self._ram_cache.put(get_model_cache_key(config.key, subtype), model=submodel)
-- return getattr(pipeline, submodel_type.value)
-+ result = getattr(pipeline, submodel_type.value)
-+ result = self._apply_fp8_layerwise_casting(result, config, submodel_type)
-+ return result
-```
-
-#### `invokeai/backend/model_manager/load/model_loaders/flux.py` (Modified)
-
-Added FP8 calls to:
-- `FluxDiffusersModel._load_model()` - after `from_pretrained()`
-- `Flux2DiffusersModel._load_model()` - after `from_pretrained()`
-- `Flux2VAEDiffusersLoader._load_model()` - after `from_pretrained()`
-- `Flux2VAELoader._load_model()` - after VAE loading
-
-NOT applied to (gracefully skipped via `isinstance(model, ModelMixin)` check):
-- `FluxCheckpointModel` - custom Flux class
-- `FluxGGUFCheckpointModel` - GGUF format
-- `FluxBnbQuantizednf4bCheckpointModel` - BnB quantized
-- `FluxVAELoader` - custom AutoEncoder class
-
-#### `invokeai/backend/model_manager/load/model_loaders/cogview4.py` (Modified)
-
-Added FP8 call after `from_pretrained()`:
-
-```diff
-+ result = self._apply_fp8_layerwise_casting(result, config, submodel_type)
- return result
-```
-
-#### `invokeai/backend/model_manager/load/model_loaders/controlnet.py` (Modified)
-
-Added FP8 call after `from_single_file()` for checkpoint ControlNets:
-
-```diff
-- return ControlNetModel.from_single_file(
-+ result = ControlNetModel.from_single_file(
- config.path,
- torch_dtype=self._torch_dtype,
- )
-+ result = self._apply_fp8_layerwise_casting(result, config, submodel_type)
-+ return result
-```
-
-#### `invokeai/backend/model_manager/load/model_loaders/vae.py` (Modified)
-
-Added FP8 call after `from_single_file()` for checkpoint VAEs:
-
-```diff
-- return AutoencoderKL.from_single_file(
-+ result = AutoencoderKL.from_single_file(
- config.path,
- torch_dtype=self._torch_dtype,
- )
-+ result = self._apply_fp8_layerwise_casting(result, config, submodel_type)
-+ return result
-```
-
-#### `invokeai/backend/model_manager/load/model_loaders/z_image.py` (Modified)
-
-Added FP8 call after `from_pretrained()` in `ZImageDiffusersModel`:
-
-```diff
-+ result = self._apply_fp8_layerwise_casting(result, config, submodel_type)
- return result
-```
-
-### Frontend - API Schema
-
-#### `invokeai/frontend/web/src/services/api/schema.ts` (Modified)
-
-Added `fp8_storage` field to both TypeScript type definitions:
-
-- `ControlAdapterDefaultSettings.fp8_storage?: boolean | null`
-- `MainModelDefaultSettings.fp8_storage?: boolean | null`
-
-### Frontend - Hooks
-
-#### `invokeai/frontend/web/src/features/modelManagerV2/hooks/useMainModelDefaultSettings.ts` (Modified)
-
-Added `fp8Storage` to form defaults:
-
-```typescript
-fp8Storage: {
- isEnabled: !isNil(modelConfig?.default_settings?.fp8_storage),
- value: modelConfig?.default_settings?.fp8_storage ?? false,
-},
-```
-
-#### `invokeai/frontend/web/src/features/modelManagerV2/hooks/useControlAdapterModelDefaultSettings.ts` (Modified)
-
-Added same `fp8Storage` defaults pattern.
-
-### Frontend - Components
-
-#### `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/DefaultFp8Storage.tsx` (New)
-
-New component with `SettingToggle` + `Switch`, following `DefaultVaePrecision` pattern. Renders an FP8 Storage toggle with `InformationalPopover`.
-
-#### `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/ControlAdapterModelDefaultSettings/DefaultFp8StorageControlAdapter.tsx` (New)
-
-Same pattern as `DefaultFp8Storage` but typed for `ControlAdapterModelDefaultSettingsFormData`.
-
-#### `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx` (Modified)
-
-- Added `DefaultFp8Storage` import
-- Added `fp8Storage: FormField<boolean>` to `MainModelDefaultSettingsFormData`
-- Added `fp8_storage: data.fp8Storage.isEnabled ? data.fp8Storage.value : null` to `onSubmit` body
-- Added `<DefaultFp8Storage control={control} name="fp8Storage" />` to render
-
-#### `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/ControlAdapterModelDefaultSettings/ControlAdapterModelDefaultSettings.tsx` (Modified)
-
-- Added `DefaultFp8StorageControlAdapter` import
-- Added `fp8Storage: FormField<boolean>` to form data type
-- Added `fp8_storage` to `onSubmit` body
-- Added component to render grid
-
-### Frontend - Translations & Popover
-
-#### `invokeai/frontend/web/public/locales/en.json` (Modified)
-
-Added translation key:
-```json
-"fp8Storage": "FP8 Storage (Save VRAM)"
-```
-
-Added InformationalPopover content:
-```json
-"fp8Storage": {
- "heading": "FP8 Storage",
- "paragraphs": [
- "Stores model weights in FP8 format in VRAM, reducing memory usage by approximately 50% compared to FP16.",
- "During inference, weights are cast layer-by-layer to the compute precision (FP16/BF16), so image quality is preserved. Works on all CUDA GPUs."
- ]
-}
-```
-
-#### `invokeai/frontend/web/src/common/components/InformationalPopover/constants.ts` (Modified)
-
-Added `'fp8Storage'` to `Feature` union type.
-
----
-
-## How It Works
-
-1. User sets `fp8_storage: true` in a model's default settings (via Model Manager UI)
-2. On load, `_should_use_fp8()` checks: CUDA device? Not a text encoder? `fp8_storage` enabled?
-3. `_apply_fp8_layerwise_casting()` calls `model.enable_layerwise_casting(storage_dtype=float8_e4m3fn)`
-4. Weights are stored in FP8 in VRAM (~50% of fp16), cast layer-by-layer to fp16/bf16 during forward pass
-5. Only one layer is in full precision at a time, so overhead is minimal (~1-3% VRAM)
-
-## Not Modified (by design)
-
-These model types cannot use `enable_layerwise_casting()`:
-
-| Model Type | Reason |
-|-----------|--------|
-| Text Encoders (CLIP, T5, Qwen3) | `transformers` library, not diffusers `ModelMixin` |
-| LoRA | State-dict patches, not a standalone model |
-| IP-Adapter | Custom `RawModel` wrapper |
-| Textual Inversion | Custom wrapper |
-| Spandrel (Upscaler) | Not diffusers-based |
-| ONNX | ONNX runtime, not torch |
-| Flux Checkpoint (custom Flux class) | Not diffusers `ModelMixin` |
-| GGUF models | Already quantized |
-| BnB models | Already quantized |
-
-## Follow-up Work
-
-- Standalone VAE: Add `fp8_storage` field directly to VAE config classes
-- Manual FP8 for custom classes: Implement FP8 storage for Flux Checkpoint (`Flux` class) without `enable_layerwise_casting()`
-- Native FP8 compute: For RTX 40xx+ GPUs, use actual FP8 tensor cores via TorchAO
diff --git a/pr-8822-review.md b/pr-8822-review.md
deleted file mode 100644
index 7ea8f022d1..0000000000
--- a/pr-8822-review.md
+++ /dev/null
@@ -1,108 +0,0 @@
-# Code Review: PR #8822 - Multi-User Mode
-
-**PR:** https://github.com/invoke-ai/InvokeAI/pull/8822
-**Author:** lstein
-**Head SHA:** `b4ab173b3c7a1d4551b6be0fe45af9af9aeb8bd3`
-**Scope:** 118 files changed, +12,200 / -380 lines
-
----
-
-## Summary
-
-This PR adds multiuser support to InvokeAI, allowing multiple users to share a single backend with isolated boards, images, assets, and queue items. Includes user authentication (JWT), role-based access control (admin vs regular user), WebSocket event filtering, database migrations, and a full frontend auth flow (login, admin setup, user menu).
-
----
-
-## Issues Found
-
-### High Confidence (score >= 80)
-
-**1. `boards.get_all()` missing required `is_admin` argument -- will crash at runtime** (score: 100)
-
-In `invokeai/app/services/shared/invocation_context.py`, the call to `boards.get_all()` is missing the required `is_admin` positional argument. The method signature was changed to `get_all(self, user_id, is_admin, order_by, direction, include_archived)` but this call site only passes `user_id`, `order_by`, and `direction`. This will cause a `TypeError` whenever any invocation node calls `context.boards.get_all()`.
-
-https://github.com/invoke-ai/InvokeAI/blob/b4ab173b3c7a1d4551b6be0fe45af9af9aeb8bd3/invokeai/app/services/shared/invocation_context.py#L103-L106
-
----
-
-**2. Token verification accepts tokens without `exp` field indefinitely** (score: 100)
-
-In `invokeai/app/services/auth/token_service.py`, the expiry check is `if "exp" in payload:` -- if `exp` is absent, the token is accepted with no expiration. While server-generated tokens always include `exp`, a crafted token (by anyone with knowledge of the JWT secret) would never expire. The check should require `exp` to be present and reject tokens without it.
-
-https://github.com/invoke-ai/InvokeAI/blob/b4ab173b3c7a1d4551b6be0fe45af9af9aeb8bd3/invokeai/app/services/auth/token_service.py#L91-L99
-
----
-
-**3. `clear` endpoint wipes ALL users' queue items, not just the caller's** (score: 100)
-
-The `clear` endpoint in `session_queue.py` calls `session_queue.clear(queue_id)` which deletes ALL queue items for ALL users. The endpoint only checks ownership of the currently-executing item, but then unconditionally wipes the entire queue. A non-admin user can clear every other user's pending jobs. The underlying `SqliteSessionQueue.clear()` method has no `user_id` parameter, unlike `prune` and other similar methods that were updated for multi-tenancy.
-
-https://github.com/invoke-ai/InvokeAI/blob/b4ab173b3c7a1d4551b6be0fe45af9af9aeb8bd3/invokeai/app/api/routers/session_queue.py#L327-L346
-
----
-
-### Moderate Confidence (score 50-79)
-
-**4. `resume`/`pause` endpoints use `AdminUser` instead of `AdminUserOrDefault` -- broken in single-user mode** (score: 75)
-
-The `resume` and `pause` endpoints use `AdminUser` which requires an authenticated token. In single-user mode (default deployment), no tokens exist, so these endpoints return 401. Other admin-only endpoints correctly use `AdminUserOrDefault` which falls back to a system admin in single-user mode.
-
-https://github.com/invoke-ai/InvokeAI/blob/b4ab173b3c7a1d4551b6be0fe45af9af9aeb8bd3/invokeai/app/api/routers/session_queue.py
-
----
-
-**5. Board `update_board`/`delete_board` have no ownership check** (score: 75)
-
-Both endpoints inject `current_user` but never verify the board belongs to that user. The docstrings say "user must have access to it" but no validation occurs. Any authenticated user can modify or delete any other user's boards by board ID.
-
-https://github.com/invoke-ai/InvokeAI/blob/b4ab173b3c7a1d4551b6be0fe45af9af9aeb8bd3/invokeai/app/api/routers/boards.py
-
----
-
-**7. `_handle_unsub_queue` doesn't leave user/admin rooms** (score: 75)
-
-`_handle_sub_queue` joins three rooms (queue, `user:{user_id}`, and `admin`), but `_handle_unsub_queue` only leaves the queue room. Unsubscribed sockets remain in user/admin rooms and continue receiving private events.
-
-https://github.com/invoke-ai/InvokeAI/blob/b4ab173b3c7a1d4551b6be0fe45af9af9aeb8bd3/invokeai/app/api/sockets.py
-
----
-
-**8. Direct image fetch endpoints have no authentication** (score: 75)
-
-`get_image_full`, `get_image_dto`, `get_image_thumbnail`, and `get_image_metadata` have no `current_user` dependency. Any user who knows an `image_name` can fetch any other user's images directly, bypassing the user isolation that was added to list endpoints.
-
-https://github.com/invoke-ai/InvokeAI/blob/b4ab173b3c7a1d4551b6be0fe45af9af9aeb8bd3/invokeai/app/api/routers/images.py
-
----
-
-**9. SocketIO `cors_allowed_origins="*"` while HTTP CORS is configurable** (score: 75)
-
-The Socket.IO server hardcodes `cors_allowed_origins="*"` while the HTTP layer uses configurable `allow_origins` from `app_config`. Any webpage can connect to the WebSocket even if HTTP CORS is restricted, which is a security regression now that token-based socket auth exists.
-
-https://github.com/invoke-ai/InvokeAI/blob/b4ab173b3c7a1d4551b6be0fe45af9af9aeb8bd3/invokeai/app/api/sockets.py
-
----
-
-### Lower Confidence (score < 50)
-
-**11. `authenticate()` updates `last_login_at` for disabled users** (score: 25)
-
-The `is_active` check happens in the router after `authenticate()` returns, so `last_login_at` is updated even for deactivated accounts.
-
-**12. `get_queue_item_ids` endpoint has no authentication** (score: 50)
-
-Returns item IDs without requiring auth, though the exposure is limited since it only returns IDs, not full items.
-
-**13-14. Missing colocated tests for `validatePasswordStrength` and `getBadgeText`** (score: 50)
-
-Pure functions with non-trivial branching logic added without `.test.ts` files. CLAUDE.md requires colocated tests for non-trivial logic, but these are borderline given "We currently do not do UI tests."
-
----
-
-### False Positives Identified
-
-- **`sanitize_queue_item_for_user` shallow copy**: The shallow copy is safe here because all fields are either set to `None` or replaced with new objects, never mutated in place.
-- **Migration ordering conflict**: Already acknowledged by lstein in PR comments and consolidated into a single migration file.
-- **Redundant `hasattr` guards in `_handle_queue_event`**: While technically always true (since `user_id` has a default), this is defensive coding and doesn't cause bugs.
-- **`list_image_dtos` missing `is_admin` parameter**: Verified manually -- admin can see all users' images in practice, so the filtering works correctly despite the parameter not being explicitly passed.
-- **`list_queue_items` missing user JOIN**: `list_queue_items` is never called by any router or service -- only `list_all_queue_items` (which has the correct JOIN) is actually used.
diff --git a/pr-8884-review.md b/pr-8884-review.md
deleted file mode 100644
index 3b9ac5efeb..0000000000
--- a/pr-8884-review.md
+++ /dev/null
@@ -1,113 +0,0 @@
-# Code Review: PR #8884 - External Models (Gemini & OpenAI GPT Image)
-
-**PR:** https://github.com/invoke-ai/InvokeAI/pull/8884
-**Author:** CypherNaught-0x
-**Head SHA:** `7671304195518fe010b6e9b080f7a30b752015ca`
-**Scope:** 79 files changed, +4619 / -143 lines
-
----
-
-## Summary
-
-This PR adds support for external image generation provider APIs (Google Gemini and OpenAI GPT Image). It includes:
-- A new `ExternalGenerationService` with provider adapters for Gemini and OpenAI
-- New `ExternalApiModelConfig` model type and install flow via `external://` source URIs
-- API key management endpoints and config persistence
-- Frontend graph builder, model selection UI, and provider badge display
-- Tests and documentation
-
----
-
-## Issues Found
-
-### High Confidence (score >= 80)
-
-**1. Debug file dump writes request payloads and images to disk unconditionally** (score: 85)
-
-In `invokeai/app/services/external_generation/providers/gemini.py`, the methods `_dump_debug_payload` and `_dump_debug_image` are called on **every single Gemini API request** with no flag or config option to disable them. Both methods are annotated with `TODO: remove debug payload dump once Gemini is stable` / `TODO: remove debug image dump once Gemini is stable`.
-
-They write:
-- Full JSON request/response payloads (including base64-encoded image data) to `outputs/external_debug/gemini/{label}_{uuid}.json`
-- Decoded PNG images to `outputs/external_debug/gemini/decoded_{uuid}.png`
-
-This causes **unbounded disk growth** and silently persists all user generation data (prompts, images, API responses) to disk with no user knowledge or consent. There is no way to disable this behavior -- it runs whenever `outputs_path` is set, which is always the case in normal operation.
-
-https://github.com/invoke-ai/InvokeAI/blob/7671304195518fe010b6e9b080f7a30b752015ca/invokeai/app/services/external_generation/providers/gemini.py (methods `_dump_debug_payload` and `_dump_debug_image`)
-
----
-
-### Moderate Confidence (score 50-79)
-
-**2. Service layer imports from API layer -- inverted dependency** (score: 70)
-
-In `invokeai/app/services/external_generation/external_generation_default.py`, the method `_refresh_model_capabilities` does:
-
-```python
-from invokeai.app.api.dependencies import ApiDependencies
-record = ApiDependencies.invoker.services.model_manager.store.get_model(request.model.key)
-```
-
-No other service in the codebase imports from `invokeai.app.api.dependencies`. All other services receive their dependencies via constructor injection through `InvocationServices`. This is an architectural violation that makes the service harder to test in isolation and creates a hidden coupling between the service and API layers.
-
-**3. `ExternalModelSource` incorrectly mapped to `ModelSourceType.Url`** (score: 50)
-
-In `invokeai/app/services/model_install/model_install_common.py`:
-
-```python
-MODEL_SOURCE_TO_TYPE_MAP = {
- ...
- ExternalModelSource: ModelSourceType.Url,
-}
-```
-
-`ExternalModelSource` is not a URL source. There is no `ModelSourceType.External` enum value in `taxonomy.py`. This means external models get recorded as `Url`-type sources in the database, which is semantically incorrect and could cause issues in any code that branches on `source_type`.
-
-**4. `_apply_external_provider_update` directly mutates `model_fields_set`** (score: 50)
-
-In `invokeai/app/api/routers/app_info.py`:
-
-```python
-for config in (runtime_config, file_config):
- config.update_config(updates)
- for field_name, value in updates.items():
- if value is None:
- config.model_fields_set.discard(field_name)
-```
-
-This directly mutates the `model_fields_set` of the global singleton `InvokeAIAppConfig`, bypassing Pydantic's field-tracking internals. Concurrent requests to `set_external_provider_config` or `reset_external_provider_config` could race on this shared mutable set.
-
-**5. Duplicate key conflict on reinstall of external model** (score: 50)
-
-In `invokeai/app/services/model_install/model_install_default.py`, `_register_external_model` generates a deterministic key via `slugify(f"{provider_id}-{provider_model_id}")`. Installing the same external model twice produces the same key. While the DB layer catches this with `DuplicateModelException`, there is no proactive check or update-if-exists logic, resulting in an unhelpful error for the user.
-
-**6. `setattr` used on Pydantic models instead of `model_copy`** (score: 50)
-
-In `invokeai/app/api/routers/model_manager.py`, `list_model_records` uses `setattr(model, "capabilities", ...)` and `setattr(model, "default_settings", ...)` on Pydantic model instances. Pydantic v2 models may not support direct attribute mutation without `validate_assignment = True`. The PR itself uses `model_copy(update=...)` correctly in other places (e.g., `_apply_starter_overrides` in `external_generation_default.py`), so this is inconsistent.
-
----
-
-### Low Confidence / Nitpicks (score < 50)
-
-**7. API key potentially leaked in error messages** (score: 40)
-
-In `gemini.py`, the Gemini API key is passed as a URL query parameter (`params={"key": api_key}`), and error handling includes raw `response.text` in exception messages. If the API echoes back the request URL in error responses, the key could be exposed in logs or UI.
-
-**8. Duplicate ratio utility functions** (score: 40)
-
-Functions `_parse_ratio`, `_gcd`, `_format_aspect_ratio`, `_select_closest_ratio` are duplicated between `external_generation_default.py` and `providers/gemini.py`.
-
-**9. `InvokeAIAppConfig` docstring not updated** (score: 25)
-
-The class has an exhaustive `Attributes:` docstring listing all 40+ config fields. The 4 new fields (`external_gemini_api_key`, `external_openai_api_key`, `external_gemini_base_url`, `external_openai_base_url`) are not added to it.
-
-**10. Missing section comment in `factory.py` `AnyModelConfig` union** (score: 25)
-
-Every group of model configs in the union has a section comment (e.g., `# Main (Pipeline) - diffusers format`). `ExternalApiModelConfig` is added without one.
-
----
-
-### False Positives Identified
-
-- **`positivePrompt` node value never set in `buildExternalGraph`**: FALSE POSITIVE. The prompt value is injected via `prepareLinearUIBatch` batch data mechanism, same as all other graph builders (SD1, FLUX, Z-Image, etc.). The `string` node intentionally starts empty and gets its value from batch processing.
-
-- **`reidentify_model` `hasattr`/`setattr` dead code for external models**: Low concern. While `from_model_on_disk` raises for external models before reaching this code, the defensive guard doesn't cause harm and protects against future changes.