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

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Inspect signal outcomes

> Convert signal success, failure, and closure into values and recovery paths.

A signal terminates exactly once by succeeding with a value, failing, or closing without a value. These states are mutually exclusive.

## `outcome()`

`outcome(signal)` converts every terminal state into an ordinary tagged value:

```ts theme={null}
import { outcome } from "automate.ax"

const resultOutcome = outcome(result)
// Signal<
//   | { status: "succeeded"; value: Result }
//   | { status: "failed"; failure: SignalFailure }
//   | { status: "closed" }
// >
```

The returned signal always succeeds after the source terminates.

| Source outcome | `outcome`      | `succeeded` | `failed` | `closed` | `onSuccess`  | `onFailure`   | `onClose` |
| -------------- | -------------- | ----------- | -------- | -------- | ------------ | ------------- | --------- |
| Succeeded      | Tagged value   | `true`      | `false`  | `false`  | Source value | Closes        | Closes    |
| Failed         | Tagged failure | `false`     | `true`   | `false`  | Closes       | Failure value | Closes    |
| Closed         | Tagged closure | `false`     | `false`  | `true`   | Closes       | Closes        | `null`    |

## `succeeded()`

`succeeded(signal)` emits whether the source succeeded after it terminates.

## `failed()`

`failed(signal)` emits whether the source failed after it terminates.

## `closed()`

`closed(signal)` emits whether the source closed without a value after it terminates. Failure is not closure.

## `onSuccess()`

`onSuccess(signal)` emits the successful source value and closes for failure or closure. Unlike consuming the source directly, it suppresses failure. It preserves a keyed or global source partition.

## `onFailure()`

`onFailure(signal)` emits `{ name, message }` when the source fails and closes for success or closure.

```ts theme={null}
import { onFailure, scope } from "automate.ax"

const failure = onFailure(result)

scope(failure, () => {
  sendEmail({ subject: "Action failed", text: failure.message })
})
```

## `onClose()`

`onClose(signal)` emits `null` when the source closes and closes for success or failure.

Use [routing and scopes](/reference/signals/route-and-scope) to declare recovery work under a selective outcome. Use [`fallback`](/reference/signals/select-and-time#fallback) when closure should advance to another value but failure should remain selected.
