Comfy-Org / Comfy-Org/ComfyUI

emit_cached_output at execution.py:818 doesn't pass merge flag for intermediate-output nodes

Open Beginner friendly
#16,307 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

Follow-up from PR https://github.com/Comfy-Org/ComfyUI/pull/16304 (accumulate/merge flag on cached SaveImage/PreviewImage outputs), flagged by CodeRabbit review.

`execution.py` has two call sites for `emit_cached_output`:
- Line 445 (per-node direct cache-hit path, fires for any node): correctly passes `merge=merge` derived from `inputs.get('accumulate') is True`.
- Line 818 (end-of-loop cleanup pass, only for nodes with `HAS_INTERMEDIATE_OUTPUT` that weren't executed this run): does NOT pass `merge`.

Today this doesn't affect `SaveImage`/`PreviewImage` since neither sets `HAS_INTERMEDIATE_OUTPUT`, so #16304's fix is correct for its target case. But any node type that both sets `HAS_INTERMEDIATE_OUTPUT` and adopts an `accumulate`-style merge flag in the future would hit this same missing-flag bug via the 818 path instead.

Fix: derive and pass `merge` at line 818 the same way line 445 does.

Contributor guide

Open the contributing guide

Research direction

Read the two `emit_cached_output` call sites in `execution.py`, especially the end-of-loop cleanup path around line 818 and the direct cache-hit path around line 445. Done means the cleanup path derives and passes the `merge` flag the same way as the direct cache-hit path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.