One turn through Codex CLI
architecture node:
User input:
Representation at this boundary
Source modules
Loop map
One pass — TUI keypress → app-server
turn/start → Op::TurnInput → core: spawn_task → run_turn → prompt build → /responses stream → tool futures gated by approvals → loop or stop. Three loops nest: RegularTask::run → run_turn → sampler retry + stream consumer.Approval pause — step 11 is a center step, not a branch: the turn loop parks in
drain_in_flight until the approval decision lands, because approvals gate individual tool futures rather than re-prompting the model. Denials become failure tool results, not loop breaks.Outer turn loop — no
max_turns anywhere in the tree (VERIFIED negative across 154 crates): the loop is condition-driven — needs_follow_up ? continue : break. Mid-stream steering preempts via the input queue; events stream back over app-server; the next user message re-enters at step 1.