Nodes/Boyonodes/Boyo Latent Cache Updater
ComfyUI Node

Boyo Latent Cache Updater

Sneak a sampler's output back into the next loop pass without a graph cycle

By DragonDiffusionbyBoyo·Created 2 years ago·Updated 26 days ago· 16
Boyo Latent Cache Updater
  • latent
  • latent
cache_keylatent_loop_cache
counter0

ComfyUI won't let you connect a node's output back into its own input - that's a cycle, and cycles crash the graph. But infinite and chunked video generation runs on exactly that dependency: the next chunk needs the previous chunk's latent as its starting point. Boyo Latent Cache Updater is the workaround. It writes a latent into the pack's loop cache under a string key and passes the tensor through untouched. The write and the read are split across two nodes, so there's no cycle - just a cache handshake.

The shape is: sampler output → Latent Cache Updater (writes to cache, passes through) → VAE decode / save / whatever. Then, on the next iteration, its partner Boyo Latent Switch reads the cached latent and feeds it to the sampler's latent input. Two nodes, no edge between sampler output and sampler input, and the loop is legal.

The inputs

  • latent - the tensor to cache. Usually the samples straight out of a KSampler.
  • cache_key - the string that identifies this cache slot, default latent_loop_cache. This must match the cache_key on the Boyo Latent Switch that reads it. Change one and forget the other and you've got a silent cache miss.
  • counter - optional loop iteration number, only used for logging.

Output: latent, the exact same tensor you put in, unchanged.

Install

Part of Boyonodes. ComfyUI Manager → search "Boyonodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/DragonDiffusionbyBoyo/Boyonodes

Restart. No extra dependencies - it talks to the loop cache the pack already ships in boyo_for_loops_exact.py.

The mental model

Think of it as a note pinned for the next iteration to find, not a data connection. The key insight - and the thing people trip on - is that the updater alone does nothing useful. It's half a pair: write here, read at Boyo Latent Switch. If your loop isn't carrying context forward, check that both nodes use the same cache_key before you blame the sampler.

CategoryBoyo/Latent

Inputs (3)

NameTypeDefaultDescription
latentLATENT
cache_keySTRINGlatent_loop_cache
counteroptINT00–999999

Outputs (1)

NameTypeDescription
latentLATENT