Skip to content

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

Merged
matt-aitken merged 3 commits intomainfrom
docs/ttl-task-config-levels
Apr 13, 2026
Merged

docs: add task-level and config-level TTL documentation#3200
matt-aitken merged 3 commits intomainfrom
docs/ttl-task-config-levels

Conversation

@nicktrn
Copy link
Copy Markdown
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
Copy Markdown

changeset-bot bot commented Mar 10, 2026

⚠️ No Changeset found

Latest commit: bdfb430

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
Copy Markdown
Contributor

coderabbitai bot commented Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0ba36142-58b8-4037-b56c-85d419be9f54

📥 Commits

Reviewing files that changed from the base of the PR and between 05058c5 and bdfb430.

📒 Files selected for processing (1)
  • docs/tasks/overview.mdx
✅ Files skipped from review due to trivial changes (1)
  • docs/tasks/overview.mdx

Walkthrough

Adds and expands documentation for a Time-To-Live (TTL) option across multiple docs: project-level default ttl in trigger.config.ts; expanded runs docs describing a three-tier TTL precedence (per-trigger > task-level > config-level) and ttl: 0 semantics to opt out of lower-precedence TTLs; task overview examples showing ttl in task definitions (string durations or numeric seconds); scheduled tasks docs adding an optional ttl on schedules.task options; and an updated Process keep alive note stating the process may be killed at any time.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete compared to the required template; it lacks the Testing section, Changelog section, Screenshots section, and the contribution checklist. Complete the PR description by adding the Testing section, Changelog section, Screenshots section, and confirming the contribution checklist items as required by the template.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes, which add documentation for task-level and config-level TTL support 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 unit tests (beta)
  • Create PR with unit tests
  • 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.

coderabbitai[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
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.

🧹 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 task import.

📝 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.mdx around 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 #3200 documents 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 the maxDuration option (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} : Use schedules.task() for scheduled (cron) tasks with either declarative cron patterns or imperative schedule creation


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) in trigger.config.ts to 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 the maxDuration option (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} : Use schedules.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} : Use task() from trigger.dev/sdk for basic task definitions with id and run properties


**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) in trigger.config.ts to 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} : Use task.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 the retry option with properties like maxAttempts, factor, minTimeoutInMs, maxTimeoutInMs, and randomize


**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 task.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 using defineConfig() with properties like project, dirs, retries, runtime, and build


**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 task.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 -->

nicktrn added a commit that referenced this pull request Mar 30, 2026
Add TTL (time-to-live) defaults at task-level and config-level, with
precedence: per-trigger > task > config > dev default (10m).

Docs PR: #3200 (merge after packages are released)
@nicktrn nicktrn added the ready label Apr 13, 2026
@nicktrn nicktrn marked this pull request as ready for review April 13, 2026 13:16
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

@matt-aitken matt-aitken merged commit 4d7fbf0 into main Apr 13, 2026
14 checks passed
@matt-aitken matt-aitken deleted the docs/ttl-task-config-levels branch April 13, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants