fix: skip $$-prefixed inputs in cache signature computation#12632
fix: skip $$-prefixed inputs in cache signature computation#12632
Conversation
894a20c to
6505622
Compare
📝 WalkthroughWalkthroughThe 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ 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. Comment |
There was a problem hiding this comment.
🧹 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()returnsFalsefor them inget_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_internalwould still walk it intoorder_mapping, while the signature loop would silently skip it. That asymmetry could produce incorrect cache hits in that hypothetical case. A defensive guard inget_ordered_ancestry_internalwould 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.
Frontend now sends
$$node-text-previewin 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
$$-prefixedkeys inget_immediate_node_signature- these are frontend metadata already ignored during execution.