Fix sanitize_signature_input

This commit is contained in:
xmarre 2026-03-14 06:56:49 +01:00
parent 2adde5a0e1
commit 39086890e2
2 changed files with 4 additions and 0 deletions

View File

@ -52,6 +52,7 @@ class Unhashable:
def _sanitized_sort_key(obj, depth=0, max_depth=32): def _sanitized_sort_key(obj, depth=0, max_depth=32):
"""Build a deterministic sort key from sanitized built-in container content."""
if depth >= max_depth: if depth >= max_depth:
return ("MAX_DEPTH",) return ("MAX_DEPTH",)
@ -83,6 +84,7 @@ def _sanitized_sort_key(obj, depth=0, max_depth=32):
def _sanitize_signature_input(obj, depth=0, max_depth=32): def _sanitize_signature_input(obj, depth=0, max_depth=32):
"""Sanitize prompt-signature inputs without recursing into opaque runtime objects."""
if depth >= max_depth: if depth >= max_depth:
return Unhashable() return Unhashable()
@ -120,6 +122,7 @@ def _sanitize_signature_input(obj, depth=0, max_depth=32):
return Unhashable() return Unhashable()
def to_hashable(obj): def to_hashable(obj):
"""Convert prompt-safe built-in values into a stable hashable representation."""
# Restrict recursion to plain built-in containers. Some custom nodes insert # Restrict recursion to plain built-in containers. Some custom nodes insert
# runtime objects into prompt inputs for dynamic graph paths; walking those # runtime objects into prompt inputs for dynamic graph paths; walking those
# objects as generic Mappings / Sequences is unsafe and can destabilize the # objects as generic Mappings / Sequences is unsafe and can destabilize the

View File

@ -1,4 +1,5 @@
def is_link(obj): def is_link(obj):
"""Return True if obj is a plain prompt link of the form [node_id, output_index]."""
# Prompt links produced by the frontend / GraphBuilder are plain Python # Prompt links produced by the frontend / GraphBuilder are plain Python
# lists in the form [node_id, output_index]. Some custom-node paths can # lists in the form [node_id, output_index]. Some custom-node paths can
# inject foreign runtime objects into prompt inputs during on-prompt graph # inject foreign runtime objects into prompt inputs during on-prompt graph