Skip to content

Commit 87f92e7

Browse files
Document reconnect inactive-cleanup error reporting semantics
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 9cf96d9 commit 87f92e7

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

docs/tasks/streams.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@ class MemoryRunStore implements TriggerChatRunStore {
648648

649649
`reconnectToStream()` only resumes active streams. When a stream completes or errors,
650650
the transport clears stored run state and future reconnect attempts return `null`.
651+
If stale inactive reconnect state cannot be cleaned up, reconnect still returns `null` and
652+
the failure is surfaced through `onError` with phase `reconnect`.
651653

652654
For richer TypeScript ergonomics in app code, `@trigger.dev/ai` also exports:
653655

packages/ai/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
- Added normalization of non-Error throw values into Error instances before `onError` reporting.
1818
- Added best-effort run-store cleanup so cleanup failures do not mask root transport errors.
1919
- Improved best-effort run-store cleanup to attempt both inactive-state writes and deletes even if one step fails.
20+
- Added reconnect cleanup error reporting for stale inactive state while still returning `null`.

packages/ai/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ both cleanup steps (`set` inactive state and `delete`) even if one of them fails
148148

149149
- `reconnectToStream({ chatId })` resumes only while a stream is still active.
150150
- Once a stream completes or errors, its run state is cleaned up and reconnect returns `null`.
151+
- If reconnect finds stale inactive state and run-store cleanup fails, `onError` receives a
152+
`"reconnect"` phase event and reconnect still returns `null`.
151153
- Provide a custom `runStore` if you need state shared across processes/instances.
152154

153155
## `ai.tool(...)` example

0 commit comments

Comments
 (0)