hermes-agent/gateway/relay
Ben Barclay 333536e7c9
fix(relay): stamp logical platform + relay trust on Discord interaction events (#84318)
The relay interactions passthrough lane (_discord_interaction_to_event)
built its SessionSource with platform=Platform.RELAY and no
delivered_via_upstream_relay marker — unlike the relay text lane
(ws_transport._event_from_wire), which maps the connector's platform to
the logical enum and stamps the authenticated-upstream flag.

Consequences of the mismatch:

- /sethome sent as a Discord slash command persisted the home channel
  under platforms.relay.home_channel (invisible to cron delivery, which
  looks up the logical platform) and mirrored it into the dead
  RELAY_HOME_CHANNEL env var — so cron jobs with deliver='discord' kept
  falling back to local-only even after the resolution/delivery fixes.
  The absent trust marker also meant via_relay=False, so the handler's
  'Relay does not authenticate this logical home target' guard —
  designed to reject exactly this misfiled shape — never engaged.
- Session keys forked: the connector binds the interaction's follow-up
  capability under buildSessionKey with platform 'discord' and
  chat_type 'group' (interactionSessionSource), while the gateway keyed
  the same interaction as relay/channel.
- _capture_scope skipped recording _platform_by_chat (it ignores the
  generic 'relay'), losing the egress sender hint for the chat.

Stamp Platform.DISCORD (the lane statically parses Discord interaction
wire payloads), chat_type 'group' for guild channels (native-adapter and
connector parity), and delivered_via_upstream_relay=True (parity with
the text lane; set locally, never read off the wire).

With this, slash-command /sethome files under platforms.discord and
passes the via_relay guard legitimately, and cron delivery over relay
works end to end with the #84300 resolution fixes.
2026-08-12 17:04:02 +10:00
..
__init__.py
adapter.py fix(relay): stamp logical platform + relay trust on Discord interaction events (#84318) 2026-08-12 17:04:02 +10:00
auth.py
command_manifest.py
descriptor.py
media.py
transport.py
ws_transport.py