You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: clarify wait billing and what maxDuration measures - #5175
Two docs pages gave AI assistants and content writers the wrong picture.
Wait billing (snippets/paused-execution-free.mdx, shown on /wait, /wait-for, /wait-until): it didn't mention waitpoint tokens, so it read as if the 5 second rule covered every wait. It now says token and child-run waits are never billed, however long, and that a wait.for/wait.until of 5 seconds or less is billed in full.
maxDuration (runs/max-duration.mdx): it said maxDuration is compared to CPU time. The timeout manager compares cpuTime from the usage measurement, which is wallTime - totalPauses (packages/core/src/v3/usage/devUsageManager.ts), so time spent awaiting an LLM call counts. Reworded to execution time minus paused waits, and noted that wait.for/wait.until of 5 seconds or less runs in-process and counts.
Token and child-run waits are never billed; the 5 second rule only applies to
wait.for/wait.until (over 5s is free, 5s or less billed in full).
maxDuration compares wall time minus paused waits, not CPU time, so awaited
network calls count.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
The documentation now describes maxDuration as a limit on attempt execution time. It defines execution time as wall-clock time since the attempt started, excluding paused time and including network waits. It also specifies which wait calls do not count toward execution time or compute usage, and clarifies that waits of 5 seconds or less using wait.for or wait.until count in full.
Merge Risk: Low · up to 627da
The docs leave the behavior of a wait of exactly 5 seconds unstated. Readers could misjudge whether such a wait counts toward maxDuration or compute usage. The fix is a one-line wording change, and the risk of merging is low.
Pre-merge checks: 3 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Description check
The description explains the problem in both docs pages, names the changed files, and states what the new text says. It cites the usage measurement source that supports the maxDuration change. It does…
Add the template sections: a 'Closes #' line (or state that no issue applies), the checklist with each item checked or explained, a Testing section describing how the docs were checked (for example, a rendered preview or a code-path …
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title "docs: clarify wait billing and what maxDuration measures" matches the two documentation changes in the PR: the wait billing snippet and the maxDuration page. It names the main change and fo…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "docs: clarify wait billing and what maxDuration measures" matches the two documentation changes in the PR: the wait billing snippet and the maxDuration page. It names the main change and follows a conventional docs prefix. It is concise and specific.
Full details: Description check
Explanation
The description explains the problem in both docs pages, names the changed files, and states what the new text says. It cites the usage measurement source that supports the maxDuration change. It does not follow the repository template: the Closes #<issue> line, the checklist, the Testing section, the Changelog section, and the Screenshots section are all missing. The description also lacks any statement of how the changes were tested or verified.
Resolution
Add the template sections: a 'Closes #<issue>' line (or state that no issue applies), the checklist with each item checked or explained, a Testing section describing how the docs were checked (for example, a rendered preview or a code-path check), a Changelog entry, and a Screenshots section (or mark it not applicable, since these are text-only docs changes).
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: ea51fe73-6a48-425c-b810-01932ec4b793
Commits
Reviewing files that changed from the base of the PR and between 6270380 and 627da6b.
Files selected for processing: 2
docs/runs/max-duration.mdx
docs/snippets/paused-execution-free.mdx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Source excerpt: You MUST import from `@trigger.dev/sdk` (NEVER `@trigger.dev/sdk/v3`) Source excerpt: You MUST NEVER use `client.defineJob` Source excerpt: YOU MUST `export` every task, including subtasks Source excerpt: Key points: Each ta...
The docs claim that wait.forToken waits are not billed does not conflict with the inspected code. Token waits run through runtime.waitUntil, which wraps them in usage.pauseAsync. The usage manager removes paused time from cpuTime, and ProdUsageManager bills only that cpuTime delta. A one-second token wait is therefore excluded from billed compute, as is a 10-second wait.for. The comment's concern that a charge could apply to either wait is not supported.
docs/runs/max-duration.mdx: 1
36-36: Data Integrity & Integration
The concern does not hold for the repository-owned accounting path. The SDK sends a 10-second wait.for through runtime.waitUntil, which runs inside usage.pauseAsync. The dev measurement subtracts that paused interval, and the reported durationMs is the measured CPU sample. The docs statement that such waits are excluded matches this path. The only remaining premise is production enforcement, which this checkout does not contain, and the comment's stated 60-second rule has no source in the reviewed docs. No inspected repository source establishes that the wait exhausts maxDuration or increases durationMs.
The `maxDuration` is set in seconds, and is compared to the execution time of a single attempt (see [attempts](/runs#attempts)) of the task. Execution time is the wall-clock time since the attempt started, minus any time the run was paused. It includes time spent awaiting network calls such as LLM responses. It does not include time spent paused during the following:
- `wait.for` calls
- `wait.for` and `wait.until` calls longer than 5 seconds (shorter waits run in-process and count towards it)
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
State the five-second boundary explicitly.
The SDK counts a wait of exactly five seconds, but “shorter waits” does not include that boundary. Say “waits of 5 seconds or less” so readers can determine how the limit applies.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two docs pages gave AI assistants and content writers the wrong picture.
Wait billing (
snippets/paused-execution-free.mdx, shown on /wait, /wait-for, /wait-until): it didn't mention waitpoint tokens, so it read as if the 5 second rule covered every wait. It now says token and child-run waits are never billed, however long, and that await.for/wait.untilof 5 seconds or less is billed in full.maxDuration (
runs/max-duration.mdx): it said maxDuration is compared to CPU time. The timeout manager comparescpuTimefrom the usage measurement, which iswallTime - totalPauses(packages/core/src/v3/usage/devUsageManager.ts), so time spent awaiting an LLM call counts. Reworded to execution time minus paused waits, and noted thatwait.for/wait.untilof 5 seconds or less runs in-process and counts.🤖 Generated with Claude Code