Skip to content

Commit bff60e1

Browse files
Clarify reconnect lifecycle behavior in transport docs
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent bc1a10c commit bff60e1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

docs/tasks/streams.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,9 @@ class MemoryRunStore implements TriggerChatRunStore {
635635
}
636636
```
637637

638+
`reconnectToStream()` only resumes active streams. When a stream completes or errors,
639+
the transport clears stored run state and future reconnect attempts return `null`.
640+
638641
## Complete Example: AI Streaming
639642

640643
### Define the stream

packages/ai/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ class MemoryStore implements TriggerChatRunStore {
119119
`onTriggeredRun` can also be async, which is useful for persisting run IDs before
120120
the chat stream is consumed. Callback failures are ignored so chat streaming can continue.
121121

122+
## Reconnect semantics
123+
124+
- `reconnectToStream({ chatId })` resumes only while a stream is still active.
125+
- Once a stream completes or errors, its run state is cleaned up and reconnect returns `null`.
126+
- Provide a custom `runStore` if you need state shared across processes/instances.
127+
122128
## `ai.tool(...)` example
123129

124130
```ts

0 commit comments

Comments
 (0)