The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): inline the single-caller inbound_dedup_caches
kshitijk4poor21ede9981a2f
diff --git a/gateway/platforms/helpers.py b/gateway/platforms/helpers.pyindex 6ddb232ff5f..09674f82e26 100644--- a/gateway/platforms/helpers.py+++ b/gateway/platforms/helpers.py@@ -66,21 +66,17 @@ class MessageDeduplicator:self._seen.update({k: v for k, v in other._seen.items() if v > cutoff and k not in self._seen})-def inbound_dedup_caches(adapter: Any) -> dict[str, MessageDeduplicator]:- """The adapter's ``MessageDeduplicator`` attributes, by name (held by reference, so IDs the old- adapter admits after this call still reach its replacement)."""- return {name: v for name, v in vars(adapter).items() if isinstance(v, MessageDeduplicator)}--def carry_inbound_dedup(predecessor: Any, adapter: Any) -> None:"""Seed a rebuilt adapter's dedup caches from the instance it replaces (call before connect).The runner's reconnect path builds a NEW adapter; without this a platform replaying a recentinbound ID after the reconnect (websocket resume, webhook retry, unacked poll batch) isadmitted and answered a second time."""- for name, previous in (inbound_dedup_caches(predecessor) if predecessor is not None else {}).items():+ if predecessor is None:+ return+ for name, previous in vars(predecessor).items():current = getattr(adapter, name, None)- if isinstance(current, MessageDeduplicator) and current is not previous:+ if isinstance(previous, MessageDeduplicator) and isinstance(current, MessageDeduplicator) and current is not previous:current.absorb(previous)