Skip to content

The agent that grows with you

refactor(gateway): fold the internal-wake anchor guard into the Slack no-anchor branch

kshitijk4poor63146d1321cf
diff --git a/gateway/platforms/base.py b/gateway/platforms/base.py
index 57bae153ba0..6d1d6fda0bc 100644
--- a/gateway/platforms/base.py
+++ b/gateway/platforms/base.py
@@ -159,19 +159,14 @@ def _reply_anchor_for_event(event) -> str | None:
override = getattr(event, "reply_anchor_override", None)
if override is not None:
return override # the turn was redirected onto another message (#115001)
- if getattr(event, "internal", False):
- # A synthetic wake's message_id is its producer identity (an admitted automation restores
- # the JSON completion identity there), not a platform reply id: anchoring on it breaks the
- # adapter's send (Telegram int()s it). Synthetic events never reply-anchor (#52694).
- return None
source = getattr(event, "source", None)
platform = _platform_name(getattr(source, "platform", None))
thread_id = getattr(source, "thread_id", None)
raw_message = getattr(event, "raw_message", None)
- if (platform == "slack" and isinstance(raw_message, dict)
- and raw_message.get("_hermes_no_thread_response")):
- # Slack reaction handoff = new top-level message; a message_id anchor would make
- # _resolve_thread_ts() reply in a nonexistent thread.
+ if getattr(event, "internal", False) or (platform == "slack" and isinstance(raw_message, dict)
+ and raw_message.get("_hermes_no_thread_response")):
+ # A synthetic wake's message_id is its producer identity, not a platform id (Telegram int()s
+ # it; #52694). A Slack reaction handoff is a new top-level message, not a thread reply.
return None
if platform == "telegram" and thread_id:
# Forum topics route by topic metadata (no reply); DM-topic lanes reply to the triggering