# TUI Escape: cancel inference and wait for input

Status: implementation verified in the isolated combined package; ready for scoped delivery by the parent task.

The operator requires Escape to pause Omnius, keep the editor usable, retain completed work and queued instructions, and wait for explicit new input. Repeated Escape must remain paused. Initial routing and background root submissions must not restart work behind the paused interface. Ctrl+C and `/stop` retain permanent stop semantics; ordinary updater and daemon safe-boundary pause remains available.

## Source comparison

The official [Codex CLI source](https://github.com/openai/codex/tree/1b6e0d8145e1fe5b2663d32fbe7ee02f51a10e1c) was cloned and inspected directly, without web search. Its active-turn interrupt cancels a task token, permits 100 ms of cooperative cleanup, aborts an uncooperative task, preserves interrupted history, and restores input. Relevant sources are `codex-rs/core/src/tasks/mod.rs`, `core/src/session/turn.rs`, `core/src/client_common.rs`, and `tui/src/chatwidget/input_restore.rs`. Codex also has a distinct queued-steer submission path; Omnius's requested Escape behavior deliberately retains queued instructions until the operator submits input.

Omnius previously left an active model request running to its returned-contract boundary, promoted queued steering on Escape, aborted on a second Escape, and could not interrupt initial routing after its recall window. New input submitted while lifecycle acknowledgement was still `pausing` attempted an invalid immediate resume and displayed processing anyway.

## Implemented behavior

- `AgenticRunner.pauseForInput()` closes admission, cancels operation-scoped model signals, fences uncooperative late results and stream chunks, and retains the durable task, tool receipts and conversation. Unfinished model contracts are discarded; resumed inference uses a new logical generation.
- `resumeAfterInput()` waits for exact active owners to acknowledge. A newer Escape supersedes a pending resume, and unresolved external effects still prevent resumption. Atomic tool work is allowed to reach its truthful boundary; cancellation does not fabricate absent effects.
- A small terminal-owned controller cancels and fences intake routing and repair requests. Escape remains idempotent, automatic root submissions stay queued, blank Enter remains paused, and explicit input or `/resume` releases the hold after acknowledgement. Independent Telegram runners and host services are unchanged.
- Interrupted presentation stops timers and discards unrendered partial tails without synthesizing a successful stream terminator. The displayed inference block becomes paused. Duplicate pending resume results cannot overwrite the first successful resume's processing state.

## Verification

The parent repeated the final suites in an isolated checkout: 238 tests passed, comprising 130 orchestrator tests and 108 CLI tests. They cover existing safe-boundary pause/stop/recovery, lifecycle and context-capacity behavior, unread-source transport, actual production Escape/queue/resume closures, real DirectInput, router repair cancellation, interrupted rendering and timer cleanup. The new transport regression uses the actual production inference adapter against an exact loopback HTTP fixture: both unary and SSE sockets close on Escape, no retry or fallback starts while held, and explicit resume generates a fresh request. Late uncooperative tool contracts and iterators cannot commit, completed reads and new input remain visible, and ambiguous external effects retain their resume fence.

The full isolated recursive build, tarball audit (591 files, zero warnings), and fresh global npm install pass. The required SQLite prebuild loads without a native compiler. Combined runtime bundle SHA-256: `82bcf42836e77699e8c660349a99325a858fd723cb857951ccae406e43b15886`. The isolated package has not been published.

No live model inference, CUDA workload, host-service change, Telegram send or active-session restart was used for these checks. HTTP cancellation cannot guarantee that an arbitrary upstream provider stops its physical compute; Omnius closes its transport and rejects late results. No GPU unload or server-side cancellation guarantee is claimed.

The parent built and verified the isolated final package and delivers the scoped Escape commit separately from source-capacity recovery. The operator owns publication and active-runtime reload. The previous GNOME Terminal SIGSEGV is a separately evidenced host crash; this work does not claim to repair GTK or GPU hardware.
