merge_manifest_user_changes() was checking for wrong field names:
- "favorite" → should be "favorited" (how dashboard stores it)
- "notes" → should be "note" (singular)
- "rejected" was correct
This caused the merge to NEVER preserve favorites when the generation
pipeline saved the manifest. The race condition:
1. User favorites image → dashboard saves via /save_changes (100ms delay)
2. Pipeline saves manifest via save_manifest() before dashboard's save
3. Merge should preserve favorites from disk, but wrong key names meant
it found nothing to preserve
4. Next pipeline save overwrites the manifest without the favorites
Now uses .get("favorited"), .get("rejected"), .get("note") matching
the actual field names in the manifest JSON.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The GENERATE NEW button was only sending sampler/scheduler/steps/cfg/
denoise/lora — missing model, seed, prompts, and all advanced settings.
The generated image would use whatever the sampler node had as defaults
instead of the actual parameters from the source image.
Fixed triggerGen() to build a complete config entry:
- Model and seed from the (now editable) modal fields
- Positive and negative prompts from the modal textareas
- seed_behavior set to "fixed" so the exact seed is used
- All advanced settings carried from the source item: vae, clip_type,
model_type, text_encoders, attention_mode, clip_skip,
model_sampling_override + shift values, advanced_sampling,
flux_guidance, gguf_options
Also wraps output in {"configs": [...]} format (was sending bare array).
Template changes:
- Model input: removed disabled attribute + opacity
- Seed input: removed disabled attribute + opacity
Both are now editable so users can change model or seed before re-gen.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dashboard fast-path sort assumes newest items are at the start of the
items array. append() put upscaled images at the end (oldest position),
making them appear as the oldest items when sorting by newest.
Changed both SeedVR2 and regular upscale paths from append() to
insert(0, ...) so upscaled images appear at the top (newest position).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
UnboundLocalError when SeedVR2 upscale completed — total_upscale_duration
was referenced but never initialized. Added initialization to 0 at the
start of each per-image loop.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SeedVR2 nodes use ComfyUI's V3 API which calls get_executing_context()
internally to get the current node_id. When calling execute() directly
from our code (outside ComfyUI's execution pipeline), the context is
None, causing AttributeError.
Fix: wrap all SeedVR2 execute() calls inside a CurrentNodeContext
context manager with a dummy prompt_id and node_id. This provides the
required execution context that V3 API nodes expect.
Also fixed indentation — all three execute() calls (DiT, VAE, Upscaler)
are now properly inside the with block.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The previous approach tried 'from custom_nodes import ComfyUI_SeedVR2...'
which fails because ComfyUI doesn't expose custom nodes as importable
packages. Now scans nodes.NODE_CLASS_MAPPINGS directly for the three
SeedVR2 node classes (LoadDiTModel, LoadVAEModel, VideoUpscaler).
This works for both V2 and V3 API nodes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The dashboard upscale (⬆ button) goes through upscale_runner.py, not
generation_orchestrator.py. SeedVR2 mode was only wired into the
inline orchestrator path — dashboard upscales silently produced no
output because mode="seedvr2" resulted in empty combos list.
Now upscale_runner.py handles mode=="seedvr2":
- Opens source image from disk as PIL (no latent decode needed)
- Calls seedvr2_upscale() from image_generation.py
- Saves result as _upscaled.webp in images directory
- Creates manifest entry with proper gen_index, file URL, metadata
- Supports chained steps (SeedVR2 → next step gets PIL result)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds SeedVR2 as a new upscale mode alongside HiRes Fix, Model Upscale,
and Model+HiRes. Requires ComfyUI-SeedVR2_VideoUpscaler to be installed
as a dependency — the plugin calls its nodes programmatically.
Data Model:
- New seedvr2 options object on each upscale step with all SeedVR2
parameters: dit_model, resolution, max_resolution, seed,
color_correction, batch_size, noise scales, blocks_to_swap,
attention_mode, offload_device, cache_model, VAE tiling options
- _defaultSeedVR2Options() / createDefaultSeedVR2Options() helpers
- Migration: ensureStepFields adds seedvr2 defaults to existing configs
Builder UI (conf-builder-config-management.js):
- "SeedVR2 Upscale" added to mode dropdown
- When selected, shows full SeedVR2 settings: DiT model selection
(10 variants: 3B/7B x fp16/fp8/GGUF/sharp), resolution, seed,
color correction, noise scales, batch size, VRAM optimization
(blocks_to_swap, attention_mode, offload), VAE tiling with
conditional encode/decode tile size and overlap fields
Dashboard (logic_upscale_modal.js):
- Same SeedVR2 mode and fields in renderPipelineEditor via _renderStep
- All fields use existing _makeSelect/_makeNumber/_makeCheckbox helpers
Python Execution (image_generation.py):
- New seedvr2_upscale(pil_image, seedvr2_config) function
- Imports SeedVR2 nodes from NODE_CLASS_MAPPINGS at runtime
- Calls SeedVR2LoadDiTModel → SeedVR2LoadVAEModel → SeedVR2VideoUpscaler
- Converts PIL→tensor→SeedVR2→tensor→PIL
- Clear error if SeedVR2 not installed
Pipeline Integration (generation_orchestrator.py):
- Inline upscale path: mode=="seedvr2" branch decodes current latent
to PIL, calls seedvr2_upscale, saves result, updates manifest
- Supports chained steps: non-final SeedVR2 steps re-encode to latent
for the next step in the pipeline
Preset compatible: seedvr2 config serializes naturally as JSON, saved
and loaded with upscale presets without any special handling.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fixed ReferenceError: g is not defined — leftover reference from
deleted groups code. Now copies d.model_type directly from each
manifest item into the flat config, as it should.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The manifest's model_type field was unreliable — in-memory activeData
could have stale values from a previous load, or the Builder UI bug
(per-array not per-model model_type) could poison it.
Now the export ignores d.model_type entirely and determines type from
the actual file extension:
- .gguf → model_type = "gguf"
- anything else → no model_type field (defaults to "checkpoint")
Also removed dead grouping code (was from the old Config Builder state
format, unused since switching to flat config export) and fixed empty
text_encoders array being included (empty [] is truthy in JS).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Manifest items could have incorrect model_type (e.g. "diffusion_model"
on regular .safetensors checkpoints) due to a Builder UI bug where a
single config array's model_type applied to all models in that array.
The export now validates model_type against the actual file extension:
- .gguf files → model_type = "gguf"
- .safetensors files marked "diffusion_model" → dropped (defaults to
checkpoint in expand_configs, which is correct)
- Genuine diffusion_model files (non-.safetensors) → preserved
This prevents the "GGUF and diffusion models do not include a bundled
VAE" error when re-running exported configs of regular checkpoints.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GGUF and diffusion_model types don't bundle a VAE, so setting
vae="Default" in the export causes the sampler to throw ValueError.
Fix: when model_type is not checkpoint and no explicit VAE was stored
in the manifest item, set vae="None" instead of "Default". Also shows
a warning in the export alert when GGUF/diffusion models are detected,
reminding the user to connect a VAE to the sampler's optional_vae input.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The export was producing a Config Builder state object (config_arrays
with arrays of samplers/schedulers/models), but the sampler node's
configs_json input expects flat config entries with single values per
field (sampler, scheduler, model, etc.).
Now produces {"configs": [...]} with one flat config per favorite:
- Each favorite becomes its own config entry with exact field values
read directly from the manifest item
- Deduplicates identical configs (same model+lora+sampler+steps+seed)
- Wraps in {"configs": [...]} which the sampler node's parser expects
- Alert message updated: "Paste into Sampler Grid node's configs_json"
All optional fields (text_encoders, model_sampling, advanced_sampling,
flux_guidance, clip_skip, gguf_options) only included when present.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The previous export only captured model/lora/sampler/scheduler/steps/cfg
and defaulted everything else. Now reads every field from manifest items:
- VAE (collected unique values per group, not hardcoded "None")
- Text encoders (array or string format)
- Clip type (from item, not defaulted to stable_diffusion)
- Attention mode (xformers, pytorch, etc.)
- Resolutions (width x height from each favorite as {width, height})
- Model type (checkpoint/gguf/diffusion_model)
- GGUF options
- Model sampling override + shift values
- Advanced sampling settings (guider, scheduler)
- Flux guidance value
- Model prompt prefix/suffix
- Uses config_positive/config_negative (raw prompts without triggers)
Each group takes advanced settings from its first item (these are
typically identical across favorites from the same model+lora combo).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a button in the Dashboard's Export Favorites section that generates
a complete Config Builder JSON from all favorited items, ready to paste
into the Builder UI's lora_config widget.
How it works:
- Collects all favorited items from activeData
- Groups by unique (model, lora, positive, negative) combination
- Each group becomes a config array with all unique samplers,
schedulers, steps, cfg values from that group's favorites
- LoRA stacks ("lora1 + lora2") are preserved with combine=true
- Per-config prompts are set via use_custom_prompts + positive_prompt_groups
- Session name gets "_rerun" suffix
Output is copied to clipboard. User can then paste into the Config
Builder, adjust resolution/steps/other settings, and regenerate just
the favorited configurations with different parameters.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Windows users occasionally see 'OSError [Errno 22] Invalid argument'
from colorama's write_plain_text when stdout gets into a bad state
(often after a long-running or interrupted session). This crashed the
Config Builder node at its very first print statement, breaking the
entire workflow.
Adds a module-level safe_print() helper that:
1. Tries normal print() first
2. Falls back to raw sys.__stdout__.write on OSError/ValueError
3. Silently drops the message if even that fails
generate_config() now aliases print = safe_print at the top so every
print call in the function is automatically resilient without renaming
each one.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two small fixes:
1. Directory scanner sort inversion:
The Dashboard's fast-path for oldest/newest sort assumes activeData
is stored newest-first (generated sessions prepend new items). The
scanner was writing oldest-first, so both sort modes appeared inverted.
Fix: sort files by mtime DESCENDING (newest first) and assign
gen_index via (total-1-i) so oldest=0, newest=N-1 is preserved.
2. Video click-to-fullscreen removed:
Clicking a video in the Dashboard no longer triggers browser
fullscreen — the interaction was disruptive. Videos still autoplay
when visible and double-click still toggles favorite.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Oldest/Newest sort in the Dashboard uses (gen_index ?? id) as the sort
key. Scanned items had no gen_index and their id was a scan-time
timestamp + random number, which didn't reflect file chronology at all.
Result: Oldest and Newest sort produced effectively random order.
Fix:
- os.scandir captures mtime alongside each file path
- Files sorted by (mtime, path) ascending — oldest first
- Each item gets a sequential gen_index (0 = oldest, N-1 = newest)
- Applied to both new-scan path (_process_single_image) and
cached-manifest path (existing sessions get re-indexed on next scan)
Newest files sort to top in Newest mode, bottom in Oldest mode.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds _probe_mp4_dimensions() — a minimal ISO BMFF container parser that
extracts real width/height from MP4/MOV/M4V files without any new
dependencies. Reads only box headers (a few hundred bytes) by navigating
moov → trak → tkhd and parsing the 16.16 fixed-point dimensions.
Handles:
- 32-bit and 64-bit box sizes (size=1 largesize)
- Version 0 and version 1 tkhd boxes (time field sizing differs)
- Multiple tracks — audio tracks have 0x0 dimensions, loop until a
video track with non-zero dimensions is found
- Container boxes (moov, trak, mdia, minf, stbl, edts) recursively
- Graceful fallback to 1280x720 default if parsing fails (WebM, corrupt)
Also fixes cached-manifest path: if a video entry exists in a previous
scan's manifest but has missing or stale default (1280x720) dimensions,
re-probe the actual file to get real values. This fixes existing sessions
where videos were scanned before this probe was added.
Resolves the "all square cards" issue where the grid's average aspect
ratio calculation was poisoned by uniform 1280x720 defaults across all
videos in the dataset.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two issues were causing grey/unloaded video cards:
1. preload="none" blocked browsers from fetching the first frame for
poster display. Changed to preload="metadata" so the first frame
shows even before play starts.
2. IntersectionObserver had edge cases with CSS transforms on the
virtual scroll canvas — observer wasn't firing for transformed
cards. Replaced with direct control via virtual scroll lifecycle:
- Videos get src set + .load() called when card is added to DOM
- Playback starts after fragment is appended to grid (play() needs
element to be in the DOM)
- Videos are paused + reset via _stopVideoPlayback when cards are
pooled or removed
This uses the virtual scroll range directly (which already handles
pan/zoom/scroll correctly) instead of relying on IntersectionObserver
which has known issues with CSS transforms.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a new "Type" filter row to the filter panel that lets users toggle
between showing images and videos. Works alongside all existing filters
(sampler, scheduler, model, upscale, etc.).
- logic_state.js: new filters.mediaType Set
- logic_pipeline.js: filter check in both incrementalFilter and
executePipeline; included in getFilterKey() hash for cache
invalidation
- logic_ui.js initFilters(): populate mediaType values from
d.media_type (defaults to "image" for backwards compat)
- template.html: new .filter-row with #filter-mediaType container
Items without media_type still appear under "image" automatically.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces hover-to-play with viewport-visibility autoplay for a more
Instagram-like browsing experience. Videos auto-play when their card
enters the viewport (25% threshold) and pause+reset when scrolled off.
- New videoAutoplayObserver in logic_virtual.js with threshold: 0.25
- Each rendered video is registered with the observer
- Pool/removal flow unobserves and pauses the video to prevent leaks
- createCard() in logic_ui.js drops the hover-play listeners; keeps
click-to-fullscreen and loadedmetadata aspect ratio handlers
- Observer also lazy-loads src on first intersection as a safety net
Uses native IntersectionObserver so it respects zoom, pan, and any
viewport transform automatically — no manual bounds math needed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
_create_image_links() had a hardcoded IMAGE_EXTENSIONS set that only
linked .png/.jpg/.jpeg/.webp/.bmp files into the external_images/ symlink
directory. Videos discovered by the scanner were added to the manifest
but never linked, causing ComfyUI's /view endpoint to return 404 for
every video.
Now imports MEDIA_EXTENSIONS from directory_scanner.py so images and
videos share the same allowlist — single source of truth.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds video file support throughout the Dashboard with zero new Python
dependencies — browsers handle all playback, metadata, and thumbnails
natively via HTML5 <video> elements.
directory_scanner.py:
- Add VIDEO_EXTENSIONS (.mp4, .webm, .mov, .m4v) to scan list
- _process_single_image() detects videos by extension and creates a
video manifest item with media_type="video"
- Videos get default 1280x720 dimensions; browser updates on loadedmetadata
- Image items now tagged with media_type="image" for symmetry
Dashboard (logic_ui.js createCard):
- Renders <video preload="none" muted loop playsinline> for video items
- Hides REVISE and upscale buttons for videos (don't apply)
- Shows "▶ VIDEO" badge in top-left corner
- Hover-play: videos play on mouseenter, pause+reset on mouseleave
- Click: requests native browser fullscreen with controls
- loadedmetadata handler updates card aspect ratio from videoWidth/videoHeight
Dashboard (logic_virtual.js):
- Lazy loader extended to swap data-src → src for <video> elements
CSS (report.css):
- .video-badge styling (purple pill, top-left)
- .card video positioning (absolute, cover-fit)
Works with any codec the browser supports (H.264, VP9, AV1, H.265).
Existing features unchanged: favorites, rejects, sorting, filtering,
DOM card pool, merge sessions, quick favorite hotkeys all work on videos.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When toggling fullscreen, the iframe reload was reading the session name
from the node's widget (default "my_session") instead of the session
the user had actually selected in the Dashboard picker.
Now the Dashboard sends its current session name in the fullscreen
postMessage, and the handler prefers that over the widget default.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The master's wait-for-workers loop could block forever if a worker
crashed without cleanup, leaving a job in "Claimed" state. The
_release_timed_out_jobs() was only called during claim_job, never
during the wait loop.
Fixes:
- Call release_timed_out_jobs() every 5s during the wait loop to
reclaim jobs from dead workers (no heartbeat)
- Add configurable wait_timeout (default 600s/10min) from distribution
config — after timeout, force-reclaim all remaining claimed jobs and
proceed to finalization instead of looping forever
- Add public release_timed_out_jobs() method to DistributionManager
- Remaining jobs after timeout are marked completed and abandoned with
a warning, unblocking the ComfyUI queue
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add rerenderConfigSection(node, arrayIdx) that rebuilds only one config
array section instead of the entire UI. debouncedRenderUI now accepts
optional arrayIdx parameter — when provided, uses partial re-render.
This avoids the full DOM rebuild (7k+ nodes) when making changes within
a single config section (add/remove model/lora, toggle settings). Falls
back to full renderUI if the target section isn't found in the DOM.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>