Skip to content

docs: add task-level and config-level TTL documentation#3200

Draft
nicktrn wants to merge 1 commit intomainfrom
docs/ttl-task-config-levels
Draft

docs: add task-level and config-level TTL documentation#3200
nicktrn wants to merge 1 commit intomainfrom
docs/ttl-task-config-levels

Conversation

@nicktrn
Copy link
Collaborator

@nicktrn nicktrn commented Mar 10, 2026

Documents TTL support at task-level and config-level. Companion to #3196 - merge after new packages are released.

@changeset-bot
Copy link

changeset-bot bot commented Mar 10, 2026

⚠️ No Changeset found

Latest commit: b3cebee

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

Walkthrough

The changes expand documentation for a new time-to-live (TTL) configuration option across multiple files. A TTL field is introduced at the global configuration level, task definition level, and per-trigger level, with a three-level precedence system (per-trigger overrides task-level, which overrides global config). Usage examples demonstrate TTL with string formats like "1h" or "5m" and numeric seconds. A clarifying note is added regarding process termination guarantees. All changes are documentation-only with no API or code modifications.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description lacks required sections from the template including Testing, Changelog details, and complete checklist items. Add Testing section describing validation steps, expand Changelog with detailed changes, and complete all checklist items from the contributing guide.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the primary change: adding documentation for TTL at task and config levels across multiple documentation files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/ttl-task-config-levels

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts exposes ttl as string | 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 making schedules.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

📥 Commits

Reviewing files that changed from the base of the PR and between c0b6309 and b3cebee.

📒 Files selected for processing (4)
  • docs/config/config-file.mdx
  • docs/runs.mdx
  • docs/tasks/overview.mdx
  • docs/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.mdx
  • docs/tasks/overview.mdx
  • docs/tasks/scheduled.mdx
  • docs/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/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/runs.mdx
  • docs/tasks/overview.mdx
  • docs/tasks/scheduled.mdx
  • docs/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.mdx
  • docs/tasks/overview.mdx
  • docs/tasks/scheduled.mdx
  • docs/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.mdx
  • docs/tasks/overview.mdx
  • docs/tasks/scheduled.mdx
  • docs/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.mdx
  • docs/tasks/overview.mdx
  • docs/tasks/scheduled.mdx
  • docs/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.mdx
  • docs/tasks/overview.mdx
  • docs/tasks/scheduled.mdx
  • docs/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.mdx
  • docs/tasks/overview.mdx
  • docs/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.mdx
  • docs/tasks/overview.mdx
  • docs/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.mdx
  • docs/tasks/overview.mdx
  • 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.config.ts : Set default maximum duration in trigger.config.ts using `maxDuration` property

Applied to files:

  • docs/runs.mdx
  • docs/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.mdx
  • docs/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.mdx
  • docs/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.mdx
  • docs/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.mdx
  • 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} : 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant