chore: release v4.6.0 - #4883
Open
github-actions[bot] wants to merge 1 commit into
Open
Conversation
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 4, 2026 09:02
a52b8b8 to
bf66819
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 4, 2026 12:56
bf66819 to
561a891
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 4, 2026 14:07
561a891 to
7647e12
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 5, 2026 13:19
7647e12 to
8908721
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 7, 2026 07:21
8908721 to
c4a980b
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 7, 2026 10:31
c4a980b to
f17c6e1
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 7, 2026 11:16
f17c6e1 to
fdc755a
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 7, 2026 15:15
fdc755a to
736142b
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 7, 2026 16:08
736142b to
c386180
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 8, 2026 08:18
8d51ea7 to
8ffa84a
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 8, 2026 08:50
8ffa84a to
37b6e19
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 8, 2026 09:46
37b6e19 to
daaac06
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 8, 2026 10:24
daaac06 to
d8f536f
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 8, 2026 10:54
d8f536f to
ae52834
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 8, 2026 11:26
ae52834 to
73d950b
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 8, 2026 12:25
73d950b to
36c68a0
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 8, 2026 13:57
36c68a0 to
0956d8d
Compare
github-actions
Bot
force-pushed
the
changeset-release/main
branch
from
September 8, 2026 14:03
0956d8d to
e420dfd
Compare
Contributor
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
5 new features, 21 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)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.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.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 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
@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
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
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.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.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)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.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