> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/guides/ci-optimization/re-run-only-failed-tests/re-run-only-failed-tests-orchestrated-v2.md).

# Orchestrated runs

Re-run only failed Playwright tests when using Currents Orchestration

{% hint style="info" %}
Failed orchestrated reruns require **Rerun All Jobs** in the CI provider, not **Rerun Failed Only**.
{% endhint %}

Orchestrated runs work differently from native Playwright sharding. Currents assigns tests to **all available machines**. More machines can run the tests faster, and the total number of CI machines does not need to be set in advance.

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2FeoQt31VyljQ09It1PZHF%2Fcurrents-2024-09-30-13.59.22%402x.png?alt=media&amp;token=dc315efb-599c-4a16-8f44-b4fc05cd804a" alt=""><figcaption><p>Rerunning failed-only Playwright tests using Currents Orchestration</p></figcaption></figure>

That's why failed orchestrated CI reruns use **Rerun All Jobs** instead of **Rerun Failed Only**:

* The CI provider will spin up all the containers
* Currents will assign the failed tests to all the available containers
* More available containers will run the tests in parallel faster

## Orchestration flow

In Orchestration, Playwright filter flags such as `--last-failed` belong on `pwc-p discover`. The generated test list is passed to `pwc-p run` with `--pwc-discovery-file`.

```bash
npx pwc-p discover --pwc-discovery-file tests.txt --last-failed
npx pwc-p run --key <record-key> --project-id <project-id> --ci-build-id <ci-build-id> --pwc-discovery-file tests.txt
```

See [Orchestration Setup](/guides/ci-optimization/playwright-orchestration.md) for setup details.

## Step-by-step guides

* **GitHub Actions** - [Orchestrated runs](/getting-started/ci-setup/github-actions/re-run-failed-only-tests/re-run-failed-only-tests-orchestrated-v2.md)
* **GitLab CI** - [Re-run Only Failed Tests](/getting-started/ci-setup/gitlab/re-run-failed-only-tests.md)
* **Jenkins Pipeline** - [Jenkins](/getting-started/ci-setup/jenkins.md)

See also the overview: [Re-run Only Failed Tests](/guides/ci-optimization/re-run-only-failed-tests.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.currents.dev/guides/ci-optimization/re-run-only-failed-tests/re-run-only-failed-tests-orchestrated-v2.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
