fix(stream-consumer): preserve thread routing on overflow first-send path

When the first streamed message exceeds the platform length limit and
gets split into chunks, _send_new_chunk was called with self._message_id
(which is None on first send), dropping thread routing entirely.

Fallback to self._initial_reply_to_id so overflow chunks land in the
correct topic/thread.

Also fix a fragile test assertion that could be silently skipped.
This commit is contained in:
黄飞虹 2026-05-09 09:25:46 +08:00 committed by Teknium
parent ff14666cdc
commit e164a9c1ed
2 changed files with 37 additions and 6 deletions

View file

@ -365,7 +365,7 @@ class GatewayStreamConsumer:
self._accumulated, _safe_limit
)
chunks_delivered = False
reply_to = self._message_id
reply_to = self._message_id or self._initial_reply_to_id
for chunk in chunks:
new_id = await self._send_new_chunk(chunk, reply_to)
if new_id is not None and new_id != reply_to: