feat(sdk): chat sessions accept concurrencyKey and trigger-time named limits - #4906
feat(sdk): chat sessions accept concurrencyKey and trigger-time named limits#4906matt-aitken wants to merge 5 commits into
Conversation
🦋 Changeset detectedLatest commit: f9ea87f The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team 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 |
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
c0175c7 to
18c1fed
Compare
e827c3a to
1dbb27b
Compare
18c1fed to
1499956
Compare
d126a77 to
12e74ba
Compare
1499956 to
103fc85
Compare
12e74ba to
26e870e
Compare
103fc85 to
d940cc4
Compare
26e870e to
eae339e
Compare
d940cc4 to
a8e6748
Compare
eae339e to
1f029e0
Compare
a8e6748 to
8e4d355
Compare
1f029e0 to
723efdb
Compare
8e4d355 to
ad05811
Compare
723efdb to
6fc3aca
Compare
ad05811 to
f780acc
Compare
6fc3aca to
783acbb
Compare
f780acc to
16154ef
Compare
783acbb to
58ec45f
Compare
16154ef to
48f3455
Compare
58ec45f to
3d315ae
Compare
…r-time named limits Chat agents already accept the task-level concurrency option, but the session trigger path had no way to scope runs: SessionTriggerConfig now carries concurrencyKey and up to two named limits, threaded through the session run trigger (initial, continuation, and upgrade re-triggers) and forwarded by all three session starters (createStartSessionAction, the AgentChat client, and handover). Keys are never defaulted from the chat ID; a session without one shares the task's keyless pool. Named limits are validated client-side with the same rules as tasks.trigger.
…e module triggerConcurrencyBody and validateConcurrencyLimitName move to a dependency-free module so the chat-server route-handler entrypoint stays lean instead of pulling the task runtime's import graph into customer bundles.
…rsists The session trigger config's concurrency names now carry the charset rule in the schema itself, so an invalid name fails session creation instead of poisoning a persisted, run-less session that fails every retry. The AgentChat client validates through the same dependency-free helper as the other starters, tests pin per-call concurrency precedence and the empty-array clear, and the chat-server import allowlist names the new module.
…ting Webhook deliveries parse the assembled trigger config before creating the session, failing terminally on a bad routing-target template instead of persisting a session that every continuation re-parse would strand. The trigger and batch bodies share the session config's limit-name rule (1-122 chars, letters/numbers/underscores/hyphens), so a bad name is a uniform up-front 400 on every path rather than a late validation error after earlier batch items already triggered.
…ever resumes Template validation moves inside the create branch: resume deliveries to existing sessions never touch the template, so editing a routing target to an invalid template can't terminally fail events to healthy live sessions. A non-object basePayload is rejected instead of being spread into index-keyed garbage, and unknown template keys persist as before with only the known fields normalized by the parse.
48f3455 to
d3ab45e
Compare
3d315ae to
f9ea87f
Compare
Summary
Stacked on #4853. Chat agents already accept the task-level
concurrencyoption, but the session trigger path had no way to scope runs per chat or tenant. Session trigger config now carriesconcurrencyKeyand up to two trigger-time named limits, so a chat agent declaringconcurrency: { perKey: 1 }can actually get one run per tenant by passing a key when the session starts:Design
The two fields ride the existing session trigger config, so every run the session schedules (initial, continuation, and upgrade re-triggers) carries them through one choke point on the server. All three session starters forward them:
chat.createStartSessionAction, the browserAgentChatclient, and handover. Named limits are validated client-side with the same rules and error messages astasks.trigger.The key is never defaulted from the chat ID: a session without an explicit
concurrencyKeyshares the task's keyless pool, so existing chat agents keep their current concurrency accounting.