Skip to content

Commit a682af0

Browse files
committed
docs(ai-chat): resilient SSE reconnection
Changelog entry for the next prerelease (version placeholder pending publish) covering the indefinite retry, jittered backoff, force- reconnect on online/visibilitychange/pageshow, fetch timeout, stall detector, and 404/410 short-circuit behavior in the chat transport. Adds a Network resilience subsection in frontend.mdx pointing customers at the changelog for details — TL;DR is they don't need to handle network drops, mobile background-kills, or Safari bfcache restores; the transport recovers automatically. Refs TRI-8903.
1 parent 4cf2616 commit a682af0

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

docs/ai-chat/changelog.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ sidebarTitle: "Changelog"
44
description: "Pre-release updates for AI chat agents."
55
---
66

7+
<Update label="May 1, 2026" description="<NEXT-PRERELEASE>" tags={["SDK"]}>
8+
9+
## Resilient SSE reconnection
10+
11+
The chat transport now retries indefinitely on network drops with bounded exponential backoff (100ms initial, 5s cap, 50% jitter) instead of giving up after 5 attempts. Reconnects are immediate on `online`, on tab refocus after a long background, and on Safari bfcache restore (`pageshow` with `event.persisted`).
12+
13+
A 60s stall detector catches silent-dead-socket cases on mobile where the OS killed the TCP socket without the reader noticing. A 30s per-attempt fetch timeout prevents stuck connections from blocking the retry loop.
14+
15+
Resume continues to use `Last-Event-ID`, so no chunks are lost when the connection comes back. No public API change — these are defaults on `TriggerChatTransport`. Customers who built `hasActiveStream` / `isStreaming` flag tracking on their side can drop it: the transport handles the silent-but-stale case internally now.
16+
17+
`SSEStreamSubscription` (used by `TriggerChatTransport` and `AgentChat`) gained `retryNow()` and `forceReconnect()` for callers writing custom transports, plus options to tune `maxRetries` / `retryDelayMs` / `maxRetryDelayMs` / `retryJitter` / `fetchTimeoutMs` / `stallTimeoutMs` / `nonRetryableStatuses`. `404` and `410` short-circuit retry by default (stream gone / session closed).
18+
19+
</Update>
20+
721
<Update label="April 24, 2026" description="0.0.0-chat-prerelease-20260501122331" tags={["SDK", "Platform"]}>
822

923
## `chat.agent` now runs on Sessions

docs/ai-chat/frontend.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ function ChatClient({ chatId, initialMessages, initialSessions }) {
218218
will not occur in production builds.
219219
</Warning>
220220

221+
### Network resilience
222+
223+
You don't need to handle network drops, mobile background-kills, or Safari bfcache restores. The transport retries indefinitely with bounded backoff, reconnects on `online` / tab refocus / `pageshow` with `event.persisted`, and uses `Last-Event-ID` to resume without dropping chunks. See the [changelog entry](/ai-chat/changelog) for the gory details.
224+
221225
## Client data and metadata
222226

223227
### Transport-level client data

0 commit comments

Comments
 (0)