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

# Jobs and safety

> Manage long-running work, protected changes, cancellation, and undo.

## Start work without waiting

The long-running commands `site-create`, `say`, `build-site`, and `convert-theme` accept `--no-wait`.

```bash theme={"dark"}
miles build-site --design 2 --no-wait --json
```

This starts work and returns a handle with `ok`, `status: "streaming"`, `siteId`, `conversationId`, and suggested next actions. It requires a Miles service that supports cancellation.

Use `--no-wait` when the agent needs to poll or keep its own progress interface active. Otherwise, the command streams progress and waits by default.

## `miles wait-job`

```bash theme={"dark"}
miles wait-job [--timeout <seconds>] [--json]
```

Waits for the active run and returns one structured settled result. Progress is written to standard error; the JSON result is written to standard output. The default timeout is 600 seconds.

Key result fields are:

| Field                                           | Meaning                                                                                    |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `outcome`                                       | `completed`, `blocked`, `declined`, `aborted`, `need_connection`, `capacity`, or `failed`. |
| `question`                                      | An ordinary Miles question that the agent should relay.                                    |
| `brief`                                         | A brief ready for user review.                                                             |
| `approvalRequired`                              | A protected change that needs a specific user decision.                                    |
| `directions`                                    | Design directions returned by the settled turn.                                            |
| `errorId`, `error`, `recovery`, `sessionMemory` | Information for recovery rather than blind retrying.                                       |

If the timeout expires, the result remains `status: "running"`. Run `wait-job` again or cancel the work.

## `miles cancel`

```bash theme={"dark"}
miles cancel [--json]
```

Stops the active run. The later `wait-job` result will report `outcome: "aborted"`. Cancel when the user changes their mind; do not silently cancel useful work or start a replacement build before the first run has settled.

## Protected changes

```bash theme={"dark"}
miles approval-respond --grant <id> --response approved|declined [--json]
```

When `approvalRequired` is present, the protected work has not happened. Tell the user what Miles wants to do and wait for an explicit answer to that specific change. Only then call `approval-respond`.

Do not use `say`, `--yes`, `--force`, or a generic “continue” to answer an approval. A declined approval ends that branch of work.

## `miles undo`

```bash theme={"dark"}
miles undo [--json]
```

Reverts the most recent eligible site turn and its matching conversation messages. The JSON result includes `ok`, `kind`, `snapshotVersion`, `truncatedMessages`, and `browserRefreshRequired`.

Undo is one level only and has no redo. Check `site-state` for `undoAvailable` first. For a broad experiment, use `site-attach --duplicate` before the change instead.

Next: [WordPress and browser connection](/reference/miles-cli/wordpress-and-browser).
