# Orca CLI contract recheck on 1.4.250

- Issue: #1233; hub task #746.
- Date: 2026-11-06, Asia/Seoul.
- Orca: `orca --version` printed `1.4.250`. The previous receipt is [1.4.245](2026-11-02-orca-1.4.245-cli-contract.md).
- Result: the commands agent-hub reads behave as on 1.4.245, with two additions the code did not handle. A `terminal wait` on a pane whose process ended fails with `terminal_exited`, and a wait held by a prompt answers `satisfied: false` with a `blockedReason`. Both are handled by #1233. Commands that create, close or switch a pane stay **unverified**, as before.

## Why this recheck

The 0.30.0 to 0.32.0 upgrade of this project (operation `3e1bea10`, 2026-11-06 07:16Z) stopped while restoring the codex terminal with `Orca terminal wait failed: exit status 1`. `run()` mapped only `terminal_handle_stale`; any other Orca error became a command error showing only the exit status, and the restoration loop stopped before its launcher check. Orca prints the error code on stdout with an empty stderr, so the code was lost.

## How this was checked

Read-only commands against the person's running Orca, from a script that printed field names, types, counts and error codes, never a value: `orca --version`, `terminal list --json`, `terminal show --terminal <handle> --json`, `terminal wait --terminal <handle> --for tui-idle --timeout-ms 1 --json` on every listed terminal, the same wait and `show` with a made-up handle, and `worktree current --json` in a temporary directory Orca does not manage. A 1 ms wait changes no pane. No handle, tab id, worktree id, host name or path is recorded here.

For the codes a wait can raise, the bundled main process (`Orca.app/Contents/Resources/app.asar`) was read for the throw sites, without running or modifying it.

## Observed on 1.4.250

| Command | Observed | Code impact |
| --- | --- | --- |
| `terminal list --json` | exit 0, `ok: true`; `result` keys `hostScope`, `terminals`, `topologyRevisions`, `totalCount`, `truncated`. 31 rows, `truncated: false`, `totalCount` equal to the row count, handles and incarnations unique. 16 rows carried `agentIdentity` as a string; on the other 15 the key is absent (1.4.245 printed `null`). 8 rows read `orphaned: true, connected: true`. | None. `identityFrom` reads a missing key and `null` alike; the orphaned-and-connected pair is the existing `terminal-orphaned` blocker. |
| `terminal show --terminal <handle> --json` | exit 0, `ok: true`; `result.terminal` holds the list fields plus `agentWait`, `paneRuntimeId` and `rendererGraphEpoch`. | None. |
| `terminal wait ... --for tui-idle --timeout-ms 1 --json` | Of 31 terminals: 14 answered `satisfied: true`; 16 exit 1 with code `timeout`; 1 answered exit 0, `ok: true`, `satisfied: false` with `blockedReason: "agent-update-prompt"`. | New: the blocked answer was reported only as "did not become idle". The `terminal-unready` blocker now names Orca's reason. |
| wait or `show` with a made-up handle | exit 1, `ok: false`, `error` keys `code`, `data`, `message`, code `terminal_handle_stale`, on stdout with nothing on stderr. | Unchanged. |
| `worktree current --json` outside Orca | exit 1, `ok: false`, code `selector_not_found`. | Unchanged. |

## Codes a wait can raise (source read)

| Code | When the main process raises it | Before #1233 | After #1233 |
| --- | --- | --- | --- |
| `timeout` | the condition was not met within `--timeout-ms` | not satisfied | not satisfied |
| `terminal_handle_stale` | the handle names no live pane | `terminal-gone` | `terminal-gone` |
| `terminal_exited` | a `tui-idle` wait on a pane whose process ended | command error, "exit status 1" | `terminal-gone`, "exited (terminal_exited)" |
| `terminal_gone` | the pane has no connected PTY | command error | `terminal-gone`, naming the code |
| `no_connected_pty` | same family as `terminal_gone` | command error | `terminal-gone`, naming the code |
| `request_aborted` | the wait was aborted | command error | command error, naming the code |

Orca's own CLI groups `terminal_handle_stale`, `terminal_exited`, `terminal_gone` and `no_connected_pty` as one "terminal is gone" condition, which #1233 follows. During a restoration, a `terminal-gone` answer sends the loop to the launcher check: a launcher that recorded itself and is gone is `launcher-exited`; with no record, the terminal's listing decides, as for a stale handle. Any other Orca failure now shows `code: message` before falling back to the exit status.

`terminal_exited` was not produced live: it needs a pane whose process ended. It is covered by the source read and by fixture tests in `test/terminal-recovery.test.ts`. Whether the upgrade's codex wait raised exactly this code cannot be shown after the fact, because the code was not recorded; the next failure will name it.

## Unverified, with the reason

| Command or behaviour | Why |
| --- | --- |
| `terminal create`, `terminal close`, `terminal switch` | They create, close or switch a live pane. |
| `terminal_exited`, `terminal_gone`, `no_connected_pty` and `request_aborted` produced live | They need a pane whose process ended, a lost PTY or an aborted request. |
| Other `blockedReason` values | Only `agent-update-prompt` was seen. |
| A `truncated: true` inventory, remote servers, the Linux binary | As in the 1.4.245 receipt. |
