A relayed Discord message carries connector-resolved chat_name / chat_topic and
user_display_name; a relayed interaction (slash command, component, modal) was
built from the raw body: user_name = raw username, no chat labels, and inside a
thread chat_type "group" with no thread_id / parent_chat_id. All of these feed
_ephemeral_change_key, so message -> interaction -> message re-rendered the
pinned session-context prompt each way, and a slash in a thread keyed another
session.
- the interaction names its user from its own payload: guild nick, else
global name, else username (discord.py display_name order);
- the text lane's last (chat_name, chat_topic) per (guild, chat) is kept in a
bounded map and recorded in state_meta when observed (off the loop,
retryable when the database is away); the interaction lane reads the map,
then the record after a restart;
- a thread interaction derives chat_type=thread, thread_id, parent_chat_id
from the partial channel object;
- a cancellation before admission releases the inbound seen bit so the
connector's replay is admitted.
Squash-port of #128797 (six commits) onto current main, where
_discord_interaction_to_event lives in gateway/relay/adapter_discord_interaction.py;
_on_passthrough moves there with it to keep adapter.py under its health cap.