Skip to content

fix: skip $$-prefixed inputs in cache signature computation#12632

Open
bigcat88 wants to merge 1 commit intomasterfrom
fix/cache-invalidation-dollar-prefix-inputs
Open

fix: skip $$-prefixed inputs in cache signature computation#12632
bigcat88 wants to merge 1 commit intomasterfrom
fix/cache-invalidation-dollar-prefix-inputs

Conversation

@bigcat88
Copy link
Contributor

@bigcat88 bigcat88 commented Feb 25, 2026

Frontend now sends $$node-text-preview in node inputs with values that change between runs (e.g. execution timing). The cache signature was computed over all input keys, causing cache misses on identical re-runs.

Skip $$-prefixed keys in get_immediate_node_signature - these are frontend metadata already ignored during execution.

@bigcat88 bigcat88 force-pushed the fix/cache-invalidation-dollar-prefix-inputs branch from 894a20c to 6505622 Compare February 25, 2026 15:53
@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

The get_immediate_node_signature function in comfy_execution/caching.py has been modified to skip input keys that begin with "$$" during signature construction. This change filters out internal or annotation-marked inputs from both the ancestor-derived and direct inputs portions of the resulting node signature. The modification adds two lines and does not alter any other logic or control flow in the function.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: skipping $$-prefixed inputs in cache signature computation to fix cache invalidation issues.
Description check ✅ Passed The pull request description clearly explains the problem (cache misses due to changing $$-prefixed inputs) and the solution (skip these keys in signature computation).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
comfy_execution/caching.py (1)

119-128: LGTM — fix is correct and minimal.

Skipping $$-prefixed keys in the signature loop directly addresses the cache-miss regression. Because these keys carry metadata strings (not link tuples), is_link() returns False for them in get_ordered_ancestry_internal, so no parallel change is needed there — they were already a no-op in ancestry traversal.

One minor thing worth being aware of: if the frontend ever sends a $$-prefixed input that is a link (unlikely per the current contract, but possible in future), get_ordered_ancestry_internal would still walk it into order_mapping, while the signature loop would silently skip it. That asymmetry could produce incorrect cache hits in that hypothetical case. A defensive guard in get_ordered_ancestry_internal would future-proof this:

🛡️ Optional defensive guard for future-proofing
     input_keys = sorted(inputs.keys())
     for key in input_keys:
+        if key.startswith("$$"):
+            continue
         if is_link(inputs[key]):
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@comfy_execution/caching.py` around lines 119 - 128, Add a defensive guard to
get_ordered_ancestry_internal so it ignores inputs whose keys start with "$$"
before treating them as links: check the input key prefix early in the loop (the
same "$$" check used in the signature builder) and skip processing/adding to
ancestor/order mappings for those keys; this keeps behavior symmetric with the
signature construction and prevents future mismatches if a $$-prefixed value
ever appears as a link, while still using is_link(...) for normal keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@comfy_execution/caching.py`:
- Around line 119-128: Add a defensive guard to get_ordered_ancestry_internal so
it ignores inputs whose keys start with "$$" before treating them as links:
check the input key prefix early in the loop (the same "$$" check used in the
signature builder) and skip processing/adding to ancestor/order mappings for
those keys; this keeps behavior symmetric with the signature construction and
prevents future mismatches if a $$-prefixed value ever appears as a link, while
still using is_link(...) for normal keys.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ebe1ac and 6505622.

📒 Files selected for processing (1)
  • comfy_execution/caching.py

@bigcat88 bigcat88 added the Core Core team dependency label Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core Core team dependency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant