1. Resources
  2. /
  3. Changelog
  4. /
  5. Control where your retries run with Retry Agent Affinity

Control where your retries run with Retry Agent Affinity

A common frustration when running in CI is that agent instances can become corrupted in such a way where they are no longer able to consistently run jobs. This can lead to retries failing, which can be difficult to diagnose and fix. Within Buildkite, by default, jobs are run on the agent that has most recently finished a job, which can lead to retries running on the same agent that failed the first time causing repeated failures.

With the new Retry Agent Affinity feature, you can control where your retries run. Retry agent affinity is set at the Cluster Queue level, and when set to prefer-different, will prefer to run retries on a different agent than the one that failed the first time. This can help to avoid retries failing due to repeated runs on the same corrupted agent.

To set the Retry Agent Affinity on a cluster queue, you can go into the Cluster Queue settings and select the Retry Agent Affinity option:

Retry Agent Affinity

Alternatively, this value can be set via both the REST and graphQL APIs.

Availability

Retry agent affinity is available for all self-hosted cluster queues.

If your agents are using an acquire-job workflow such as agent-stack-k8s, the setting will have no effect, as Buildkite doesn't control job dispatch for these agents.

Retry agent affinity can't be set on hosted queues, as agents in hosted queues are ephemeral, and so retries will always run on different agents from the original job.

Benno

Atom feed

Start turning complexity into an advantage

Create an account to get started for free.

Buildkite Pipelines

Platform

  1. Pipelines
  2. Public pipelines
  3. Test Engine
  4. Package Registries
  5. Mobile Delivery Cloud
  6. Pricing

Hosting options

  1. Self-hosted agents
  2. Mac hosted agents
  3. Linux hosted agents

Resources

  1. Docs
  2. Blog
  3. Changelog
  4. Example pipelines
  5. Plugins
  6. Webinars
  7. Case studies
  8. Events
  9. Migration Services
  10. Comparisons
  11. CI/CD perspectives

Company

  1. About
  2. Careers
  3. Press
  4. Security
  5. Brand assets
  6. Contact

Solutions

  1. Replace Jenkins
  2. Workflows for MLOps
  3. Testing at scale
  4. Monorepo mojo
  5. Bazel orchestration

Legal

  1. Terms of Service
  2. Acceptable Use Policy
  3. Privacy Policy
  4. Subprocessors
  5. Service Level Agreement

Support

  1. System status
  2. Forum
© Buildkite Pty Ltd 2025