Nodes/ComfyUI-Notebook/Notebook: Force Rerun
ComfyUI Node

Notebook: Force Rerun

Make ComfyUI actually rerun a branch, every time, no cache tricks

By liusida·Created 10 months ago·Updated 5 months ago· 42
Notebook: Force Rerun
    • Trigger

    ComfyUI is lazy, and mostly that's a feature: if a node's inputs didn't change, it skips re-running it and hands you the cached result. It's what makes editing a workflow cheap. But lazy caching becomes a headache the moment you have a node that should run fresh every time you hit queue - a cell that generates random data, a debug probe printing state, a live measurement. Nothing changed on its inputs, so ComfyUI politely shows you last run's answer, and you sit there wondering why your numbers aren't moving.

    NotebookForceRerun exists to break that. It has no inputs, no settings, and one output called Trigger (generic * type). Every time it executes it returns True, and its IS_CHANGED() method returns time.time() - which is never equal to the last call's value. To ComfyUI that means "this node is always dirty," so everything downstream of Trigger is forced to re-execute on every queue, cache or not.

    When to reach for it

    The class docstring nails the use cases: debugging, generating random data, or anything you want to run every time regardless of whether its other inputs changed. The pattern it's built for lives in this same pack - run its Trigger output into a NotebookCell's input socket, and the cell always runs even when you didn't touch the code:

    NotebookForceRerun.Trigger  →  NotebookCell.input
    

    Change the code? It reruns anyway. Change nothing? Still reruns. That's the point - it converts a cached, "did nothing" branch into one that always executes, which is exactly what you want while you're debugging a cell that reads global state or a generator that should produce something new each pass.

    The trap

    Force rerun is a blunt instrument. It invalidates everything downstream of Trigger, not just one node. Attach it high in your graph and you've disabled caching for a whole subtree - every run redoes that work from scratch, which means slower queues and, if anything down there has side effects (file writes, API calls, kernel state), they'll fire every single time. So wire it to the specific branch you're actually debugging, not to the graph root, and take it out once the investigation's over. Also note it only forces nodes downstream - it does nothing to upstream nodes that feed the branch, so if the real problem is a node above the branch being cached, Force Rerun won't fix it.

    It's also from a pack written against ComfyUI's newer V3 node API, so if it doesn't appear after install, update ComfyUI first - an older build won't load it. There's genuinely not much more to say about a node whose entire job is "return True and look changed"; if you find yourself wanting it to do more, you're probably solving the wrong problem.

    Install

    Same as the rest of the pack - Manager, search "Notebook", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/liusida/ComfyUI-Notebook
    

    Then restart ComfyUI. No model downloads, no heavy dependencies (just matplotlib in requirements.txt, and you only need that for the plotting cells, not this node).

    Categorynotebook

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    Trigger*