{
  "doc": {
    "id": "cloud/features/smart-orchestration/run-cancellation",
    "title": "Auto Cancellation",
    "description": "Cancel entire test runs upon the first failure with Cypress Cloud's Auto Cancellation feature.",
    "section": "cloud",
    "source_path": "/llm/markdown/cloud/features/smart-orchestration/run-cancellation.md",
    "version": "ce02913654e2655ee63448bdc92bb92c7b46a619",
    "updated_at": "2026-04-22T19:37:51.587Z",
    "headings": [
      {
        "id": "cloud/features/smart-orchestration/run-cancellation#auto-cancellation",
        "text": "Auto Cancellation",
        "level": 1
      },
      {
        "id": "cloud/features/smart-orchestration/run-cancellation#what-youll-learn",
        "text": " What you'll learn",
        "level": 5
      },
      {
        "id": "cloud/features/smart-orchestration/run-cancellation#activate-auto-cancellation-in-cypress-cloud",
        "text": "Activate Auto Cancellation in Cypress Cloud",
        "level": 3
      },
      {
        "id": "cloud/features/smart-orchestration/run-cancellation#specifying-failures-before-auto-canceling-in-the-cli",
        "text": "Specifying failures before auto canceling in the CLI",
        "level": 3
      }
    ]
  },
  "content": {
    "type": "root",
    "children": [
      {
        "type": "heading",
        "depth": 1,
        "children": [
          {
            "type": "text",
            "value": "Auto Cancellation"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 5,
        "children": [
          {
            "type": "text",
            "value": " What you'll learn"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "How to enable Auto Cancellation in Cypress Cloud"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "How to save time by canceling test runs upon the first failure"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "How to reduce CI costs by using Auto Cancellation with Spec Prioritization"
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Continuous Integration (CI) pipelines are typically costly processes that can\ndemand significant compute time. When a test failure occurs in CI, it often\ndoes not make sense to continue running the remainder of a test suite since\nthe process has to start again upon merging of subsequent fixes and other code\nchanges. When Auto Cancellation is enabled, once the number of failed tests goes\nover a preset threshold, the entire test run is canceled. Note that any\nin-progress specs will continue to run to completion."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Benefits: Stopping a test run on\nthe first failure across parallelized machines will:"
          }
        ]
      },
      {
        "type": "list",
        "ordered": true,
        "start": 1,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Save time. Identify failures early and resolve issues faster."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Reduce CI costs. Cut down on unnecessary test execution, leading to significant savings for large test suites."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Free up CI resources. Prioritize critical tests and keep CI pipelines available for validating fixes."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Optimize future runs. With "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/cloud/features/smart-orchestration/spec-prioritization.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "Spec Prioritization"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " and Auto Cancellation, failed tests run first in the next attempt, stopping early if issues persist to maximize efficiency."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Activate Auto Cancellation in Cypress Cloud"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Auto Cancellation is a Smart Orchestration feature available to users with\na "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://cypress.io/pricing",
            "children": [
              {
                "type": "text",
                "value": "Business or Enterprise tier Cypress Cloud plan"
              }
            ]
          },
          {
            "type": "text",
            "value": ".\nWondering if upgrading your Team tier subscription is worth it? Check out the\n"
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/cloud/features/recorded-runs.md#Recommendations",
            "children": [
              {
                "type": "text",
                "value": "recommendations"
              }
            ]
          },
          {
            "type": "text",
            "value": " on the run\noverview page to see how much time we predict these features would save you."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Auto Cancellation is a Smart Orchestration feature that is managed within a\nproject's settings."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Consideration for Teams"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "If your development, testing, or QA teams operate in a highly collaborative\nworkflow where multiple people are working on various test failures at the same\ntime, it may make sense to increase the failures threshold to surface more failures on each test run."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "To enable or disable this feature at the Project level (must be an admin user):"
          }
        ]
      },
      {
        "type": "list",
        "ordered": true,
        "start": 1,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Select the desired project within Projects view to visit Cypress Cloud."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Click Project Settings with the right-hand sidebar."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Scroll to the Smart Orchestration section within Project Settings page."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Toggle Auto Cancellation."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Set the failures before auto canceling threshold (or just leave it at the\ndefault value of 1)."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "CI Tip: Save Time"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "In addition to Auto Cancellation, consider reducing CI costs further by enabling\n"
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/cloud/features/smart-orchestration/spec-prioritization.md",
            "children": [
              {
                "type": "text",
                "value": "Spec Prioritization"
              }
            ]
          },
          {
            "type": "text",
            "value": " to\nsurface test failures earlier in the run, and reduce the time it takes to fix\nissues and deploy changes."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Specifying failures before auto canceling in the CLI"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "With the Cypress CLI, you can specify the number of test failures to execute\nbefore canceling the run via a command flag. This allows more granular control\nof Auto Cancellation on a per-run basis."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Some common use cases for doing so might be:"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Setting a lower-than-normal value on dev environments to fail a test suite\nearly for faster feedback"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Disabling Auto Cancellation on important branches that need the full test\nsuite to run every time"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Overriding the project value on a case-by-case basis"
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Specifying the flag will override the project setting in Cypress Cloud, and not\nspecifying it will default to the value in the project settings."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "To set it, pass the `--auto-cancel-after-failures` flag to the `cypress run`\ncommand, and give it a numeric value:"
          }
        ]
      },
      {
        "type": "code",
        "lang": "shell",
        "meta": null,
        "value": "npx cypress run --record --key <<your_record_key>> --auto-cancel-after-failures 1"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "You can also specify `false` for the value to disable Auto Cancellation for the\nrun:"
          }
        ]
      },
      {
        "type": "code",
        "lang": "shell",
        "meta": null,
        "value": "npx cypress run --record --key <<your_record_key>> --auto-cancel-after-failures false"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "For more info on passing CLI flags, see our guide on the\n"
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/references/command-line.md",
            "children": [
              {
                "type": "text",
                "value": "Cypress Command Line"
              }
            ]
          },
          {
            "type": "text",
            "value": "."
          }
        ]
      }
    ]
  },
  "token_estimate": 827
}