Open Studio
system breakdown

Inside OpenAI Codex: TUI, App Server, and Execution Boundaries

A commit-pinned examination of the documented Codex rich-client protocol, terminal event loop, approval exchange, and platform sandbox boundary.

FullStack AI Hub Editorial14 min readPublished 18 Jul 20263 primary sources
Inside OpenAI Codex: TUI, App Server, and Execution Boundaries

Evidence boundary

This breakdown describes release rust-v0.95.0 at commit 12dbb76c812afaff8daf1f3a5acf1d5ef4a75cb1. It intentionally does not infer a hidden daemon database, universal build pipeline, mandatory module-size rule, or automatic workspace-context collection. Those claims were not supported by the pinned sources.

Missing evidence claim: app-server-protocol

Architecture at a glance

Rich client
Initialize app-server
Start or resume thread
Start turn
Stream item lifecycle
Render and control
Conceptual teaching model synthesized from:lesson evidence registry

The app-server documentation defines a bidirectional JSON-RPC protocol transported as streaming JSONL. Its public mental model is a thread containing turns, with each turn producing items and lifecycle notifications. That boundary is useful because it lets clients render incremental progress without coupling the article to undocumented internal ownership.

Missing evidence claim: tui-event-loop

Terminal event flow

The pinned TUI application receives terminal events and application events, handles Codex execution events, updates interface state, and renders the active chat widget into a terminal frame. The interactive inspector separates this verified source behavior from compressed arrows that are explicitly labeled as inferred.

Approval and sandboxing

Missing evidence claim: sandbox-boundary

The app-server protocol documents server-initiated approval requests for consequential actions. The repository also contains platform-specific sandbox implementations. The inspector presents their combined role as a conceptual control model, not as a claim that one undocumented function directly owns the entire sequence.

Alternatives and trade-offs

| Boundary | Benefit | Cost or risk | |---|---|---| | JSON-RPC app-server | Version-specific schemas and incremental events for rich clients | Clients must implement initialization, cancellation, approvals, and item state correctly | | Terminal TUI | Direct keyboard-driven workflow and visible execution state | High-frequency event and render paths require careful state coordination | | Platform sandbox | Limits command capabilities according to policy and OS support | Isolation semantics and setup differ across operating systems |

Failure modes

  • Treating an inferred diagram edge as a named runtime component.
  • Assuming every client uses the app-server in the same process topology.
  • Equating approval with containment; an approved command still needs an appropriate execution boundary.
  • Generalizing one platform sandbox implementation to every supported operating system.
  • Reading the current repository branch while claiming behavior for this pinned release.
Reflect before revealing the guide

Why should the app-server protocol, approval exchange, and platform sandbox be documented as separate boundaries?

Architectural takeaway

Codex is best understood through its public protocols and source-backed control boundaries. A reliable architecture explanation pins a release, traces named interfaces, and marks every compression or teaching abstraction instead of filling unknowns with plausible internals.

Continue Reading

All Blog Posts