# Maximum build lifetime

> 📘 Enforcement starts January 11, 2027
> Buildkite Pipelines will enforce maximum build lifetimes from January 11, 2027.

Buildkite Pipelines limits the lifetime of a build to [30 days by default](https://buildkite.com/docs/platform/limits.md#pipelines-limits). Once that time has passed, you cannot retry jobs, unblock steps, or upload steps to a build. Builds that remain in a non-terminal state past their maximum lifetime are either canceled or marked as passed or failed, depending on their state.

To check a build's maximum lifetime, see [API behavior](https://buildkite.com/docs/pipelines/configure/maximum-build-lifetime.md#api-behavior). Your organization's limit can be lowered by contacting support.

Maximum build lifetime is separate from [command job timeouts](https://buildkite.com/docs/pipelines/configure/build-timeouts.md) and [build retention](https://buildkite.com/docs/pipelines/configure/build-retention.md). The lifetime includes time spent waiting, even when no command job runs. It does not set a command job's timeout or delete build data.

## Retry, unblock, and rebuild restrictions

These restrictions apply as soon as a build reaches its maximum lifetime, regardless of whether it still appears active or has already finished.

A _root build_ is a build that was not created by a trigger step.

| Operation | Behavior after reaching the maximum lifetime |
| --- | --- |
| Manually retry a job | Rejected |
| Retry all failed jobs | Rejected |
| Run a pending automatic retry | The retry is not run |
| Unblock a block or input step | Rejected |
| Upload more pipeline steps | Rejected |
| Rebuild a root build | Allowed. The rebuild creates a new root build with a new maximum lifetime |
| Rebuild a triggered build | Allowed. At or after the parent's deadline, the rebuild creates an independent root build with a new maximum lifetime |

Before the parent's deadline, rebuilding a triggered build retries the parent's trigger job. Rebuilding a synchronous child creates a build that inherits the parent's deadline. Rebuilding an asynchronous child creates a build with a fresh deadline based on its creation time and the organization's limit.

At or after the parent's deadline, rebuilds of both synchronous and asynchronous builds become independent root builds. The parent and its trigger job remain unchanged. The new build retains the original build's configuration, commit, branch, tag, message, initial metadata, and custom environment variables. Its `rebuilt_from` field identifies the original build, but it has no `triggered_from` relationship and does not update the parent's status or trigger-job retry chain.

For an independent rebuild, `BUILDKITE_TRIGGERED_FROM_BUILD_ID`, `BUILDKITE_TRIGGERED_FROM_BUILD_NUMBER`, and `BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG` are empty strings. `BUILDKITE_TRIGGERED_FROM_BUILD_JOB_ID` is absent. The `BUILDKITE_REBUILT_FROM_*` variables still identify the original build.

Existing jobs in a build past its maximum lifetime may still become runnable or acquire agents before background processing cancels the build. The deadline does not immediately stop work already in the build. However, creating a synchronous child build after the parent's deadline is rejected because the child inherits that expired deadline. Asynchronous children receive a fresh deadline and can still be created.

## How maximum build lifetime is calculated

For a root build, Buildkite Pipelines adds the organization's maximum build lifetime limit to the build's `created_at` timestamp. The limit is taken at creation time. Buildkite Pipelines stores the deadline as `max_lifetime_at`.

Changes to the organization's limit affect newly created root and asynchronous builds. They do not change deadlines already stored on existing builds.

### Triggered builds

Builds created by [trigger steps](https://buildkite.com/docs/pipelines/configure/step-types/trigger-step.md) receive deadlines according to the trigger type:

- A synchronous child inherits its parent's stored deadline. Creating the child does not start a new maximum-lifetime window, even if the organization's limit has changed.
- An asynchronous child receives a fresh deadline based on its own creation time and the organization's limit at that time. Synchronous children of that asynchronous build inherit its deadline, not the original root build's deadline.

## What happens to overdue builds

Buildkite Pipelines scans periodically for overdue builds, then processes them in the background. A build can appear active after its deadline. Use a [command timeout](https://buildkite.com/docs/pipelines/configure/build-timeouts.md#command-timeouts) when a job must stop within a specific period.

A blocked build has a separate _blocked state_ that records the outcome of its work while it waits for approval. Buildkite Pipelines uses this value to determine whether an overdue blocked build passes, fails, or enters cancellation.

| Build state when processed | Result |
| --- | --- |
| `scheduled` | Canceled with `cancel_reason: "maximum_lifetime_reached"` |
| `running` | Canceled with `cancel_reason: "maximum_lifetime_reached"` |
| `failing` | Canceled with `cancel_reason: "maximum_lifetime_reached"` |
| `blocked` with no blocked state set | Passed |
| `blocked` with blocked state `passed` | Passed |
| `blocked` with blocked state `failed` | Failed |
| `blocked` with blocked state `running` | Canceled with `cancel_reason: "maximum_lifetime_reached"` |
| `creating`, `canceling`, or a terminal state | No additional transition |

Builds selected for cancellation enter `canceling` and become `canceled` once cancellation completes. Builds already in a terminal state are not selected.

Marking a blocked build as passed or failed does not approve its block or run downstream steps. A build waiting for deployment approval can therefore pass even though the deployment never ran. Blocked jobs remain blocked.

`maximum_lifetime_reached` is a cancellation reason, not a build state. Builds canceled for this reason appear as **Canceled after reaching its maximum lifetime** in the Buildkite interface.

## API behavior

To check a build's deadline, use the [Get a build REST API endpoint](https://buildkite.com/docs/apis/rest-api/builds.md#get-a-build) and read the `max_lifetime_at` timestamp. For example, this response excerpt shows a deadline of 12:00 UTC on January 31, 2026:

```json
{
  "max_lifetime_at": "2026-01-31T12:00:00.000Z"
}
```

Builds canceled after reaching their maximum lifetime return `"state": "canceled"` and `"cancel_reason": "maximum_lifetime_reached"` from the [REST API](https://buildkite.com/docs/apis/rest-api/builds.md). The GraphQL API exposes the same reason through `Build.cancelReason`.

Blocked builds marked as passed or failed after their deadline do not have this cancellation reason because they were not canceled.

REST API requests and GraphQL mutations return errors for restricted operations after the deadline. See the endpoint documentation for the exact REST status and error message:

- [Rebuild a build](https://buildkite.com/docs/apis/rest-api/builds.md#rebuild-a-build)
- [Retry failed jobs for a build](https://buildkite.com/docs/apis/rest-api/builds.md#retry-failed-jobs-for-a-build)
- [Retry a job](https://buildkite.com/docs/apis/rest-api/jobs.md#retry-a-job)
- [Unblock a job](https://buildkite.com/docs/apis/rest-api/jobs.md#unblock-a-job)

## Notifications

Cancellation after reaching the maximum lifetime follows the normal build cancellation path. Configured customer notifications can run, including webhooks, Slack and email notifications, source-provider statuses, and checks.

When Buildkite Pipelines marks an overdue blocked build as passed or failed, it does not send customer notifications or notification-provider updates. These include:

- Webhooks
- Slack and email notifications
- Source-provider statuses and checks

Internal build-finished events, interface updates, metrics, and trigger propagation can still occur when customer notifications are suppressed.

## Related controls

- [Build timeouts](https://buildkite.com/docs/pipelines/configure/build-timeouts.md) limit a command job's run time or how long a scheduled job waits for an agent. Buildkite Pipelines does not currently reduce a command job timeout to the remaining maximum build lifetime.
- [Build retention](https://buildkite.com/docs/pipelines/configure/build-retention.md) controls when Buildkite removes build records, logs, and artifacts. Maximum build lifetime does not change retention periods.
