File tree Expand file tree Collapse file tree
packages/trigger-sdk/src/v3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -577,10 +577,18 @@ export class AgentChat<TAgent = unknown> {
577577 }
578578
579579 /**
580- * Reconnect to the response stream (e.g. after a disconnect). Requests the
581- * caught-up settle probe (`X-Peek-Settled`) so a resumed stream already at a
582- * turn-complete tail closes promptly instead of holding the full SSE window,
583- * mirroring the browser transport's `reconnectToStream`.
580+ * Reconnect to the response stream to resume an already-established session
581+ * after a disconnect. Requests the caught-up settle probe (`X-Peek-Settled`)
582+ * so a resumed stream already at a turn-complete tail closes promptly instead
583+ * of holding the full SSE window, mirroring the browser transport's
584+ * `reconnectToStream`.
585+ *
586+ * Do not call this immediately after `sendMessage()` to read a fresh turn: the
587+ * settle probe can race the newly-triggered turn's first record, see the prior
588+ * turn's `turn-complete` tail, and hand back an empty stream (unlike the
589+ * browser transport, there is no auto-resubscribe). `sendMessage()` already
590+ * returns the turn's stream; use `reconnect()` only to resume an idle or
591+ * mid-turn stream.
584592 */
585593 async reconnect ( abortSignal ?: AbortSignal ) : Promise < ReadableStream < UIMessageChunk > | null > {
586594 if ( ! this . state . started ) return null ;
You can’t perform that action at this time.
0 commit comments