use static seed for wildcard-nodes if text is not seed dependent#1190
Open
vslinx wants to merge 2 commits into
Open
use static seed for wildcard-nodes if text is not seed dependent#1190vslinx wants to merge 2 commits into
vslinx wants to merge 2 commits into
Conversation
…when no seed dependent text is present to prevent unnecessary execution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this change?
I use the wildcard nodes in several dynamic workflows, often inside subgraphs, where I pass multiline prompts directly into the
populated_textinput. In practice, I frequently tweak settings later in the graph and re-run the workflow. Right now, that often forces a full re-execution from the wildcard node onward because the node’s seed changes—even when the prompt contains no wildcard/dynamic syntax and the output would be identical.Manually fixing the seed in every subgraph isn’t very practical, and adding additional seed controls outside the subgraphs just to stabilize this one node would add clutter. This change avoids unnecessary re-runs by normalizing the seed when it cannot affect the processed text, while keeping existing behavior intact for prompts that actually use seed-dependent syntax.
Technical changes
When
ImpactWildcardProcessororImpactWildcardEncodeis used with the seed control set to randomize / increment / decrement, ComfyUI updates the seed value on every run. Even if the prompt contains no wildcard or dynamic syntax, the changed seed ends up in the queued prompt JSON, which forces downstream nodes to re-execute.This change detects when the effective input text contains no seed-dependent Impact syntax and, in that case, normalizes the seed to a fixed value (0) before execution. This prevents unnecessary prompt “population” work and avoids re-running the workflow when the actual prompt content has not changed.
When the input text is provided via a link, the handler walks upstream through the linked nodes and inspects their text inputs to determine whether any Impact wildcard/dynamic syntax (i.e. seed-dependent content) could be present. Only when it can confidently determine that no seed-dependent syntax exists anywhere upstream does it normalize the seed to 0 internally, preventing unnecessary downstream re-execution. This approach also works when text is routed through subgraphs or composed via concat/other string nodes. The normalization is only applied when the seed itself is a direct integer input (not a linked value), so externally controlled seeds are never overridden.