refactor(langgraph): simplify Send sanitization with dict comprehension

Co-authored-by: sydney-runkle <54324534+sydney-runkle@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-10-28 23:11:55 +00:00
co-authored by sydney-runkle
parent 57f0e846e8
commit 91f6fea068
+5 -9
View File
@@ -1121,14 +1121,10 @@ def sanitize_untracked_values_in_send(
# Command
return packet
sanitized_arg = dict(packet.arg)
# top level keys should be the channel names
to_pop = set()
for k, v in sanitized_arg.items():
if isinstance(channels.get(k), UntrackedValue):
to_pop.add(k)
for k in to_pop:
sanitized_arg.pop(k)
sanitized_arg = {
k: v
for k, v in packet.arg.items()
if not isinstance(channels.get(k), UntrackedValue)
}
return Send(node=packet.node, arg=sanitized_arg)