# `ObanCodex.Outcome`
[🔗](https://github.com/genagent/oban_codex/blob/v0.7.1/lib/oban_codex/outcome.ex#L1)

Default mapping from Codex execution outcomes to Oban verdicts.

| Codex outcome | Oban verdict | Why |
|---|---|---|
| `%Result{success: true}` | `:ok` | the worker's `handle_result/2` decides what follows |
| `%Result{exit_code: 126 or 127}` | `{:cancel, :command_unavailable}` | the configured executable cannot run; retrying cannot repair it |
| any other non-zero `%Result{}` | `{:error, {:command_failed, code}}` | bounded retry; Codex has no stable typed CLI-error envelope |
| `%Error{kind: :timeout}` | `{:error, :timeout}` | transient and bounded by `max_attempts` |
| `%Error{kind: :spawn}` | `{:cancel, :spawn}` | deterministic process setup failure |
| `%Error{kind: :unsupported}` | `{:cancel, :unsupported}` | the installed CLI lacks the capability (for example `exec fork`); retrying cannot add it |
| other normalized `%Error{}` | `{:error, kind}` | retry under Oban's normal attempt bound |
| an unnormalized error term | `{:cancel, term}` | off-contract and unsafe to retry blindly |

The classifier returns an envelope, `{oban_return, payload}`. The worker
unwraps the first element for Oban while preserving the payload for
`handle_result/2` or `handle_error/3`.

Override `:classifier` when your deployment can classify Codex's human-readable
non-zero output more precisely (for example, distinguishing an expired login
from a temporary provider outage).

# `classify`

```elixir
@spec classify(ObanCodex.wrapper_outcome()) ::
  {ObanCodex.oban_return(),
   CodexWrapper.Result.t() | ObanCodex.Error.t() | term()}
```

Map a query outcome to the `{oban_return, payload}` envelope.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
