chore: release v4.6.0 - #4883
Conversation
a52b8b8 to
bf66819
Compare
bf66819 to
561a891
Compare
561a891 to
7647e12
Compare
7647e12 to
8908721
Compare
8908721 to
c4a980b
Compare
c4a980b to
f17c6e1
Compare
f17c6e1 to
fdc755a
Compare
fdc755a to
736142b
Compare
736142b to
c386180
Compare
daaac06 to
d8f536f
Compare
d8f536f to
ae52834
Compare
ae52834 to
73d950b
Compare
73d950b to
36c68a0
Compare
36c68a0 to
0956d8d
Compare
0956d8d to
e420dfd
Compare
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
⚠️ 1 issue in files not directly in the diff
⚠️ Standalone agent costs disappear
When an agent span has no priced child, isAgentLevelOperation still suppresses its metrics row. Instrumentation reporting usage only there loses the call and its full cost.
e420dfd to
a2b5d39
Compare
a2b5d39 to
e6736ef
Compare
e6736ef to
8923107
Compare
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
5 new features, 29 improvements, 8 bug fixes.
Highlights
fb25c0149)Improvements
Trigger.dev now uses Zod 4 by default. Projects using Zod 3.25.56 or later 3.x releases remain supported. (#4039)
Zod remains a runtime dependency of packages that execute schemas, so existing and new installations continue to receive it automatically. The matching peer dependency range allows package managers to reuse either a compatible Zod 3 or Zod 4 installation from your project.
The
playwrightbuild extension now works with Playwright 1.58 and later. 1.58 changed theplaywright install --dry-runoutput, which made deploy image builds fail while downloading the browsers. (#4881)Rename the dev error link to "Ask Trigger about this error" (
f999516a0)When the build log stream cannot be opened or disconnects during a build server deploy, the CLI now explains that the deployment itself is unaffected and exits immediately with a non-zero code, since it can no longer confirm the outcome. Previously a disconnect printed the raw stream error and left the process hanging. (#4887)
Build logs no longer include docker's registry login output, most notably the credential-storage warning on failed builds. (#4909)
chat.agentpersists a conversation through aTranscriptStorage: an adapter withloadandsavethat the runtime drives after every turn, failed turn and history-changing action. The platform snapshot stays the default; bring your own to write the conversation to your database as it happens. Each save carries both the changes since the last one (so a row store writes only what changed, and an undo is onetruncateAfter) and the whole transcript as it now stands (so a document store writes it as-is with no state of its own). (#4896)chat.createLoadTranscriptAction(storage)anduseLoadTranscriptread the conversation back the same way for every storage, andrunTranscriptStorageTestsfrom@trigger.dev/sdk/ai/testchecks an implementation against the contract.Compaction summaries and
chat.injectcontext now survive a continuation run, and crash recovery runs for every agent, including one that owns its own context.hydrateMessagesis deprecated in favour ofloadContexton a storage. The snapshot format is now version 2, which older SDK versions cannot read.chat.agent: a run that recovers a session with more than one in-flight user message no longer drops the unanswered ones if it restarts mid-recovery. Recovered messages now hold the resume cursor until each has been answered, so a restart re-answers the rest instead of resuming past them. Previously the cursor could advance past messages that were only held in memory, so a crash before they were dispatched lost them. (#4907)End a chat conversation from inside the agent with
chat.close({ reason }). The session row is closed, further sends are refused with HTTP 409, and the run exits without scheduling a continuation, so a budget cap, a completed goal, or a signed-out user can stop the conversation rather than only the current run. (0a23814a0)The current turn still streams in full. Decide the close before the turn ends (
run(),prepareStep,onBeforeTurnComplete) so the closed state rides out on that turn's final record and the user sees it as soon as the answer finishes.TriggerChatTransportpicks the close up from the response stream or from a refused send, exposes it astransport.sessionStatus(chatId)plustransport.sessionClosedReason(chatId), and stops sending and reconnecting. Closing a session from outside withsessions.close()now also reaches a live run, so an idle or suspended agent exits on its next wake instead of waiting out its idle timeout. Writes to a closed session's named side channels are refused with the same 409.Adds the
GetDeploymentArtifactUrlResponseBodyschema for the deployment artifact download URL endpoint. (1a5ad1e5f)Deployments now return the
--external-idthey were deployed under asexternalId, and a run can read its own fromctx.deployment.externalId. Also fixes the deployments list failing when one deployment had no git metadata. (879e8975b)Add an optional
appliedSchedulePolicyfield to the schedule API response. It is present only when a non-overridable plan policy applies a minimum window to a schedule (e.g. a free-plan schedule's minimum run interval); the configuredwindowcontinues to be returned separately and unchanged. (2991bb48a)Triggering a task whose id cannot be represented in a URL (for example an id containing an unpaired surrogate) now fails with a clear error naming the task id, instead of a cryptic URI error. (
ad821eaea)Actions can now become turns.
onActionedits history withchat.history; to answer after the edit, returnchat.turn()and a turn runs on the edited history with everything a turn has: the agent's system prompt and tools, steering, compaction, injected instructions,onTurnStartandonTurnComplete, and persistence. A regenerate ischat.history.slice(0, -1); return chat.turn();. (#4816)Returning a
StreamTextResult,stringorUIMessagefromonActionis no longer supported and now fails with an error pointing tochat.turn(). A response produced that way skipped every turn guarantee, and its delivery to the browser was unreliable: the frontend never read the streamtransport.sendActionreturned, so a regenerate that appeared to work on the server did not render.History edits made by an action are still persisted as before: platform-managed snapshots are written after the edit, and apps with their own store mirror the edit themselves.
run()now receives astreamTextwith your agent's managed options already applied, so they cannot be lost by leaving out the spread: (#4884)Spreading
chat.toStreamTextOptions()still works and is equivalent. The difference is what happens when your options collide with the managed ones. Passingtoolsafter the spread replaces the skill tools, and passing your ownprepareStepreplaces the managed one, which silently switches off steering, compaction and injected context. The managedstreamTextmerges tools and composesprepareStepinstead, so neither can be turned off by accident.systemcan be set at the call site, onchat.agent({ system }), or throughchat.prompt.set(), but only in one of them: setting it in two places throws, because no single shape merges two system values across every supported AI SDK version, and dropping one silently is the failure this seam exists to prevent. Injected instructions append to whichever one is in play.chat.agent()also takesregistry,cacheControlandsystemProviderOptionsnow, so a managed prompt's model and its cache breakpoint no longer have to be passed at the call site.chat.toStreamTextOptions()applies them as well, so spreading it into thestreamTextimported fromaistays equivalent to the onerun()receives.chat.headStartandchat.startHeadStarthand theirrunthe same thing, carrying the options the handover protocol depends on. There it matters more: re-settingmessages,prompt,stopWhenorabortSignalafter a spread breaks the handover rather than degrading a feature, and nothing caught it. On the managed one those four keys are a type error;toolsis yours to pass.Actions are sent through
useChatso a turn that follows one renders like any turn.TriggerChatTransportrecognisesbody.actionon auseChatrequest and sends it as an action, sosendMessage(undefined, { body: { action } })orregenerate({ body: { action } })sends the action anduseChatowns the response: it streams into the message list,statusanderrorbehave as for a message, andstopworks.useChatActions({ sendMessage })in@trigger.dev/sdk/chat/reactis a two-line convenience over that. (#4816)Previously the frontend docs said
useChatconsumed the streamtransport.sendActionreturns; it never did, so an action's answer was never rendered by an app following them.transport.sendActionstill returns a stream that callers outsideuseChatmust read, and now accepts{ abortSignal, metadata }, with per-action metadata merged over the transport'sclientData.Chat sessions can now be pinned to a deployment, so a conversation keeps talking to the agent version its release shipped with, and follows the pin on its own when your app redeploys. Opt out with
triggerConfig: { externalDeploymentId: null }orversionSkew: "hold". Also fixesAgentChatignoringmaxDuration,regionandlockToVersion, and a restoredAgentChatsession never picking up a new deployment id. (1133ad45e)chat.agent: a continuation boot no longer re-dispatches the message that resumed it, and a turn with no new user message no longer calls the model. Previously a resumed run could answer the same message twice, and the second attempt failed against providers that reject a trailing assistant message, overwriting an answer that had already completed. (35e57e785)useTriggerChatTransportnow picks up changes toaccessToken,startSessionandfetchon re-render, so a chat that stays mounted while the surrounding page changes no longer keeps sending to the endpoint captured on first render. (9ae9c1ae4)Steering messages are now kept in the conversation when you drive turns yourself with
chat.createSession()orchat.MessageAccumulator. Previously a message that arrived mid-answer shaped that answer and then existed nowhere: it was missing fromturn.uiMessages, so an app persisting from there never stored it, missing fromturn.messages, so every later turn answered as though it had never been sent, and it was not queued as its own turn either. It now lands in both, the same way it does onchat.agent. (#4816)Injected system context is merged into a single instruction block, so it works on every supported AI SDK version. Note that a cached system prompt gives up its cache entry for as long as an injection is live, since the cached prefix has changed. (#4816)
chat.inject()withrole: "system"now works. It previously put the system message into the conversation, which AI SDK 7 rejects for every provider: the next turn died with a generic "An error occurred." and persisted an empty assistant message, so the agent looked like it had stopped answering. System-role context is now appended to the model's instructions, which is also the only way to inject context the agent treats as trusted. (#4816)Two things to know. Instructions are delivered by
chat.toStreamTextOptions(), so arun()that callsstreamTextwithout spreading it does not receive a system-role injection. The conversational lane has no such requirement. And an injection applies to the next turn only, rather than repeating on every turn that follows it. Every inference call in that turn sees it, so arun()that builds options more than once gets the same instructions each time. An instruction injected after an action has run, and before the next message, reaches that next turn rather than the one after it.Undo, edit and regenerate now survive a run ending. History rolled back from
onActionwas only kept in the running worker's memory, so the rollback held while that worker stayed warm and then reverted on the next continuation. The undone messages came back, minutes later, with no error. This also holds when the turn before the action failed: the rollback used to be written against the cursor from before that turn, so a continuation could replay output the failed turn had already superseded. (#4816)Server-side
AgentChatstreams now reconnect when the connection drops mid-turn instead of ending with a truncated reply, and a turn that still cannot be resumed ends with an error rather than a silent truncation. (8bf27a629)Steering messages injected mid-answer are now part of the conversation, both for your hooks and for the model on later turns. Previously they reached the model for the answer they steered and reached the browser, but nothing else:
onTurnCompletenever saw them, so an app storing its own transcript lost the instruction the answer was shaped by, and it vanished from the conversation on reload. The model also forgot the instruction from the next turn onwards, answering as though the message had never been sent, while the chat UI still showed it. This holds when the steered turn fails part-way, and whenpendingMessages.preparereshapes the message: later turns now see the same form the steered turn did, not the original message. (#4816)Approving a tool call no longer undoes compaction. A tool-approval continuation used to rebuild the model's context from the full conversation, so a chat that had been summarised to fit the context window was sent the whole transcript again on the next call, and could go over the limit it had just been compacted to avoid.
If you worked around this by saving steering messages as they arrive, in
pendingMessages.onReceivedfor example, that write now duplicates the one you get fromnewUIMessages. Drop it, or skip messages you have already stored.chat.agent transcript fixes: a turn that errors before the model produces any content no longer stores an empty assistant message, an error thrown without a message now shows a generic error instead of a blank one, and a custom transcript storage no longer needs to preserve exact message JSON for a compaction to survive a continuation. (#4910)
Bug fixes
.or..path component. The storage path is now built from a generated id rather than from the task id, so no task id can produce an unusable one, and payloads that are already stored are still read from where they were written. (ed37e19c9)Server changes
These changes affect the self-hosted Docker image and Trigger.dev Cloud:
Projects that need a Node.js runtime update can now be handed to a coding agent: the organization Projects settings page has a button that copies a ready-to-paste prompt listing every project to update.
Additional API keys are now enabled by default. New environments no longer display root API keys, and existing environments can permanently disable their visibility
New schedules use a default CRON spread window when none is set, distributing runs after their scheduled time instead of starting them all at once. Set an explicit window to override the default.
Schedules now support a configurable minimum spread window that applies even when a smaller window is requested.
The "Cancel in-progress runs when this limit is reached" option on the billing limit form is now enabled by default when you first configure a limit, so already-executing runs stop instead of continuing past the limit. Organizations that have already saved a billing limit keep their existing choice.
The assistant in the dashboard no longer has a monthly message limit, so you can chat with it as much as you like.
Asking it to keep an eye on something and tell you when it happens is rolling out gradually, so it isn't offered in every organization yet.
Ask Trigger now opens as a floating window you can drag anywhere and resize, and the chat header lets you switch it to a right-side panel or fullscreen. Choose the position it opens in from your account settings.
The Queues page Allocated tile now explains that it is the sum of your queue concurrency limits, and no longer shows a warning color when those add up to more than the environment limit, which is expected.
Deleting a project now stops its pending runs. Runs that were waiting on a
delayor sitting in the queue are cancelled instead of executing later, and a deleted project no longer sends task failure alerts.Fixes an intermittent "Invalid access token" failure caused by the deployment log stream token expiring while a deploy was still in flight.
Dashboard pages no longer keep polling for updates while their browser tab is hidden, which could leave a tab you came back to showing a connection error instead of your data. Pages refresh when you return to the tab.
Stop counting agent LLM calls twice. An agent framework emits a wrapper span around the inference span that did the work, and both were priced, so LLM cost aggregates and the AI metrics page reported roughly double for agent workloads. Per-call figures in the run view were always correct and are unchanged.
Fix the Queues page showing "No activity" on the queue-metrics charts for some organizations even though their metrics were being collected. Those charts now display the collected data.
The queue page's "Oldest wait" card now shows a single clear number (how long the oldest waiting run has been waiting) with an explanatory tooltip, and no longer shows a second "worst" figure that could confusingly read lower than the headline.
Switching environments now keeps you on the current page when a task's id contains a slash, instead of dropping you back to the list. The test page for a webhook task whose id contains a slash also opens correctly now.
Raw changeset output
Releases
@trigger.dev/build@4.6.0
Minor Changes
Trigger.dev now uses Zod 4 by default. Projects using Zod 3.25.56 or later 3.x releases remain supported. (#4039)
Zod remains a runtime dependency of packages that execute schemas, so existing and new installations continue to receive it automatically. The matching peer dependency range allows package managers to reuse either a compatible Zod 3 or Zod 4 installation from your project.
Patch Changes
playwrightbuild extension now works with Playwright 1.58 and later. 1.58 changed theplaywright install --dry-runoutput, which made deploy image builds fail while downloading the browsers. (#4881)@trigger.dev/core@4.6.0trigger.dev@4.6.0
Minor Changes
Trigger.dev now uses Zod 4 by default. Projects using Zod 3.25.56 or later 3.x releases remain supported. (#4039)
Zod remains a runtime dependency of packages that execute schemas, so existing and new installations continue to receive it automatically. The matching peer dependency range allows package managers to reuse either a compatible Zod 3 or Zod 4 installation from your project.
Patch Changes
f999516a0)@trigger.dev/core@4.6.0@trigger.dev/build@4.6.0@trigger.dev/schema-to-json@4.6.0@trigger.dev/core@4.6.0
Minor Changes
chat.agentpersists a conversation through aTranscriptStorage: an adapter withloadandsavethat the runtime drives after every turn, failed turn and history-changing action. The platform snapshot stays the default; bring your own to write the conversation to your database as it happens. Each save carries both the changes since the last one (so a row store writes only what changed, and an undo is onetruncateAfter) and the whole transcript as it now stands (so a document store writes it as-is with no state of its own). (#4896)chat.createLoadTranscriptAction(storage)anduseLoadTranscriptread the conversation back the same way for every storage, andrunTranscriptStorageTestsfrom@trigger.dev/sdk/ai/testchecks an implementation against the contract.Compaction summaries and
chat.injectcontext now survive a continuation run, and crash recovery runs for every agent, including one that owns its own context.hydrateMessagesis deprecated in favour ofloadContexton a storage. The snapshot format is now version 2, which older SDK versions cannot read.Trigger.dev now uses Zod 4 by default. Projects using Zod 3.25.56 or later 3.x releases remain supported. (#4039)
Zod remains a runtime dependency of packages that execute schemas, so existing and new installations continue to receive it automatically. The matching peer dependency range allows package managers to reuse either a compatible Zod 3 or Zod 4 installation from your project.
Patch Changes
chat.agent: a run that recovers a session with more than one in-flight user message no longer drops the unanswered ones if it restarts mid-recovery. Recovered messages now hold the resume cursor until each has been answered, so a restart re-answers the rest instead of resuming past them. Previously the cursor could advance past messages that were only held in memory, so a crash before they were dispatched lost them. (#4907)End a chat conversation from inside the agent with
chat.close({ reason }). The session row is closed, further sends are refused with HTTP 409, and the run exits without scheduling a continuation, so a budget cap, a completed goal, or a signed-out user can stop the conversation rather than only the current run. (0a23814a0)The current turn still streams in full. Decide the close before the turn ends (
run(),prepareStep,onBeforeTurnComplete) so the closed state rides out on that turn's final record and the user sees it as soon as the answer finishes.TriggerChatTransportpicks the close up from the response stream or from a refused send, exposes it astransport.sessionStatus(chatId)plustransport.sessionClosedReason(chatId), and stops sending and reconnecting. Closing a session from outside withsessions.close()now also reaches a live run, so an idle or suspended agent exits on its next wake instead of waiting out its idle timeout. Writes to a closed session's named side channels are refused with the same 409.Adds the
GetDeploymentArtifactUrlResponseBodyschema for the deployment artifact download URL endpoint. (1a5ad1e5f)Deployments now return the
--external-idthey were deployed under asexternalId, and a run can read its own fromctx.deployment.externalId. Also fixes the deployments list failing when one deployment had no git metadata. (879e8975b)Add an optional
appliedSchedulePolicyfield to the schedule API response. It is present only when a non-overridable plan policy applies a minimum window to a schedule (e.g. a free-plan schedule's minimum run interval); the configuredwindowcontinues to be returned separately and unchanged. (2991bb48a)A failed write to a realtime or chat session stream no longer crashes the process running it, and a dropped chat session output write is now logged instead of swallowed. (
fb25c0149)Triggering a task whose id cannot be represented in a URL (for example an id containing an unpaired surrogate) now fails with a clear error naming the task id, instead of a cryptic URI error. (
ad821eaea)@trigger.dev/react-hooks@4.6.0
Minor Changes
Trigger.dev now uses Zod 4 by default. Projects using Zod 3.25.56 or later 3.x releases remain supported. (#4039)
Zod remains a runtime dependency of packages that execute schemas, so existing and new installations continue to receive it automatically. The matching peer dependency range allows package managers to reuse either a compatible Zod 3 or Zod 4 installation from your project.
Patch Changes
@trigger.dev/core@4.6.0@trigger.dev/redis-worker@4.6.0
Minor Changes
Trigger.dev now uses Zod 4 by default. Projects using Zod 3.25.56 or later 3.x releases remain supported. (#4039)
Zod remains a runtime dependency of packages that execute schemas, so existing and new installations continue to receive it automatically. The matching peer dependency range allows package managers to reuse either a compatible Zod 3 or Zod 4 installation from your project.
Patch Changes
@trigger.dev/core@4.6.0@trigger.dev/rsc@4.6.0
Minor Changes
Trigger.dev now uses Zod 4 by default. Projects using Zod 3.25.56 or later 3.x releases remain supported. (#4039)
Zod remains a runtime dependency of packages that execute schemas, so existing and new installations continue to receive it automatically. The matching peer dependency range allows package managers to reuse either a compatible Zod 3 or Zod 4 installation from your project.
Patch Changes
@trigger.dev/core@4.6.0@trigger.dev/schema-to-json@4.6.0
Minor Changes
Trigger.dev now uses Zod 4 by default. Projects using Zod 3.25.56 or later 3.x releases remain supported. (#4039)
Zod remains a runtime dependency of packages that execute schemas, so existing and new installations continue to receive it automatically. The matching peer dependency range allows package managers to reuse either a compatible Zod 3 or Zod 4 installation from your project.
Patch Changes
@trigger.dev/core@4.6.0@trigger.dev/sdk@4.6.0
Minor Changes
Actions can now become turns.
onActionedits history withchat.history; to answer after the edit, returnchat.turn()and a turn runs on the edited history with everything a turn has: the agent's system prompt and tools, steering, compaction, injected instructions,onTurnStartandonTurnComplete, and persistence. A regenerate ischat.history.slice(0, -1); return chat.turn();. (#4816)Returning a
StreamTextResult,stringorUIMessagefromonActionis no longer supported and now fails with an error pointing tochat.turn(). A response produced that way skipped every turn guarantee, and its delivery to the browser was unreliable: the frontend never read the streamtransport.sendActionreturned, so a regenerate that appeared to work on the server did not render.History edits made by an action are still persisted as before: platform-managed snapshots are written after the edit, and apps with their own store mirror the edit themselves.
End a chat conversation from inside the agent with
chat.close({ reason }). The session row is closed, further sends are refused with HTTP 409, and the run exits without scheduling a continuation, so a budget cap, a completed goal, or a signed-out user can stop the conversation rather than only the current run. (0a23814a0)The current turn still streams in full. Decide the close before the turn ends (
run(),prepareStep,onBeforeTurnComplete) so the closed state rides out on that turn's final record and the user sees it as soon as the answer finishes.TriggerChatTransportpicks the close up from the response stream or from a refused send, exposes it astransport.sessionStatus(chatId)plustransport.sessionClosedReason(chatId), and stops sending and reconnecting. Closing a session from outside withsessions.close()now also reaches a live run, so an idle or suspended agent exits on its next wake instead of waiting out its idle timeout. Writes to a closed session's named side channels are refused with the same 409.run()now receives astreamTextwith your agent's managed options already applied, so they cannot be lost by leaving out the spread: (#4884)Spreading
chat.toStreamTextOptions()still works and is equivalent. The difference is what happens when your options collide with the managed ones. Passingtoolsafter the spread replaces the skill tools, and passing your ownprepareStepreplaces the managed one, which silently switches off steering, compaction and injected context. The managedstreamTextmerges tools and composesprepareStepinstead, so neither can be turned off by accident.systemcan be set at the call site, onchat.agent({ system }), or throughchat.prompt.set(), but only in one of them: setting it in two places throws, because no single shape merges two system values across every supported AI SDK version, and dropping one silently is the failure this seam exists to prevent. Injected instructions append to whichever one is in play.chat.agent()also takesregistry,cacheControlandsystemProviderOptionsnow, so a managed prompt's model and its cache breakpoint no longer have to be passed at the call site.chat.toStreamTextOptions()applies them as well, so spreading it into thestreamTextimported fromaistays equivalent to the onerun()receives.chat.headStartandchat.startHeadStarthand theirrunthe same thing, carrying the options the handover protocol depends on. There it matters more: re-settingmessages,prompt,stopWhenorabortSignalafter a spread breaks the handover rather than degrading a feature, and nothing caught it. On the managed one those four keys are a type error;toolsis yours to pass.chat.agentpersists a conversation through aTranscriptStorage: an adapter withloadandsavethat the runtime drives after every turn, failed turn and history-changing action. The platform snapshot stays the default; bring your own to write the conversation to your database as it happens. Each save carries both the changes since the last one (so a row store writes only what changed, and an undo is onetruncateAfter) and the whole transcript as it now stands (so a document store writes it as-is with no state of its own). (#4896)chat.createLoadTranscriptAction(storage)anduseLoadTranscriptread the conversation back the same way for every storage, andrunTranscriptStorageTestsfrom@trigger.dev/sdk/ai/testchecks an implementation against the contract.Compaction summaries and
chat.injectcontext now survive a continuation run, and crash recovery runs for every agent, including one that owns its own context.hydrateMessagesis deprecated in favour ofloadContexton a storage. The snapshot format is now version 2, which older SDK versions cannot read.Actions are sent through
useChatso a turn that follows one renders like any turn.TriggerChatTransportrecognisesbody.actionon auseChatrequest and sends it as an action, sosendMessage(undefined, { body: { action } })orregenerate({ body: { action } })sends the action anduseChatowns the response: it streams into the message list,statusanderrorbehave as for a message, andstopworks.useChatActions({ sendMessage })in@trigger.dev/sdk/chat/reactis a two-line convenience over that. (#4816)Previously the frontend docs said
useChatconsumed the streamtransport.sendActionreturns; it never did, so an action's answer was never rendered by an app following them.transport.sendActionstill returns a stream that callers outsideuseChatmust read, and now accepts{ abortSignal, metadata }, with per-action metadata merged over the transport'sclientData.Trigger.dev now uses Zod 4 by default. Projects using Zod 3.25.56 or later 3.x releases remain supported. (#4039)
Zod remains a runtime dependency of packages that execute schemas, so existing and new installations continue to receive it automatically. The matching peer dependency range allows package managers to reuse either a compatible Zod 3 or Zod 4 installation from your project.
Patch Changes
Chat sessions can now be pinned to a deployment, so a conversation keeps talking to the agent version its release shipped with, and follows the pin on its own when your app redeploys. Opt out with
triggerConfig: { externalDeploymentId: null }orversionSkew: "hold". Also fixesAgentChatignoringmaxDuration,regionandlockToVersion, and a restoredAgentChatsession never picking up a new deployment id. (1133ad45e)chat.agent: a continuation boot no longer re-dispatches the message that resumed it, and a turn with no new user message no longer calls the model. Previously a resumed run could answer the same message twice, and the second attempt failed against providers that reject a trailing assistant message, overwriting an answer that had already completed. (35e57e785)chat.agent: a run that recovers a session with more than one in-flight user message no longer drops the unanswered ones if it restarts mid-recovery. Recovered messages now hold the resume cursor until each has been answered, so a restart re-answers the rest instead of resuming past them. Previously the cursor could advance past messages that were only held in memory, so a crash before they were dispatched lost them. (#4907)useTriggerChatTransportnow picks up changes toaccessToken,startSessionandfetchon re-render, so a chat that stays mounted while the surrounding page changes no longer keeps sending to the endpoint captured on first render. (9ae9c1ae4)Steering messages are now kept in the conversation when you drive turns yourself with
chat.createSession()orchat.MessageAccumulator. Previously a message that arrived mid-answer shaped that answer and then existed nowhere: it was missing fromturn.uiMessages, so an app persisting from there never stored it, missing fromturn.messages, so every later turn answered as though it had never been sent, and it was not queued as its own turn either. It now lands in both, the same way it does onchat.agent. (#4816)Injected system context is merged into a single instruction block, so it works on every supported AI SDK version. Note that a cached system prompt gives up its cache entry for as long as an injection is live, since the cached prefix has changed. (#4816)
chat.inject()withrole: "system"now works. It previously put the system message into the conversation, which AI SDK 7 rejects for every provider: the next turn died with a generic "An error occurred." and persisted an empty assistant message, so the agent looked like it had stopped answering. System-role context is now appended to the model's instructions, which is also the only way to inject context the agent treats as trusted. (#4816)Two things to know. Instructions are delivered by
chat.toStreamTextOptions(), so arun()that callsstreamTextwithout spreading it does not receive a system-role injection. The conversational lane has no such requirement. And an injection applies to the next turn only, rather than repeating on every turn that follows it. Every inference call in that turn sees it, so arun()that builds options more than once gets the same instructions each time. An instruction injected after an action has run, and before the next message, reaches that next turn rather than the one after it.A failed write to a realtime or chat session stream no longer crashes the process running it, and a dropped chat session output write is now logged instead of swallowed. (
fb25c0149)Undo, edit and regenerate now survive a run ending. History rolled back from
onActionwas only kept in the running worker's memory, so the rollback held while that worker stayed warm and then reverted on the next continuation. The undone messages came back, minutes later, with no error. This also holds when the turn before the action failed: the rollback used to be written against the cursor from before that turn, so a continuation could replay output the failed turn had already superseded. (#4816)Server-side
AgentChatstreams now reconnect when the connection drops mid-turn instead of ending with a truncated reply, and a turn that still cannot be resumed ends with an error rather than a silent truncation. (8bf27a629)Fixes storage of large trigger payloads for task ids containing a slash, which could fail the trigger with an "Invalid packet storage path" error. It affected ids that started or ended with a slash, contained two slashes in a row, or contained a
.or..path component. The storage path is now built from a generated id rather than from the task id, so no task id can produce an unusable one, and payloads that are already stored are still read from where they were written. (ed37e19c9)Steering messages injected mid-answer are now part of the conversation, both for your hooks and for the model on later turns. Previously they reached the model for the answer they steered and reached the browser, but nothing else:
onTurnCompletenever saw them, so an app storing its own transcript lost the instruction the answer was shaped by, and it vanished from the conversation on reload. The model also forgot the instruction from the next turn onwards, answering as though the message had never been sent, while the chat UI still showed it. This holds when the steered turn fails part-way, and whenpendingMessages.preparereshapes the message: later turns now see the same form the steered turn did, not the original message. (#4816)Approving a tool call no longer undoes compaction. A tool-approval continuation used to rebuild the model's context from the full conversation, so a chat that had been summarised to fit the context window was sent the whole transcript again on the next call, and could go over the limit it had just been compacted to avoid.
If you worked around this by saving steering messages as they arrive, in
pendingMessages.onReceivedfor example, that write now duplicates the one you get fromnewUIMessages. Drop it, or skip messages you have already stored.chat.agent transcript fixes: a turn that errors before the model produces any content no longer stores an empty assistant message, an error thrown without a message now shows a generic error instead of a blank one, and a custom transcript storage no longer needs to preserve exact message JSON for a compaction to survive a continuation. (#4910)
Updated dependencies:
@trigger.dev/core@4.6.0@trigger.dev/python@4.6.0
Patch Changes
@trigger.dev/sdk@4.6.0@trigger.dev/core@4.6.0@trigger.dev/build@4.6.0