From 87f92e7080b68761f8b7492c965eb0188c792db2 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 15 Feb 2026 02:36:30 +0000 Subject: [PATCH] Document reconnect inactive-cleanup error reporting semantics Co-authored-by: Eric Allam --- docs/tasks/streams.mdx | 2 ++ packages/ai/CHANGELOG.md | 1 + packages/ai/README.md | 2 ++ 3 files changed, 5 insertions(+) diff --git a/docs/tasks/streams.mdx b/docs/tasks/streams.mdx index 41a66d59b..7aec07875 100644 --- a/docs/tasks/streams.mdx +++ b/docs/tasks/streams.mdx @@ -648,6 +648,8 @@ class MemoryRunStore implements TriggerChatRunStore { `reconnectToStream()` only resumes active streams. When a stream completes or errors, the transport clears stored run state and future reconnect attempts return `null`. +If stale inactive reconnect state cannot be cleaned up, reconnect still returns `null` and +the failure is surfaced through `onError` with phase `reconnect`. For richer TypeScript ergonomics in app code, `@trigger.dev/ai` also exports: diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index 4de19ced8..e2f74c42e 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -17,3 +17,4 @@ - Added normalization of non-Error throw values into Error instances before `onError` reporting. - Added best-effort run-store cleanup so cleanup failures do not mask root transport errors. - Improved best-effort run-store cleanup to attempt both inactive-state writes and deletes even if one step fails. +- Added reconnect cleanup error reporting for stale inactive state while still returning `null`. diff --git a/packages/ai/README.md b/packages/ai/README.md index 1a084c0cf..7b3323c40 100644 --- a/packages/ai/README.md +++ b/packages/ai/README.md @@ -148,6 +148,8 @@ both cleanup steps (`set` inactive state and `delete`) even if one of them fails - `reconnectToStream({ chatId })` resumes only while a stream is still active. - Once a stream completes or errors, its run state is cleaned up and reconnect returns `null`. +- If reconnect finds stale inactive state and run-store cleanup fails, `onError` receives a + `"reconnect"` phase event and reconnect still returns `null`. - Provide a custom `runStore` if you need state shared across processes/instances. ## `ai.tool(...)` example