> ## Documentation Index
> Fetch the complete documentation index at: https://docs.embedder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run jobs on a bench

> Let a bench run your GitHub and Slack requests, connect its repositories, send a test request, and follow, cancel or take over a job.

A [bench](https://docs.embedder.com/integrations/benches.md) can take jobs: it runs your GitHub and Slack requests in the background with its own toolchains and boards. Set the bench up first, then connect the work on its **Connect work** page.

> [!WARNING]
>
> Jobs approve their own actions. They can edit files, run commands and use any hardware the bench can reach. Share a bench only with teams you trust with the whole machine, and state hardware limits in each request.

## Turn jobs on

`embedder bench start` turns jobs on by itself when you run it in a folder with GitHub checkouts. The bench then takes jobs for those repositories, one at a time. When the folder has no checkouts, the command asks whether to take jobs for every repository your team connects.

To choose without being asked:

```bash theme={"theme":"css-variables"}
embedder bench start --jobs --repos acme/firmware --max-jobs 2
```

After setup, change the job settings on the bench machine:

```bash theme={"theme":"css-variables"}
embedder bench jobs on
embedder bench jobs off
embedder bench jobs pause --for 2h
embedder bench jobs status
```

| Command | Effect |
| - | - |
| `on` | Take jobs. |
| `off` | Stop taking jobs. Running jobs finish. Add `--now` to also stop the running ones. |
| `pause` | Stop taking new jobs until you run `embedder bench jobs on`. Add `--for 2h` to pause for a while. |
| `list` | Show the jobs that are running. |
| `status` | Show the job settings and the running jobs. |
| `set` | Change a setting, such as `--max-jobs 2`, `--repos acme/firmware,acme/bootloader`, `--repos all`, or `--schedule "Mon-Fri 19:00-07:00"`. |

On the bench's page in [the Embedder app](https://app.embedder.com), the bench's owner can also turn **Takes jobs** on or off. The page shows **Saved** until the bench applies the change when it next checks in.

To let jobs read a toolchain folder outside their checkout, run `embedder bench jobs set --read <folder>`. A job can always read its own checkout.

## Connect work to a bench

The **Connect work to** page lists what GitHub and Slack requests need, in order. `embedder bench start` opens it at the end. You can also open it from the bench's page with **Connect work**.

The line at the top counts the required steps, such as **2 of 4 · Next: finish linking the Embedder app**. Select the next step to jump to it, and choose the highlighted button in each step.

**1. Bring the bench online**

The step shows when the bench was last seen. If the bench is offline, run `embedder bench start` on the bench machine. It's safe to run again: it restarts the service and keeps the bench's settings.

**2. GitHub account**

Choose **Link GitHub** so your own GitHub requests can reach the bench. If GitHub stopped accepting the link, choose **Reconnect**.

**3. GitHub organizations**

Each GitHub organization or account with the Embedder app installed has a row.

* **No GitHub organization yet:** an organization admin chooses **Install on GitHub**, then picks the repositories the app can see.
* **Embedder app installed, not linked yet:** choose **Finish linking**. This opens the team's **GitHub Integration** page, where the person who installed the app finishes the link.
* **Installed for another Embedder organization:** if you're an admin of both organizations, choose **Use in** followed by your organization's name. See [Use an installation in another organization](#use-an-installation-in-another-organization).

**4. Repos**

Repositories with a checkout on the bench are listed first. Each one says what it needs:

* **Map** connects the repository to a project in your team. Embedder creates the project. Mapping needs a team admin.
* **Add on GitHub** lets the Embedder app see a repository it can't see yet.
* **Request on GitHub** asks the GitHub organization's owners to approve the app for a repository.
* The switch beside a mapped repository turns the bench's jobs for it on or off. Only the bench's owner can change it. Turning a repository off keeps its project.

When jobs are paused on the bench, choose **Resume jobs**. Use **Search repos** to find a repository, or show **Other repos in your organizations**.

**5. Slack**

This step is optional. GitHub requests work without it. An organization admin chooses **Connect a Slack workspace**. See [Connect Slack](https://docs.embedder.com/headless/slack.md#connect-slack).

**6. Try it**

Choose **Send a test request**. See [Send a test request](#send-a-test-request).

### Use an installation in another organization

When the Embedder app on a GitHub organization is installed for another Embedder organization, admins of both organizations can choose **Use in** followed by the organization's name:

| Option | Effect |
| - | - |
| **Share with** your organization | The default. Both organizations take work from the GitHub organization's repositories, and each repository still runs in one organization. Nothing stops in the other organization. Slack requests can't reach a shared installation's repositories yet. GitHub requests can. |
| **Move to** your organization | Only your organization uses the installation. Its repository mappings in the other organization switch off, and the dialog lists the requests and repositories that stop there. Type the GitHub organization's name to confirm. |

Then choose **Share** or **Move**.

## Send a test request

**Send a test request** checks the whole path without changing anything. The bench clones a repository it takes jobs for and reads the board's serial port for 5 seconds. Nothing is flashed.

The result shows each step: when the bench picked the request up, the clone, and the serial output, such as **Read 5 lines from /dev/cu.usbserial-0001**. When it passes, the **Connect work** page shows **4 of 4 · Ready**. Then ask for real: mention `@embedder` with a task on an issue or pull request in that repository.

| Result | What to do |
| - | - |
| **Read nothing from** the port **in 5 s** | Check that the board is powered and prints on that port, then choose **Send another**. |
| **No serial port found on the bench** | Plug in the board, or check the driver and permissions on the bench machine. |
| **No repo cloned: none takes jobs on this bench yet** | Turn on a repository in the **Repos** step. |
| A clone error | Check that the Embedder app can see the repository. |

If the bench hasn't picked the test up after 3 minutes, the test keeps waiting. Check **Recent requests** on the bench's page.

## How a request finds a bench

A bench takes a request when all of these are true:

* The repository is mapped to a project in the bench's team, and the bench takes jobs for it.
* The bench has jobs on, is online, and has a free slot.
* You own the bench, or the bench is shared with the team the repository is mapped to.

When several benches qualify, Embedder prefers the one that last finished work on the repository.

To pick a bench yourself, start the request with `on` and the bench's name:

```text theme={"theme":"css-variables"}
@embedder on lab-mac flash the bootloader fix to the NUCLEO board and report
the boot log. Do not change the option bytes.
```

To move a request that's still waiting, reply `@embedder on lab-mac`. To list the benches that can take work for the repository, reply `@embedder benches`.

## Follow and cancel a request

Embedder replies where you asked and edits that reply as the request moves on. The reply starts with its state, such as **On it**, **Running** on the bench, **Done** or **Failed**. Its last line identifies the request:

```text theme={"theme":"css-variables"}
Request e-d9e7 · Firmware · 39 s · View PR #3
```

Select the request tag to open the request's page in the Embedder app. It shows where the request was asked, how long it took, and how it ended, with **View PR** when it opened a pull request. The bench's page lists the latest requests under **Recent requests**.

See [Status replies](https://docs.embedder.com/headless/overview.md#status-replies) for what each reply means.

To cancel, reply `@embedder cancel`. In Slack, you can also choose **Cancel** on Embedder's reply. Only the person who asked, or a team admin with a linked Embedder account, can cancel a Slack request. In GitHub, anyone with write access to the repository can.

## Take a job over

To continue a running job on your own computer, run this in your clone of the repository:

```bash theme={"theme":"css-variables"}
embedder bench takeover --bench lab-mac
```

The job stops at its next stopping point. Embedder fetches its branch and imports its conversation, so you can continue in a chat. Only the person who asked for the job can take it over. The bench's owner can also take over any job on their bench by naming the bench with `--bench`.

## Limits

* Each job can run for up to 2 hours. A job that goes past it stops with **The job ran past the bench's time limit.** Split long work into smaller requests.
* A job that's interrupted 3 times is given up. Send the request again to retry.
* Jobs work in their own checkouts on the bench. When jobs use more than their disk space, the oldest checkouts and logs are removed first. The default is 20 GB or a tenth of the disk, whichever is smaller. Change it with `embedder bench jobs set --disk-quota 40GB`.
* On Linux, `embedder bench jobs set --linux-limits on` limits the CPU and memory jobs can use.

## Troubleshoot

* **No bench takes work for** the repository **yet:** turn the repository on for a bench on its **Connect work** page, or set up a bench with `embedder bench start`.
* **No bench shared with the team takes jobs for** the repository: ask a bench's owner to share it with `embedder bench share <bench> --team <team>`, or set up your own.
* **Queued for** a bench **which has been offline since** a time: run `embedder bench start` on that bench machine. The request runs when the bench is back.
* **Waiting for** a bench with **jobs off** or **paused**: turn jobs on with `embedder bench jobs on`, or choose **Resume jobs** on the **Connect work** page.
* **Link GitHub so I know which Embedder account is yours:** link GitHub under **Sign-in methods** in **Settings**. The request runs as soon as you do, if you're on the team.
* **Not on the team:** ask a team admin to add you. The request runs once you're added.
* **The bench can't take this request:** the bench you named with `on` isn't yours or shared with the team, or doesn't take jobs for the repository. Send the request again without `on`, or name another bench.
* **Jobs on this bench were stopped, so this job was canceled:** an admin stopped the bench's jobs. Send the request again once they're back on.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.