hermes-agent/tests/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
…
stub_connector.py
…
test_auth.py
…
test_channel_context_consume.py
…
test_contract_doc_conformance.py
…
test_descriptor.py
…
test_descriptor_from_entry.py
…
test_handoff_relay_aliasing.py
…
test_identity_token_resolver.py feat(relay): ambient token endpoint mode for gateway.idp.token_url (#84074) 2026-08-12 10:06:28 +10:00
test_no_stub_leak.py
…
test_relay_adapter.py
…
test_relay_follow_up.py
…
test_relay_going_idle.py
…
test_relay_interactive.py
…
test_relay_interrupt.py
…
test_relay_media.py
…
test_relay_multiplatform.py
…
test_relay_passthrough.py fix(relay): stamp logical platform + relay trust on Discord interaction events (#84318) 2026-08-12 17:04:02 +10:00
test_relay_per_platform_caps.py
…
test_relay_policy_send.py
…
test_relay_registration.py
…
test_relay_roundtrip.py
…
test_relay_roundtrip_telegram.py
…
test_relay_sheds_crypto.py
…
test_relay_slack_dm_streaming.py
…
test_relay_slack_prompt_dm_root.py
…
test_relay_threads.py
…
test_self_provision.py
…
test_wire_user_identity.py
…
test_ws_transport.py
…