hermes-agent/tests/gateway/relay
Ben Barclay 96996a55bf
fix(relay): per-platform capability descriptors for multi-platform gateways (#70717)
One relay adapter fronts N platforms on one WS, but the capability surface
(MAX_MESSAGE_LENGTH / message_len_fn) was a scalar from whichever descriptor
resolved the handshake — and the transport's read loop OVERWROTE it on every
descriptor frame (last-writer-wins). A Discord chat on a gateway whose
applied descriptor was Telegram's inherited the 4,096-char cap and over-sent
into Discord's 2,000-char API 400 (observed live: 2,543/2,641-char replies
silently lost while inbound kept working).

- ws_transport: accumulate one descriptor per platform in
  _descriptors_by_platform (exposed via descriptor_for_platform); the FIRST
  descriptor of a connection generation stays the session default instead of
  last-writer-wins; the map resets on re-dial.
- BasePlatformAdapter: new max_message_length_for_chat /
  message_len_fn_for_chat hooks defaulting to the scalar surface (native
  single-platform adapters unchanged).
- RelayAdapter: overrides resolve the chat's platform from _platform_by_chat
  (the same map per-frame egress uses) and look up that platform's negotiated
  descriptor; falls back to the scalar for unknown chats/transports.
- stream_consumer (streaming budget, _raw_message_limit, fallback-continuation
  chunking) + run.py tool-progress limit now resolve per-chat.

Tests: tests/gateway/relay/test_relay_per_platform_caps.py (7) — verified
fail-without/pass-with (all 7 fail with the fix stashed). Relay + stream
consumer suites green (213 + 223).
2026-07-27 14:24:14 +10:00
..
__init__.py
stub_connector.py feat(relay): Phase 3 interactive — native prompt UX (approvals/confirms/clarify) + react ack lifecycle (#71404) 2026-07-26 07:57:39 +10:00
test_auth.py
test_channel_context_consume.py
test_contract_doc_conformance.py
test_descriptor.py feat(relay): Phase 1 parity — supported_ops discovery, wire identity fields, /handoff aliasing, provision displayName (#71300) 2026-07-25 20:36:16 +10:00
test_descriptor_from_entry.py
test_handoff_relay_aliasing.py feat(relay): Phase 1 parity — supported_ops discovery, wire identity fields, /handoff aliasing, provision displayName (#71300) 2026-07-25 20:36:16 +10:00
test_identity_token_resolver.py
test_no_stub_leak.py
test_relay_adapter.py feat(relay): Phase 1 parity — supported_ops discovery, wire identity fields, /handoff aliasing, provision displayName (#71300) 2026-07-25 20:36:16 +10:00
test_relay_follow_up.py
test_relay_going_idle.py
test_relay_interactive.py feat(relay): Phase 3 interactive — native prompt UX (approvals/confirms/clarify) + react ack lifecycle (#71404) 2026-07-26 07:57:39 +10:00
test_relay_interrupt.py
test_relay_media.py feat(relay): Phase 2 media parity — send_media egress + inbound media localization (#71363) 2026-07-25 23:15:52 +10:00
test_relay_multiplatform.py
test_relay_passthrough.py fix(relay): normalize forwarded Discord interactions to leading-slash commands (#71048) 2026-07-25 13:29:36 +10:00
test_relay_per_platform_caps.py fix(relay): per-platform capability descriptors for multi-platform gateways (#70717) 2026-07-27 14:24:14 +10:00
test_relay_policy_send.py fix(relay): declare explicit relevance policy when require_mention is configured false (#69816) 2026-07-23 13:57:57 +10:00
test_relay_registration.py
test_relay_roundtrip.py feat(relay): Phase 1 parity — supported_ops discovery, wire identity fields, /handoff aliasing, provision displayName (#71300) 2026-07-25 20:36:16 +10:00
test_relay_roundtrip_telegram.py
test_relay_sheds_crypto.py
test_relay_threads.py feat(relay): Phase 4 thread lifecycle — handoff threads, semantic renames, reply_to context, hello command manifest (#71624) 2026-07-26 10:26:20 +10:00
test_self_provision.py feat(relay): Phase 1 parity — supported_ops discovery, wire identity fields, /handoff aliasing, provision displayName (#71300) 2026-07-25 20:36:16 +10:00
test_wire_user_identity.py feat(relay): Phase 1 parity — supported_ops discovery, wire identity fields, /handoff aliasing, provision displayName (#71300) 2026-07-25 20:36:16 +10:00
test_ws_transport.py