Nodes/AutoResetInt/Auto Reset Int πŸ”„
ComfyUI Node

Auto Reset Int πŸ”„

A batch counter that cleans up after itself

By majidfidaΒ·Created 4 months agoΒ·Updated 4 months agoΒ· 0
Auto Reset Int πŸ”„
    • value
    β—„value0β–Ί
    β—„reset_modeAutoβ–Ί
    β—„reset_delay_seconds3β–Ί

    The name is the whole pitch. Auto Reset Int πŸ”„ is ComfyUI's built-in PrimitiveInt - the plain integer value node - with one extra job: it watches the queue and snaps its value back to 0 the moment everything finishes. No clicks, no forgetting, no "wait, why did batch two start on frame 27?"

    You reach for it when you have a counter that drives a batch. The classic setup: wire it into something like auto_prompt_schedule's frame index so each image in a run walks through your prompt schedule - frame 0, 1, 2, ... - and you queue a whole batch at once. With a plain primitive, the counter keeps climbing after the run, so the next batch silently starts wherever the last one stopped. AutoResetInt makes every batch start from zero, hands-free. It's a tiny node with one real use case, and it nails it.

    How it works

    Don't go looking for clever Python in here - node.py is a pass-through that returns the value it's given. All the magic lives in the frontend extension (js/auto_reset_int.js). It listens for ComfyUI's execution_success event, waits a beat, then asks the server for the queue state via api.getQueue(). If both running and pending queues are empty, it resets the widget to 0 and paints a little badge on the node so you can see it happened. Click Stop mid-batch and it resets instantly, with a yellow badge instead of the green one.

    That frontend-only design is the one thing to keep in mind: if you drive ComfyUI purely through the API with no browser attached, nobody's listening, so the reset never fires.

    The inputs that matter

    Only three, and you'll mostly touch two:

    • value - the counter itself, 0 to 999999. Its control_after_generate dropdown (which defaults to Increment) is what actually advances it between runs: increment, decrement, randomize, or fixed.
    • reset_mode - Auto resets the instant the queue empties; Manual waits reset_delay_seconds first. Manual is for when you want to peek at the last image before the countdown takes the counter away - the node even shows a "reset in 3.0 s" countdown badge.
    • reset_delay_seconds - 1–300, default 3. Only used in Manual mode.

    The single output is value (INT), and it wires straight into whatever counter or frame-index input you're driving.

    Installing it

    No dependencies, no model downloads, no pip installs - it's pure Python plus JavaScript, MIT licensed. Either grab it through ComfyUI Manager (search "AutoResetInt") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/majidfida/AutoResetInt
    

    Restart ComfyUI and it shows up in the utils category. One caveat: the README asks for ComfyUI 0.20.1+ (frontend v1.43.17+). The node leans on frontend events and newer widget APIs, so on an old install it won't error - it just silently won't reset. If it's not resetting, update ComfyUI before you suspect the node.

    Gotchas worth knowing

    The reset fires only when the queue fully drains. Queue twenty images and it resets after the twentieth - that's the point. But if your workflow re-queues forever, it never drains, so it never resets. By design, not a bug. And because it's built on control_after_generate, the value in the box is the one for the next run, not the last one - the classic ComfyUI gotcha. If that bugs you, flip the "widget control mode" setting to Before once and be done with it.

    Simple, single-purpose, does what it says. If you batch counter-driven schedules, it's one of those small quality-of-life nodes you install and forget you're using.

    Categoryutils

    Inputs (3)

    NameTypeDefaultDescription
    valueINT00–999999Current counter. The 'control_after_generate' dropdown handles increment / decrement / randomize.
    reset_modeCOMBOAutoAuto: reset instantly when the queue empties. Manual: wait reset_delay_seconds after the queue empties.
    reset_delay_secondsINT31–300Only used in Manual mode. Seconds to wait before resetting.

    Outputs (1)

    NameTypeDescription
    valueINTβ€”