feat(sdk): ttl for session-triggered runs; expire undequeued dashboard-agent turns - #4799
feat(sdk): ttl for session-triggered runs; expire undequeued dashboard-agent turns#4799kathiekiwi wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 5787013 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 |
WalkthroughSession trigger configurations now support optional TTL values as duration strings or non-negative integer seconds. Chat session helpers forward TTL values from per-call or action-level configuration. The dashboard agent uses a two-minute TTL, and the realtime session manager passes it to task trigger options. Tests verify forwarding and omission behavior. A changeset declares patch releases for the core and SDK packages. Merge Risk: 🔵 Low · up to The PR adds optional expiration for session-triggered runs, including a two-minute dashboard-agent timeout. Invalid TTL strings could be accepted and produce incorrect expiration behavior, so the change is mergeable with explicit owner follow-up to validate duration inputs. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 8 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/trigger-sdk/src/v3/ai.ts (1)
10451-10474: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd crumb markers to the new TypeScript blocks before merge.
The changed TypeScript blocks do not include a
//@Crumbsmarker or a `// `#region` `@crumbswrapper. Add a marker around each new block, then runagentcrumbs stripbefore merge.
packages/trigger-sdk/src/v3/ai.ts#L10451-L10474: mark the TTL resolution and forwarding block.packages/trigger-sdk/src/v3/createStartSessionAction.test.ts#L118-L143: mark the added TTL test cases.apps/webapp/app/services/dashboardAgent.server.ts#L89-L100: mark the dashboard-agent TTL configuration block.apps/webapp/app/services/realtime/sessionRunManager.server.ts#L313-L313: mark the TTL forwarding line.As per coding guidelines, “
**/*: Add crumbs as you write code — not just when debugging. Mark lines with//@Crumbsor wrap blocks in `// `#region` `@crumbs.”Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f93118ab-ce0c-4db7-9840-0c4a9cfc155c
📒 Files selected for processing (9)
.changeset/chat-session-run-ttl.mdapps/webapp/app/services/dashboardAgent.server.tsapps/webapp/app/services/realtime/sessionRunManager.server.tsapps/webapp/test/realtimeServices.replicaLag.test.tspackages/core/src/v3/schemas/api.tspackages/trigger-sdk/src/v3/ai.tspackages/trigger-sdk/src/v3/chat-server.test.tspackages/trigger-sdk/src/v3/chat-server.tspackages/trigger-sdk/src/v3/createStartSessionAction.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📜 Review details
⏰ Context from checks skipped due to timeout. (46)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (23, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (11, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (21, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (18, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (19, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 24)
- GitHub Check: sdk-compat / Node.js 26.4 (warp-ubuntu-latest-x64-4x)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (24, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (17, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (13, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (20, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (15, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (16, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (12, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (22, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 24)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (14, 24)
- GitHub Check: sdk-compat / Node.js 20.20 (warp-ubuntu-latest-x64-4x)
- GitHub Check: e2e / 🧪 CLI v3 tests (warp-windows-latest-x64-8x - pnpm)
- GitHub Check: sdk-compat / Node.js 24.18 (warp-ubuntu-latest-x64-4x)
- GitHub Check: e2e / 🧪 CLI v3 tests (warp-ubuntu-latest-x64-4x - npm)
- GitHub Check: e2e / 🧪 CLI v3 tests (warp-ubuntu-latest-x64-4x - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (warp-windows-latest-x64-8x - npm)
- GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp (1, 2)
- GitHub Check: internal / 🧪 Unit Tests: Internal
- GitHub Check: sdk-compat / Deno Runtime
- GitHub Check: fk-cascade-guard / fk-cascade-guard
- GitHub Check: sdk-compat / Bun Runtime
- GitHub Check: packages / 🧪 Unit Tests: Packages (3, 3)
- GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp (2, 2)
- GitHub Check: sdk-compat / Cloudflare Workers
- GitHub Check: packages / 🧪 Unit Tests: Packages (2, 3)
- GitHub Check: typecheck / typecheck
- GitHub Check: packages / 🧪 Unit Tests: Packages (1, 3)
- GitHub Check: runops-guard / runops-guard
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: code-quality / code-quality
- GitHub Check: Build and publish previews
🧰 Additional context used
📓 Path-based instructions (18)
Always import from `@trigger.dev/sdk`. Never use `@trigger.dev/sdk/v3` or deprecated `client.defineJob`.
📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/trigger-sdk/src/v3/createStartSessionAction.test.tspackages/trigger-sdk/src/v3/chat-server.tspackages/trigger-sdk/src/v3/chat-server.test.tspackages/trigger-sdk/src/v3/ai.ts
Never use `request.signal` to detect client disconnects. Use `getRequestAbortSignal()` from `app/services/httpAsyncStorage.server.ts`, which is wired to Express response close events.
📄 CodeRabbit inference engine (apps/webapp/CLAUDE.md)
Files:
apps/webapp/app/services/realtime/sessionRunManager.server.tsapps/webapp/app/services/dashboardAgent.server.ts
We use vitest exclusively. **Never mock anything** - use testcontainers instead.
📄 CodeRabbit inference engine (AGENTS.md)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.tspackages/trigger-sdk/src/v3/createStartSessionAction.test.tspackages/trigger-sdk/src/v3/chat-server.test.ts
Test files must not import `app/env.server.ts`; pass configuration as options instead.
📄 CodeRabbit inference engine (apps/webapp/CLAUDE.md)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.ts
For dashboard changes, visually verify the running Remix app with Chrome DevTools MCP, using snapshots, screenshots, interaction, and console-message checks as appropriate.
📄 CodeRabbit inference engine (apps/webapp/CLAUDE.md)
Files:
apps/webapp/app/services/realtime/sessionRunManager.server.tsapps/webapp/app/services/dashboardAgent.server.ts
**Import subpaths only** (never root).
📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/core/src/v3/schemas/api.ts
**Prefer static imports over dynamic imports.** Only use dynamic `import()` when:
📄 CodeRabbit inference engine (AGENTS.md)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.tspackages/trigger-sdk/src/v3/createStartSessionAction.test.tspackages/trigger-sdk/src/v3/chat-server.tspackages/trigger-sdk/src/v3/chat-server.test.tsapps/webapp/app/services/realtime/sessionRunManager.server.tsapps/webapp/app/services/dashboardAgent.server.tspackages/core/src/v3/schemas/api.tspackages/trigger-sdk/src/v3/ai.ts
Add crumbs as you write code — not just when debugging. Mark lines with
📄 CodeRabbit inference engine (AGENTS.md)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.tspackages/trigger-sdk/src/v3/createStartSessionAction.test.tspackages/trigger-sdk/src/v3/chat-server.tspackages/trigger-sdk/src/v3/chat-server.test.tsapps/webapp/app/services/realtime/sessionRunManager.server.tsapps/webapp/app/services/dashboardAgent.server.tspackages/core/src/v3/schemas/api.tspackages/trigger-sdk/src/v3/ai.ts
Always import from `@trigger.dev/sdk`. Never use `@trigger.dev/sdk/v3` (deprecated path alias)
📄 CodeRabbit inference engine (packages/trigger-sdk/CLAUDE.md)
Files:
packages/trigger-sdk/src/v3/createStartSessionAction.test.tspackages/trigger-sdk/src/v3/chat-server.tspackages/trigger-sdk/src/v3/chat-server.test.tspackages/trigger-sdk/src/v3/ai.ts
Use zod for validation in packages/core and apps/webapp
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.tsapps/webapp/app/services/realtime/sessionRunManager.server.tsapps/webapp/app/services/dashboardAgent.server.tspackages/core/src/v3/schemas/api.ts
In the Trigger.dev SDK (packages/trigger-sdk), prefer isomorphic code like fetch and ReadableStream instead of Node.js-specific code
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
packages/trigger-sdk/src/v3/createStartSessionAction.test.tspackages/trigger-sdk/src/v3/chat-server.tspackages/trigger-sdk/src/v3/chat-server.test.tspackages/trigger-sdk/src/v3/ai.ts
Never import the root package (`@trigger.dev/core`). Always use subpath imports such as `@trigger.dev/core/v3`, `@trigger.dev/core/v3/utils`, `@trigger.dev/core/logger`, or `@trigger.dev/core/schemas`
📄 CodeRabbit inference engine (packages/core/CLAUDE.md)
Files:
packages/core/src/v3/schemas/api.ts
Do not import `env.server.ts` directly or indirectly into test files; instead pass environment-dependent values through options/parameters to make code testable
📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.ts
Access environment variables through the `env` export of `env.server.ts` instead of directly accessing `process.env`
📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.tsapps/webapp/app/services/realtime/sessionRunManager.server.tsapps/webapp/app/services/dashboardAgent.server.ts
Use vitest for all tests in the Trigger.dev repository
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.tspackages/trigger-sdk/src/v3/createStartSessionAction.test.tspackages/trigger-sdk/src/v3/chat-server.test.ts
Use function declarations instead of default exports
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.tspackages/trigger-sdk/src/v3/createStartSessionAction.test.tspackages/trigger-sdk/src/v3/chat-server.tspackages/trigger-sdk/src/v3/chat-server.test.tsapps/webapp/app/services/realtime/sessionRunManager.server.tsapps/webapp/app/services/dashboardAgent.server.tspackages/core/src/v3/schemas/api.tspackages/trigger-sdk/src/v3/ai.ts
Use types over interfaces for TypeScript
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.tspackages/trigger-sdk/src/v3/createStartSessionAction.test.tspackages/trigger-sdk/src/v3/chat-server.tspackages/trigger-sdk/src/v3/chat-server.test.tsapps/webapp/app/services/realtime/sessionRunManager.server.tsapps/webapp/app/services/dashboardAgent.server.tspackages/core/src/v3/schemas/api.tspackages/trigger-sdk/src/v3/ai.ts
When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs
📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)
Files:
apps/webapp/test/realtimeServices.replicaLag.test.tspackages/trigger-sdk/src/v3/createStartSessionAction.test.tspackages/trigger-sdk/src/v3/chat-server.tspackages/trigger-sdk/src/v3/chat-server.test.tsapps/webapp/app/services/realtime/sessionRunManager.server.tsapps/webapp/app/services/dashboardAgent.server.tspackages/core/src/v3/schemas/api.tspackages/trigger-sdk/src/v3/ai.ts
🔇 Additional comments (4)
packages/trigger-sdk/src/v3/chat-server.ts (1)
553-553: LGTM!packages/trigger-sdk/src/v3/chat-server.test.ts (1)
219-219: LGTM!Also applies to: 251-251, 280-280
apps/webapp/test/realtimeServices.replicaLag.test.ts (1)
398-398: LGTM!Also applies to: 432-433
.changeset/chat-session-run-ttl.md (1)
1-6: LGTM!
| * How long a run may sit undequeued before it expires (duration string | ||
| * like `"2m"`, or seconds). Forwarded to `TaskRunOptions.ttl`. | ||
| */ | ||
| ttl: z.string().or(z.number().nonnegative().int()).optional(), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
rg -n -C 8 '\bTaskRunOptions\b|\bttl\b' \
packages/core/src \
packages/trigger-sdk/src \
apps/webapp/app/services \
--glob '*.ts' \
--glob '*.tsx'Repository: triggerdotdev/trigger.dev
Length of output: 50383
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- TaskRunOptions and duration-related definitions ---'
rg -n -C 12 '\bTaskRunOptions\b|parseDuration|duration.*string|ttl.*duration|ttl.*seconds' \
packages/core packages/trigger-sdk apps \
--glob '*.ts' --glob '*.tsx' \
| head -n 500
printf '%s\n' '--- Relevant repository conventions and learnings ---'
find /tmp/coderabbit-repo-knowledge/triggerdotdev-trigger-dev-0bdd0019 \
-type f -name '*.md' -print \
| sort \
| while read -r f; do
case "$f" in
*/learnings/*|*/**/*) ;;
esac
if grep -qE 'packages/core|schemas|api.ts' "$f"; then
printf '\n### %s\n' "$f"
cat "$f"
fi
doneRepository: triggerdotdev/trigger.dev
Length of output: 43183
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- TaskRunOptions declarations and references ---'
rg -n -C 15 \
'(^|[[:space:]])(export[[:space:]]+)?(type|interface)[[:space:]]+TaskRunOptions\b|\bTaskRunOptions\s*=' \
. --glob '*.ts' --glob '*.tsx' --glob '*.js' --glob '*.jsx' \
| head -n 300
printf '%s\n' '--- TTL consumers ---'
rg -n -C 12 \
'parseNaturalLanguageDurationInMs|parseNaturalLanguageDuration\(|safeParseNaturalLanguageDuration|ttl\s*[/?:=]|\.ttl\b' \
packages apps --glob '*.ts' --glob '*.tsx' \
| head -n 700Repository: triggerdotdev/trigger.dev
Length of output: 214
🏁 Script executed:
#!/usr/bin/env bash
set -u
printf '%s\n' '--- TaskRunOptions exact matches ---'
rg -n -C 10 'TaskRunOptions' . --glob '*.ts' --glob '*.tsx' --glob '*.js' --glob '*.jsx' || true
printf '%s\n' '--- TTL parser and consumer matches ---'
rg -n -C 10 \
'parseNaturalLanguageDurationInMs|parseNaturalLanguageDuration\(|safeParseNaturalLanguageDuration|ttl\s*[/?:=]|\.ttl\b' \
packages apps --glob '*.ts' --glob '*.tsx' \
| head -n 700 || trueRepository: triggerdotdev/trigger.dev
Length of output: 50383
🏁 Script executed:
#!/usr/bin/env bash
set -u
printf '%s\n' '--- SessionTriggerConfig consumers ---'
rg -n -C 14 'SessionTriggerConfig|triggerConfig\.ttl|ttl:.*triggerConfig|triggerConfig.*ttl' \
. --glob '*.ts' --glob '*.tsx' \
| head -n 500 || true
printf '%s\n' '--- TTL handling outside the core schemas ---'
rg -n -C 12 \
'parseNaturalLanguageDurationInMs|parseNaturalLanguageDurationAgo|parseNaturalLanguageDuration|ttlSeconds|ttlInSeconds|ttl.*run|run.*ttl' \
packages apps --glob '*.ts' --glob '*.tsx' \
| grep -vE '(^|/)(.*test|.*spec)\.' \
| head -n 700 || trueRepository: triggerdotdev/trigger.dev
Length of output: 50383
🏁 Script executed:
#!/usr/bin/env bash
set -u
printf '%s\n' '--- Session-related source files ---'
git ls-files \
| grep -Ei '(^|/)(session|sessions)([^/]*)(/|\.|$)|session' \
| head -n 250 || true
printf '%s\n' '--- Exact request-schema usage ---'
rg -n -C 12 'CreateSessionRequestBody|SessionTriggerConfig' \
apps packages --glob '*.ts' --glob '*.tsx' \
| grep -v 'packages/core/src/v3/schemas/api.ts' \
| head -n 500 || trueRepository: triggerdotdev/trigger.dev
Length of output: 48007
🏁 Script executed:
#!/usr/bin/env bash
set -u
printf '%s\n' '--- Session create route ---'
sed -n '1,260p' 'apps/webapp/app/routes/api.v1.sessions.ts' 2>/dev/null || true
printf '%s\n' '--- TTL references in the session and run-trigger path ---'
rg -n -C 10 '\bttl\b|CreateSessionRequestBody|TaskOptions|TaskRunOptions' \
'apps/webapp/app/routes/api.v1.sessions.ts' \
'apps/webapp/app/services' \
'internal-packages/run-store' \
'packages/core/src/v3/runEngineWorker' \
'packages/trigger-sdk/src/v3/sessions.ts' \
| head -n 700 || true
printf '%s\n' '--- Change description for session run TTL ---'
cat .changeset/chat-session-run-ttl.md 2>/dev/null || trueRepository: triggerdotdev/trigger.dev
Length of output: 50381
🏁 Script executed:
#!/usr/bin/env bash
set -u
printf '%s\n' '--- Session service outlines ---'
ast-grep outline apps/webapp/app/services/realtime/sessionRunManager.server.ts 2>/dev/null || true
ast-grep outline apps/webapp/app/services/realtime/sessions.server.ts 2>/dev/null || true
printf '%s\n' '--- Session persistence and run-trigger implementations ---'
rg -n -C 18 \
'export async function findOrCreateSession|function findOrCreateSession|export async function ensureRunForSession|function ensureRunForSession|triggerConfig|ttl' \
apps/webapp/app/services/realtime/sessionRunManager.server.ts \
apps/webapp/app/services/realtime/sessions.server.ts \
| head -n 900 || trueRepository: triggerdotdev/trigger.dev
Length of output: 46993
🏁 Script executed:
#!/usr/bin/env bash
set -u
printf '%s\n' '--- TriggerTaskService contract and option handling ---'
rg -n -C 20 \
'class TriggerTaskService|export class TriggerTaskService|async call\(|options\.ttl|ttl:|TaskOptions|TaskRunOptions' \
apps/webapp/app/v3/services/triggerTask.server.ts \
apps/webapp/app/v3/services \
apps/webapp/app --glob '*.ts' --glob '*.tsx' \
| head -n 900 || trueRepository: triggerdotdev/trigger.dev
Length of output: 50381
🏁 Script executed:
#!/usr/bin/env bash
set -u
printf '%s\n' '--- TriggerTaskService TTL flow ---'
rg -n -C 25 '\bttl\b|TriggerTaskRequestBody|createRun|createTaskRun|triggerRun' \
apps/webapp/app/v3/services/triggerTask.server.ts \
| head -n 500 || true
printf '%s\n' '--- TriggerTaskRequestBody definition ---'
rg -n -C 20 'TriggerTaskRequestBody' packages/core/src/v3/schemas/api.ts packages/core/src/v3 \
| head -n 350 || trueRepository: triggerdotdev/trigger.dev
Length of output: 34835
🌐 Web query:
Trigger.dev TaskRunOptions ttl duration string implementation
💡 Result:
In Trigger.dev, the ttl (Time-to-Live) option for task runs accepts either a duration string or a number of seconds [1][2][3]. Duration String Format The duration string follows a flexible format that combines numbers and units, such as "1h", "30m", "90s", or "1h42m" [2][3]. This string represents the maximum time a run is allowed to remain in a queued state before it is automatically marked as "Expired" and prevented from executing [1][4][5]. Numeric Format Alternatively, you can provide a number, which is interpreted as the duration in seconds (with a minimum of 1 second) [1][2][5]. Usage and Precedence You can configure the TTL at three distinct levels, with the following order of precedence (from highest to lowest) [4]: 1. Per-trigger: Passed within the options object when triggering a task [1][4][5]. await myTask.trigger({ payload }, { ttl: "1h" }); // Duration string await myTask.trigger({ payload }, { ttl: 3600 }); // Seconds 2. Task-level default: Defined within the task's configuration [4][5]. export const myTask = task({ id: "my-task", ttl: "10m", run: async (payload) => {... }, }); 3. Global config default: Set in your trigger.config.ts file [4]. To opt out of a config-level or task-level TTL for a specific execution, you can set ttl: 0 [4][5]. On Trigger.dev Cloud, all runs are subject to a maximum TTL of 14 days; if you specify a longer TTL, it will be automatically clamped to this limit [1][4][6]. If no TTL is explicitly configured, runs default to this 14-day limit in production environments [1][4][6]. Note that in development, the default TTL is typically 10 minutes unless otherwise configured [1][4].
Citations:
- 1: https://trigger.dev/docs/triggering
- 2: https://trigger.dev/docs/management/tasks/trigger
- 3: https://www.mintlify.com/triggerdotdev/trigger.dev/management/tasks/trigger
- 4: https://trigger.dev/docs/runs
- 5: https://trigger.dev/docs/tasks/overview
- 6: https://trigger.dev/docs/limits
Reject invalid SessionTriggerConfig.ttl values.
z.string() allows "" and "not-a-duration" to pass CreateSessionRequestBody. The session stores these values and forwards them as TriggerTaskService options.ttl. Validate the string branch against the duration grammar while preserving 0 as the disabled-TTL value.
|
Folding this into #4796 — keeping the dashboard-agent work in one PR. |
…d-agent turns (#4800) Supersedes #4799 (closed by mistake). Chat-server sessions can now set a ttl on the runs they trigger, and the dashboard agent uses it: turn runs that no worker dequeues expire after 2 minutes instead of lingering PENDING (where they could later be picked up with an expired user-actor token). - @trigger.dev/core: optional `ttl` on `SessionTriggerConfig` (same typing as task trigger options). - @trigger.dev/sdk: both session trigger-config consumers forward it; absent = unchanged behavior. - webapp: `sessionRunManager` passes it through; only the dashboard-agent path sets it (2m). Expiry is safe for live turns — ttl only affects PENDING, unlocked runs. --------- Co-authored-by: Daniel Sutton <45313566+d-cs@users.noreply.github.com> Co-authored-by: nicktrn <55853254+nicktrn@users.noreply.github.com> Co-authored-by: Yann SEGET <yann.seget@actemium.ch> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Saadi Myftija <saadi@myftija.com> Co-authored-by: Eric Allam <eric@trigger.dev> Co-authored-by: Oskar Otwinowski <oskar.otwinowski@gmail.com> Co-authored-by: DKP <8297864+D-K-P@users.noreply.github.com> Co-authored-by: wei-wei <weiweiwuster714@gmail.com> Co-authored-by: Devin AI <devin-ai-integration[bot]@users.noreply.github.com>
Chat-server sessions can now set a ttl on the runs they trigger, and the dashboard agent uses it: turn runs that no worker dequeues expire after 2 minutes instead of lingering PENDING (where they could later be picked up with an expired user-actor token).
ttlonSessionTriggerConfig(same typing as task trigger options).sessionRunManagerpasses it through; only the dashboard-agent path sets it (2m). Expiry is safe for live turns — ttl only affects PENDING, unlocked runs.🤖 Generated with Claude Code