docs: add task-level and config-level TTL documentation#3200
docs: add task-level and config-level TTL documentation#3200
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughAdds and expands documentation for a Time-To-Live (TTL) option across multiple docs: project-level default Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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)
docs/tasks/scheduled.mdx (1)
70-80: Mention numeric seconds here too.
packages/core/src/v3/types/tasks.tsexposesttlasstring | number, but this new scheduled-task section only shows the duration-string form. Adding the numeric-seconds form would keep this page aligned with the rest of the TTL docs and avoid makingschedules.task()look more restrictive than it is.✏️ Suggested doc tweak
export const frequentTask = schedules.task({ id: "frequent-task", - ttl: "5m", + ttl: "5m", // Also accepts a number of seconds, e.g. 300 run: async (payload) => { //... }, });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/tasks/scheduled.mdx` around lines 70 - 80, Update the scheduled-task docs to note that ttl accepts either a duration string or a numeric count of seconds (as defined by the ttl type in packages/core/src/v3/types/tasks.ts) and add a short numeric example for schedules.task (e.g., ttl: 300) alongside the existing "5m" example so readers see both supported forms.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/config/config-file.mdx`:
- Around line 353-368: Remove the config-level TTL documentation and the example
that adds ttl to defineConfig in the "TTL" section (the code block showing ttl:
"1h"), because TriggerConfig does not have a ttl property and config-level
defaults are not implemented; instead keep or clarify that TTL can only be set
per-task or per-trigger (task-level ttl and trigger options) and update any
references in this file that claim a project-wide ttl is supported so they only
document task/trigger TTL usage.
---
Nitpick comments:
In `@docs/tasks/scheduled.mdx`:
- Around line 70-80: Update the scheduled-task docs to note that ttl accepts
either a duration string or a numeric count of seconds (as defined by the ttl
type in packages/core/src/v3/types/tasks.ts) and add a short numeric example for
schedules.task (e.g., ttl: 300) alongside the existing "5m" example so readers
see both supported forms.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f2ba9e89-ec3f-41b7-b533-4c175f7bde3a
📒 Files selected for processing (4)
docs/config/config-file.mdxdocs/runs.mdxdocs/tasks/overview.mdxdocs/tasks/scheduled.mdx
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (CLAUDE.md)
Docs in docs/ directory should use Mintlify MDX format following conventions in docs/CLAUDE.md
Files:
docs/runs.mdxdocs/tasks/overview.mdxdocs/tasks/scheduled.mdxdocs/config/config-file.mdx
docs/**/*.mdx
📄 CodeRabbit inference engine (docs/CLAUDE.md)
docs/**/*.mdx: MDX documentation pages must include frontmatter with title (required), description (required), and sidebarTitle (optional) in YAML format
Use Mintlify components for structured content: , , , , , , /, /
Always import from@trigger.dev/sdkin code examples (never from@trigger.dev/sdk/v3)
Code examples must be complete and runnable where possible
Use language tags in code fences:typescript,bash,json
Files:
docs/runs.mdxdocs/tasks/overview.mdxdocs/tasks/scheduled.mdxdocs/config/config-file.mdx
🧠 Learnings (18)
📓 Common learnings
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `idempotencyKeyTTL` option to define a time window during which duplicate triggers return the original run
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `idempotencyKeyTTL` option to define a time window during which duplicate triggers return the original run
Applied to files:
docs/runs.mdxdocs/tasks/overview.mdxdocs/tasks/scheduled.mdxdocs/config/config-file.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Attach metadata to task runs using the metadata option when triggering, and access/update it inside runs using metadata functions
Applied to files:
docs/runs.mdxdocs/tasks/overview.mdxdocs/tasks/scheduled.mdxdocs/config/config-file.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Limit task duration using the `maxDuration` property (in seconds)
Applied to files:
docs/runs.mdxdocs/tasks/overview.mdxdocs/tasks/scheduled.mdxdocs/config/config-file.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use the `task()` function from `trigger.dev/sdk/v3` to define tasks with id and run properties
Applied to files:
docs/runs.mdxdocs/tasks/overview.mdxdocs/tasks/scheduled.mdxdocs/config/config-file.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Configure task retry behavior using the `retry` property with options like maxAttempts, factor, and timeout values
Applied to files:
docs/runs.mdxdocs/tasks/overview.mdxdocs/config/config-file.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Configure global retry settings in trigger.config.ts using `retries` object with defaults for all tasks
Applied to files:
docs/runs.mdxdocs/tasks/overview.mdxdocs/config/config-file.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `schedules.task()` for scheduled/cron tasks instead of regular `task()`
Applied to files:
docs/runs.mdxdocs/tasks/overview.mdxdocs/tasks/scheduled.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Set default maximum duration in trigger.config.ts using `maxDuration` property
Applied to files:
docs/runs.mdxdocs/config/config-file.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Subscribe to run updates using `runs.subscribeToRun()` for realtime monitoring of task execution
Applied to files:
docs/runs.mdxdocs/config/config-file.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Configure Trigger.dev project in `trigger.config.ts` using `defineConfig()` with project ref and task directories
Applied to files:
docs/runs.mdxdocs/config/config-file.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Define global lifecycle functions (onStart, onSuccess, onFailure) in trigger.config.ts to apply to all tasks
Applied to files:
docs/tasks/overview.mdxdocs/config/config-file.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use lifecycle functions (init, cleanup, onStart, onSuccess, onFailure, handleError) for task event handling
Applied to files:
docs/tasks/overview.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `yourTask.trigger()` to trigger a task from inside another task with specified payload
Applied to files:
docs/tasks/overview.mdxdocs/tasks/scheduled.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Attach cron schedules declaratively using the `cron` property or imperatively using `schedules.create()`
Applied to files:
docs/tasks/scheduled.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `tasks.batchTrigger()` to trigger multiple runs of a single task with different payloads
Applied to files:
docs/tasks/scheduled.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `yourTask.batchTrigger()` to trigger multiple runs of a task from inside another task
Applied to files:
docs/tasks/scheduled.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `batch.triggerByTask()` to batch trigger tasks by passing task instances for static task sets
Applied to files:
docs/tasks/scheduled.mdx
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/tasks/overview.mdx (1)
143-151: Code example should include the import statement for completeness.Per coding guidelines, code examples should be complete and runnable where possible. The example is missing the
taskimport.📝 Suggested fix
```ts /trigger/time-sensitive-task.ts +import { task } from "@trigger.dev/sdk"; + export const timeSensitiveTask = task({ id: "time-sensitive-task", ttl: "10m", // Also accepts a number of seconds, e.g. 600 run: async (payload: any, { ctx }) => { //... }, });</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@docs/tasks/overview.mdxaround lines 143 - 151, The code example defining
timeSensitiveTask is missing the required import; add an import for the task
factory (e.g., import { task } from "@trigger.dev/sdk";) at the top of the
snippet so the timeSensitiveTask = task({ ... }) example is complete and
runnable.</details> </blockquote></details> </blockquote></details> <details> <summary>🤖 Prompt for all review comments with AI agents</summary>Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In@docs/tasks/overview.mdx:
- Around line 143-151: The code example defining timeSensitiveTask is missing
the required import; add an import for the task factory (e.g., import { task }
from "@trigger.dev/sdk";) at the top of the snippet so the timeSensitiveTask =
task({ ... }) example is complete and runnable.</details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository UI **Review profile**: CHILL **Plan**: Pro **Run ID**: `b0e3436b-fbf2-410c-be4c-874b7458d12e` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between b3cebee3b3c0e2f95034ed58dabceebff4ca4ff2 and 05058c580933df91245cc0b8640302f6cc4116f3. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `docs/config/config-file.mdx` * `docs/runs.mdx` * `docs/tasks/overview.mdx` </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (2)</summary> * docs/config/config-file.mdx * docs/runs.mdx </details> </details> <details> <summary>📜 Review details</summary> <details> <summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)</summary> * GitHub Check: Analyze (javascript-typescript) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>📓 Path-based instructions (1)</summary> <details> <summary>docs/**/*.mdx</summary> **📄 CodeRabbit inference engine (docs/CLAUDE.md)** > `docs/**/*.mdx`: MDX documentation pages must include frontmatter with title (required), description (required), and sidebarTitle (optional) in YAML format > Use Mintlify components for structured content: <Note>, <Warning>, <Info>, <Tip>, <CodeGroup>, <Expandable>, <Steps>/<Step>, <Card>/<CardGroup> > Always import from `@trigger.dev/sdk` in code examples (never from `@trigger.dev/sdk/v3`) > Code examples must be complete and runnable where possible > Use language tags in code fences: `typescript`, `bash`, `json` Files: - `docs/tasks/overview.mdx` </details> </details><details> <summary>🧠 Learnings (12)</summary> <details> <summary>📓 Common learnings</summary>Learnt from: nicktrn
Repo: triggerdotdev/trigger.dev PR: 3200
File: docs/config/config-file.mdx:353-368
Timestamp: 2026-03-10T12:44:19.869Z
Learning: In the triggerdotdev/trigger.dev repository, docs PRs are often written as companions to implementation PRs (e.g., PR#3200documents features being added in PR#3196). When reviewing docs PRs, the documented features may exist in a companion/companion PR branch rather than main. Always check companion PRs referenced in the PR description before flagging missing implementations.Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Limit task execution time using themaxDurationoption (in seconds)Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Useschedules.task()for scheduled (cron) tasks with either declarative cron patterns or imperative schedule creationLearnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to trigger.config.ts : Define global lifecycle hooks (onStart,onSuccess,onFailure) intrigger.config.tsto apply to all tasks</details> <details> <summary>📚 Learning: 2026-03-25T15:29:25.853Z</summary>Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Limit task execution time using themaxDurationoption (in seconds)**Applied to files:** - `docs/tasks/overview.mdx` </details> <details> <summary>📚 Learning: 2026-03-25T15:29:25.853Z</summary>Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Useschedules.task()for scheduled (cron) tasks with either declarative cron patterns or imperative schedule creation**Applied to files:** - `docs/tasks/overview.mdx` </details> <details> <summary>📚 Learning: 2026-03-25T15:29:25.853Z</summary>Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Usetask()fromtrigger.dev/sdkfor basic task definitions withidandrunproperties**Applied to files:** - `docs/tasks/overview.mdx` </details> <details> <summary>📚 Learning: 2026-03-25T15:29:25.853Z</summary>Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to trigger.config.ts : Define global lifecycle hooks (onStart,onSuccess,onFailure) intrigger.config.tsto apply to all tasks**Applied to files:** - `docs/tasks/overview.mdx` </details> <details> <summary>📚 Learning: 2026-03-25T15:29:25.853Z</summary>Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Use lifecycle hooks (init,cleanup,onStart,onSuccess,onFailure,handleError) to manage task execution stages**Applied to files:** - `docs/tasks/overview.mdx` </details> <details> <summary>📚 Learning: 2026-03-25T15:29:25.853Z</summary>Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Usetask.trigger()to trigger a single run of a task from inside another task**Applied to files:** - `docs/tasks/overview.mdx` </details> <details> <summary>📚 Learning: 2026-03-25T15:29:25.853Z</summary>Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Configure retry behavior using theretryoption with properties likemaxAttempts,factor,minTimeoutInMs,maxTimeoutInMs, andrandomize**Applied to files:** - `docs/tasks/overview.mdx` </details> <details> <summary>📚 Learning: 2026-03-25T15:29:25.853Z</summary>Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Usetask.batchTrigger()to trigger multiple runs of a task from inside another task**Applied to files:** - `docs/tasks/overview.mdx` </details> <details> <summary>📚 Learning: 2026-03-25T15:29:25.853Z</summary>Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to trigger.config.ts : Configure the Trigger.dev project usingdefineConfig()with properties likeproject,dirs,retries,runtime, andbuild**Applied to files:** - `docs/tasks/overview.mdx` </details> <details> <summary>📚 Learning: 2026-03-25T15:29:25.853Z</summary>Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.853Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Usetask.triggerAndWait()to trigger a task and wait for its result from inside another task**Applied to files:** - `docs/tasks/overview.mdx` </details> <details> <summary>📚 Learning: 2026-03-10T12:44:14.176Z</summary>Learnt from: nicktrn
Repo: triggerdotdev/trigger.dev PR: 3200
File: docs/config/config-file.mdx:353-368
Timestamp: 2026-03-10T12:44:14.176Z
Learning: In the trigger.dev repo, docs PRs are often companions to implementation PRs. When reviewing docs PRs (MDX files under docs/), check the PR description for any companion/related PR references and verify that the documented features exist in those companion PRs before flagging missing implementations. This ensures docs stay in sync with code changes across related PRs.**Applied to files:** - `docs/tasks/overview.mdx` </details> </details> </details> <details> <summary>🔇 Additional comments (1)</summary><blockquote> <details> <summary>docs/tasks/overview.mdx (1)</summary><blockquote> `139-154`: **LGTM!** The `ttl` option documentation is well-structured, follows the existing patterns in the file, and provides clear guidance on usage with appropriate cross-references to related documentation. The three-tier precedence explanation and `ttl: 0` opt-out behavior are documented as intended. </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Documents TTL support at task-level and config-level. Companion to #3196 - merge after new packages are released.