> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Stop, remove, and move loops

:::info

**Takeaways:**

- `definitionSource` says where a loop is controlled: `app` loops change in Tessl, `repo` loops change in `tessl.json`.
- Pausing works on both kinds and stops scheduled and event-started runs. Removing works differently for each kind.
- Pausing or removing a loop never cancels a run already in progress. Cancel that run separately with `tessl launch cancel`.
- Code Review is a repository setting, not a loop. Pausing every loop leaves it running.

:::

A factory keeps spending credits until each part of it is stopped: the loops, the runs they already started, and Code Review. This page covers each one, and how to read back that it took effect. For the terms loop, action, trigger, and run, see the [Automations overview](/automations/overview.md).

## Find where a loop is controlled

List the project's loops with their definition source:

```bash
tessl schedule list --project-id <project id> --all --json
```

Each loop's `attributes.definitionSource` tells you which control to use:

- `app`: the loop was set up in Tessl, by the web app, the `factory-setup` skill, or the CLI. Ticket to PR and Learn from past work are set up this way. Pause, resume, and delete it in Tessl. Ticket to PR's loops have no **Edit** button: to change them, [move them into tessl.json](#move-an-app-defined-loop-into-tessl.json) with your coding agent. Code Review is a repository setting, not a loop, so you [turn it off](#turn-off-code-review) instead.
- `repo`: the loop is declared in `tessl.json`. Pause and resume it in Tessl. Change or remove it by editing the file and merging to the default branch.

`definitionSource` is present when repo-defined loops are enabled for your organization. When it is absent, every loop is managed in Tessl. In the web app, a repo-defined loop's page offers **Edit in tessl.json** instead of **Edit**.

`--all` reads every page. The list leaves out loops that were already deleted.

## Pause and resume a loop

Pausing is the reversible way to stop a loop, and it works the same for both kinds. A paused loop starts no runs from its schedules or its event triggers. Resuming restores it as it was. A push to `tessl.json` keeps a paused repo-defined loop paused.

```bash
tessl schedule pause <loop id>
tessl schedule resume <loop id>
```

In the web app, open the loop's page, open the **Loop actions** menu, and choose **Pause** or **Resume**.

Read it back:

```bash
tessl schedule view <loop id>
```

`Status:` reads `paused` or `active`.

A paused loop still accepts a run you start on purpose: **Trigger now** in the web app and `tessl schedule trigger <loop id>` both start one. `tessl action trigger <name>` is refused while the action's loop is paused.

## Remove an app-defined loop

Delete it in Tessl:

```bash
tessl schedule delete <loop id>
```

In the web app, the **Loop actions** menu calls this **Archive**. The loop stops starting runs, and its past runs and findings stay available. To set it up again later, run the same setup again.

Read it back: the loop is no longer in `tessl schedule list --project-id <project id> --all --json`.

## Remove a repo-defined loop

Tessl refuses to edit or delete a repo-defined loop, so change the file instead:

- To stop a schedule, remove its entry from the `schedules` block.
- To stop an event trigger, remove its entry from the `triggers` block.
- To remove the whole loop, remove the action and every trigger and schedule that names it.

Commit the change and merge it to the default branch. Nothing changes until the change is on the default branch. A file Tessl can't parse changes nothing, but a block that fails validation holds back only what it covers, and the rest of the file still syncs. Run `tessl doctor --automations` before you push. The [Schedules](/schedules/overview.md#the-safety-model) page explains what an invalid block holds back.

Read it back after the merge: a removed loop is no longer listed by `tessl schedule list --project-id <project id> --all --json`, and a loop that lost one trigger shows only the rest in `tessl schedule view <loop id>`.

To stop a repo-defined loop today and decide on the file later, pause it.

## Move an app-defined loop into tessl.json

Move a loop into `tessl.json` when you want to change what Tessl doesn't let you edit in place: its instructions, its model, its environment, or who can start it.

Ticket to PR's four loops (Implement ticket, Shepherd PR, Follow ticket changes, and Merge conflict sweep) have no **Edit** button in the web app. To move them, ask your coding agent with the `tessl-labs/factory-setup` plugin installed to move them into `tessl.json`. It moves all of the project's loops set up in Tessl together, in one pull request. This agent route is US only for now: the plugin isn't published on the EU region yet.

For a loop with an **Edit** button on its page:

1. Open the loop's page in the web app and choose **Edit**.
2. Choose **Open pull request**. Tessl opens a pull request that adds the loop to `tessl.json`.
3. Leave the action key the pull request adds unchanged until it merges. A renamed key creates a second loop while the old one keeps running.
4. Merge the pull request. Tessl replaces the loop with the one the file declares and keeps its runs and findings. It doesn't keep a pause: a paused loop normally comes back `active`, so pause it again after the merge if it should stay stopped.

Read it back after the merge: the loop's `definitionSource` is `repo`, and `tessl schedule view <loop id>` shows its `Status:`. From then on, change it through a pull request on `tessl.json`.

While the pull request is open, the loop is still app-defined, and its page shows **View pull request**.

## Cancel a run already in progress

Pausing, deleting, or editing a loop stops future runs only. A run that already started keeps going until it finishes. To stop it, cancel the run itself.

1. Find the runs that are still going. An in-progress run has status `pending`:

   ```bash
   tessl launch list --status pending --workspace <workspace>
   ```

   The list shows 20 runs at a time. When more match, it ends with a hint to repeat the command with `--after <cursor>`; repeat it until no hint appears. The list includes runs from loops you already deleted. To see one loop's newest runs instead, use `tessl schedule runs <loop id>`, which shows 20 unless you pass `--limit`.
2. Check each run before you cancel it. `tessl launch view <run id>` shows its `Repo:` and `Skill:`. Cancel only the runs that belong to the factory you're stopping:

   ```bash
   tessl launch cancel <run id>
   ```

   The command prints `Cancellation requested for launch run: <run id>`. Canceling is asynchronous: the run stops its work and then records itself as `cancelled`.
3. Read it back until the status changes:

   ```bash
   tessl launch view <run id>
   ```

   `Status:` reads `cancelled`. Canceling a run that already finished does nothing, and its status stays as it was.
4. Run the list from step 1 again, with the same options and every page, and confirm none of the factory's runs are still `pending`.

Any member of the run's workspace can cancel it.

## Turn off Code Review

Code Review is a setting on each repository, so pausing a project's loops leaves it reviewing pull requests. Turning it off needs an organization admin:

```bash
tessl code repo update <owner/repo> --org <org> --no-review-enabled
```

Read it back:

```bash
tessl code repo view <owner/repo> --org <org>
```

`Enabled` reads `no` under **Review**. To turn it back on, run the update with `--review-enabled`. For the other review settings, see [Set up Tessl Code Review](/tutorials/setting-up-agentic-code-review.md).

## Stop a whole factory

After a workshop or a trial, stop each part and read it back:

1. List the loops with `tessl schedule list --project-id <project id> --all --json`.
2. Pause every loop whose `status` is `active`. Confirm each one reads `paused`.
3. List every pending run with `tessl launch list --status pending --workspace <workspace>`, following each `--after` hint to the last page. This includes runs from loops deleted earlier. Check each run's `Repo:` and `Skill:` with `tessl launch view`, cancel the ones that belong to the factory, and confirm each reads `cancelled`. Then list the pending runs again to confirm none of the factory's remain.
4. Turn off Code Review on each repository the factory reviews, and confirm `Enabled` reads `no`.

Paused loops keep their configuration, so resuming them later restores the loops as they were. Code Review stays off until you turn it back on with `--review-enabled`. When you're sure you won't need a loop again, delete it if it's app-defined, or remove it from `tessl.json` if it's repo-defined.

## Next steps

- [Automations overview](/automations/overview.md): factories, loops, actions, triggers, and runs.
- [Learn from past work](/automations/learn-from-past-work.md): the loops that record findings and turn them into tickets.
- [Schedules](/schedules/overview.md): the `schedules` block, sync behavior, and safety model.
- [CLI commands](/reference/cli-commands.md#schedules): every `tessl schedule` and `tessl launch` command.
