diff --git a/docs/tasks/streams.mdx b/docs/tasks/streams.mdx index b5babce4e..41a66d59b 100644 --- a/docs/tasks/streams.mdx +++ b/docs/tasks/streams.mdx @@ -623,7 +623,8 @@ optional `runId`, and the underlying `error` (non-Error throws are normalized to instances). Run-store cleanup is handled as best effort, and cleanup failures won't mask the original -transport failure that triggered `onError`. +transport failure that triggered `onError`. Cleanup still attempts both persistence steps +(`set` inactive state and `delete`) even when one step fails. ```ts import type { TriggerChatRunState, TriggerChatRunStore } from "@trigger.dev/ai"; diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index cb2623434..4de19ced8 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -16,3 +16,4 @@ - Added phase-aware `onError` reporting across send, stream-subscribe, reconnect, and stream-consumption paths. - 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. diff --git a/packages/ai/README.md b/packages/ai/README.md index 2b66461ed..1a084c0cf 100644 --- a/packages/ai/README.md +++ b/packages/ai/README.md @@ -141,7 +141,8 @@ The callback receives: - `error` Cleanup operations against custom `runStore` implementations are best-effort. If store cleanup -fails, the original transport error is still preserved and surfaced. +fails, the original transport error is still preserved and surfaced. The transport also attempts +both cleanup steps (`set` inactive state and `delete`) even if one of them fails. ## Reconnect semantics