Skip to content

Commit b25e79b

Browse files
committed
fix(sdk): apply AgentChat's maxDuration, region and lockToVersion
`AgentChat.ensureStarted` built its session config field by field and never copied these three across, so anyone who set them on `triggerConfig` got no error and no effect.
1 parent fe5b58e commit b25e79b

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Fixed `AgentChat` silently ignoring `maxDuration`, `region` and `lockToVersion` when they were set on its `triggerConfig`. They are now applied to the session's runs.

packages/trigger-sdk/src/v3/chat-client.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,14 @@ export class AgentChat<TAgent = unknown> {
675675
...(this.triggerConfigDefault?.maxAttempts !== undefined
676676
? { maxAttempts: this.triggerConfigDefault.maxAttempts }
677677
: {}),
678-
// Not truthiness: `null` opts this chat out of pinning and must reach the resolver in
679-
// `sessions.start`, which otherwise discovers an id from the environment.
678+
...(this.triggerConfigDefault?.maxDuration !== undefined
679+
? { maxDuration: this.triggerConfigDefault.maxDuration }
680+
: {}),
681+
...(this.triggerConfigDefault?.region ? { region: this.triggerConfigDefault.region } : {}),
682+
...(this.triggerConfigDefault?.lockToVersion
683+
? { lockToVersion: this.triggerConfigDefault.lockToVersion }
684+
: {}),
685+
// Not truthiness: `null` opts out and must reach the resolver in `sessions.start`.
680686
...(this.triggerConfigDefault?.externalDeploymentId !== undefined
681687
? { externalDeploymentId: this.triggerConfigDefault.externalDeploymentId }
682688
: {}),

0 commit comments

Comments
 (0)