fix(jobs): prefer media over text for job preview_output#14681
fix(jobs): prefer media over text for job preview_output#14681DeniDoman wants to merge 8 commits into
Conversation
get_outputs_summary shared a single fallback slot between text and non-output media, so a text node iterated before an image (e.g. a temp preview) claimed the preview and masked the image, surfacing a text cover for mixed image+text jobs. Give text its own lowest-priority slot so a media thumbnail always wins; text is used only when the job produced no image/video/audio/3d output. Adds coverage for the previously-untested text preview path.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (4)**/*📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
**⚙️ CodeRabbit configuration file
Files:
comfy_execution/**⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (1)📚 Learning: 2026-02-21T14:01:41.482ZApplied to files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughIn 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
So, what should be done to merge it? |
…efer-media-over-text
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@comfy_execution/jobs.py`:
- Around line 269-271: Update the output-counting logic in the job processing
flow so entries with media_type == 'text' increment outputs_count before the
preview-only continue. Preserve the existing text fallback-preview behavior
while ensuring text-only jobs count as 1 and mixed text/media jobs include text
entries in the total.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6af74e1d-738c-4ef9-8269-fa5305475e22
📒 Files selected for processing (1)
comfy_execution/jobs.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Keep imports at module scope; avoid inline imports unless they are already part of an established optional-backend probe or are needed to avoid an import cycle.
Do not add unnecessarytry/exceptblocks; use them for optional dependency, platform, or backend capability detection only when the program has a useful fallback, and prefer specific exception types when changing new code.
If a library version is pinned inrequirements.txt, do not add code to ComfyUI to handle older versions of that library.
Remove any workarounds for PyTorch versions that ComfyUI no longer officially supports; deprecated workarounds include catching an exception and rerunning the same op with the input cast to float unless the code comments name the exact supported PyTorch versions.
Let unsupported model formats, invalid quantization metadata, and bad states fail with clear errors instead of silently producing lower quality output.
Match the existing local style in the file you edit; long lines, simple helper functions, module-level state, and direct tensor operations are acceptable when they make the code easier to follow.
Keep comments sparse and useful; strip comments that restate the code or describe obvious behavior, and keep short TODOs only when they name the concrete missing follow-up.
Treat dtype, device placement, VRAM usage, and offloading behavior as core correctness concerns; check CPU, CUDA, ROCm, MPS, DirectML, XPU, NPU, and low-VRAM implications when touching shared execution or loading code.
Prefer native ComfyUI formats and existing quantization/offload helpers over adding parallel code paths; usecomfy.quant_ops,comfy.model_management,comfy.memory_management,comfy.pinned_memory,comfy_aimdo, andcomfy-kitchenhelpers where they already solve the problem.
Use optimized comfy-kitchen ops in places where they improve performance without changing the expected dtype, device, memory, or interface behavior.
All models should use the optimized atte...
Files:
comfy_execution/jobs.py
**
⚙️ CodeRabbit configuration file
**: IMPORTANT: Only comment on issues directly introduced by this PR's code changes.
Treat AGENTS.md as mandatory repository policy, not optional style guidance.
Flag PR changes that violate AGENTS.md even when the code is otherwise functional.
In particular, enforce architecture boundaries, dtype/device/memory rules,
interface contracts, import style, no unnecessary try/except blocks, no inline
imports, no outbound internet paths in core ComfyUI, and narrow scoped fixes.
Prefer direct findings over suggestions when a rule is violated. Only ignore
AGENTS.md when it clearly conflicts with a newer explicit maintainer instruction
in the PR.
Do NOT flag pre-existing issues in code that was merely moved, re-indented,
de-indented, or reformatted without logic changes. If code appears in the diff
only due to whitespace or structural reformatting (e.g., removing awith:block),
treat it as unchanged. Contributors should not feel obligated to address
pre-existing issues outside the scope of their contribution.
Files:
comfy_execution/jobs.py
comfy_execution/**
⚙️ CodeRabbit configuration file
comfy_execution/**: Execution engine (graph execution, caching, jobs). Focus on:
- Caching correctness
- Concurrent execution safety
- Graph validation edge cases
Files:
comfy_execution/jobs.py
🧠 Learnings (1)
📚 Learning: 2026-02-21T14:01:41.482Z
Learnt from: pythongosssss
Repo: Comfy-Org/ComfyUI PR: 12555
File: comfy_extras/nodes_glsl.py:719-724
Timestamp: 2026-02-21T14:01:41.482Z
Learning: In PyOpenGL, bare Python scalars can be accepted for 1-element array parameters by NumberHandler. This means you can pass an int/float directly to OpenGL texture deletion (e.g., glDeleteTextures(tex)) without wrapping in a list. Verify function-specific expectations and ensure types match what the OpenGL call expects; use explicit lists only when the API requires an array.
Applied to files:
comfy_execution/jobs.py
🔇 Additional comments (2)
comfy_execution/jobs.py (2)
59-60: LGTM!Also applies to: 163-168
262-267: LGTM!Also applies to: 327-327
|
Hi @DeniDoman thanks for pushing this. I'll give it a test and will merge if everything works fine. |
…ntics The master merge stopped counting text entries as outputs (they are preview-only metadata). Update the two preview-priority tests so their count assertions match; the media-over-text preview assertions are unchanged.
|
@alexisrolland awesome! I have another annoying bug fix in the Frontend part, it would be also nice to merge it! |
|
@DeniDoman this does not seem to work as intended, in all situation, I can still see text output in the preview in the asset panel. You can reproduce with the following:
Second run is KO and still shows the text as preview, probably because of some caching mechanism.
|
|
@alexisrolland oh, sorry, lack of testing, I was too focused with "preview" so forgot to verify the "save" flow. The root cause turned out to be one level deeper than my original fix. "Text" exists in two shapes in job outputs: raw strings under The priority is now: saved visual media → any visual media (incl. temp previews) → saved text file → raw text. I also added a couple more tests. Thank you for the reviewing! P.S. I already signed CLA, but seems it's failed, so:
|
|
@alexisrolland could you please look one more time? |

Addresses #14680