Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Merge remote-tracking branch 'origin/main' into bug-fix/unknown-member-first-message-dropped

Louis Amaudruz3ec1e504b2d8
diff --cc core/switch_core/bridges/collaboration/bridge_core.py
index d7e7c0d83,2f71453d1..8a33c104e
--- a/core/switch_core/bridges/collaboration/bridge_core.py
+++ b/core/switch_core/bridges/collaboration/bridge_core.py
@@@ -44,10 -48,26 +48,30 @@@ if TYPE_CHECKING
logger = logging.getLogger(__name__)
+# How long to wait for a freshly-invited external-user puppet to actually join a
+# room before giving up on relaying its message.
+PUPPET_JOIN_TIMEOUT = 30.0
+
+ # How long to hold an incomplete outbound attachment group before relaying the
+ # parts that arrived, flagged as incomplete (see _schedule_outbound_group_flush).
+ OUTBOUND_GROUP_TIMEOUT_SECONDS = 5.0
+
+
+ @dataclass
+ class _PendingOutboundGroup:
+ """Files of a multi-attachment message seen so far, keyed by group index."""
+
+ total: int
+ parts: dict[int, OutboundAttachment] = field(default_factory=dict)
+ caption: str | None = None
+ first_event_id: str | None = None
+
+
+ # How long a queued runtime-indicator move waits before it runs, so a burst of
+ # messages to the same agent costs one move rather than one per message. Short
+ # enough that the indicator still reads as following the conversation.
+ _INDICATOR_MOVE_DELAY_SECONDS = 1.0
+
_LOBBY_DEPRECATION_NOTICE = (
"👋 This isn't where you talk to agents — direct messages to the Switch "
"app aren't routed to anyone. Head to a channel and @-mention an agent "
@@@ -432,14 -472,12 +484,19 @@@ class BridgeCore
msgtype=msgtype,
caption=caption if index == 0 else None,
thread_root_id=thread_root_id,
+ group=(
+ {"id": group_id, "index": index, "total": total}
+ if group_id is not None
+ else None
+ ),
)
+ if event_id is None:
+ logger.error(
+ "[BRIDGE-IN] failed to relay attachment %s from %s into room %s",
+ attachment.filename,
+ msg.sender_name,
+ matrix_room_id,
+ )
if index == 0:
first_event_id = event_id