Source Map
Each pointer targets Codex CLI 0.172.0. Start with a question and read the referenced function, then look at its callers or tests. For confidence limits and open checks, see what the evidence leaves open.
| Question | Where to start |
|---|---|
| How does a client start a turn? | App Server assembles a TurnInputRequest and calls start_or_steer_turn. Turn processor |
| What happens when a user steers an active turn? | App Server forwards the expected turn ID. Core checks it before queuing the new input. Steering walkthrough |
| Where does the prompt come from? | build_prompt takes history items and populates the model input, with tool declarations and base instructions handled according to the active mode. Prompt construction |
| How do tool declarations change? | The incremental path compares tool definitions with its previous catalog and emits changed declarations. Catalog diff · Prompt walkthrough |
| How does streamed text become a client item? | The core delta emitter attaches thread, turn, and item IDs. The non-tool output handler finalizes and records the completed response item. Delta emitter · Streaming walkthrough |
| Where is a model tool call decoded? | ToolRouter::build_tool_call turns a model response into the harness’s call representation. Router |
| Where does a tool result enter history? | drain_in_flight collects output items and records them in the conversation. Result recording |
| How does a rejected call reach the model? | The direct runtime converts a nonfatal tool error into an output item keyed by the original call ID. Failure output · Failure walkthrough |
| Where do compaction and restart fit? | Start with the turn’s pre-sampling compaction check, then read how a context manager replays stored rollout items. Compaction check · History replay |
| How does local memory reach a new request? | The extension checks the thread’s memory configuration, reads the selected summary, and contributes developer fragments. Read path · Session History and Memory |
| How does a v1 subagent report completion? | The spawn path registers a status watcher. The watcher uses the child’s terminal status to construct a notification and inject it into the parent thread. Watcher registration · Parent notification |
| Where does a model-driven MCP call go? | The MCP handler binds the call to a server and wraps the result for the runtime. MCP handler · MCP guide |
| Where can I see an end-to-end assertion? | The tool harness fixture reads the second model request and looks for a command result under the original call ID. Tool harness test |
Read One Turn, One Tool Call for the tool path, Context Compaction and Resume for checkpoint replay, and Subagent Handoffs for parent–child result delivery.
Run the upstream fixtures
Section titled “Run the upstream fixtures”Check out the pinned Codex revision and use the Rust toolchain specified there. From its codex-rs directory, run a test filter from the table. The --nocapture flag exposes skip messages. These mock-provider fixtures need local networking. Pinned toolchain · Integration test target · Network skip guard
cargo test --locked -p codex-core --test all exec_command_tool_executes_command_and_streams_output -- --nocaptureA reproduction passes when Cargo selects the intended test, the harness reports it passed, and the output contains no skip message. For the command above, look for the named test and 1 passed. 0 tests means the filter matched nothing. The network guard prints a skip message and can return success before executing the assertions. Some filters in the table match multiple parameterized cases. Skip guard
| Chapter | Filter | Observe |
|---|---|---|
| One Turn, One Tool Call | exec_command_tool_executes_command_and_streams_output |
The original call ID, process exit status, and output in request two. |
| Prompt Construction and Tool Declarations | incremental_tools_append_changed_catalog_without_rewriting_history |
Prefix preservation, the changed tool definition, and the renewed instructions after compaction. |
| Model Requests and Streaming | agent_message_content_delta_has_item_metadata |
Thread, turn, and item identity on the text delta, and the same item ID at completion. |
| Tool Failures and Continuation | update_plan_tool_rejects_malformed_payload |
The parse error in request two and no checklist update event. |
| Pre-tool denial | pre_tool_use_json_deny_blocks_exec_command_before_execution |
No repository marker and a denial in the second request. |
| Post-tool output | post_tool_use_block_decision_replaces_exec_command_output_with_reason |
The hook sees stdout and the provider receives the hook reason. |
| Transport recovery | websocket_fallback_is_sticky_across_turns |
Four upgrade attempts and two HTTP POSTs over two scripted turns. |
| Context Compaction and Resume | compact_resume_and_fork_preserve_model_history_view |
The normalized input prefix after legacy reopening and forking. |
| Paginated compaction | paginated_compaction_cold_resume_from_bounded_suffix |
The loaded suffix begins with session metadata and the compaction checkpoint. The later request preserves the replacement-history prefix. |
| Subagent Handoffs | subagent_notification_is_included_without_wait |
The notification marker in the parent rollout and its content kind in at least one request during the parent’s follow-up turn. |
| V2 Peer Follow-up | multi_agent_v2_peer_followup_completion_notifies_initiating_turn |
In the live case, the worker’s request, the initiating sibling’s completion event, and the result in a later root request. This filter also selects the reloaded_sleep case. |
The Rust fixtures are source inspected. Three CLI probes executed against 0.172.0 check successful command output, checklist validation errors, and seeded memory injection. See the runnable probes. Other CLI checks in the user guides cover project config and skill discovery and MCP registration, discovery, and a direct call.
The memory contribution fixture is a unit test in a separate crate. It seeds a v1 summary and checks that the developer-policy fragment contains a known sentence. Use the same pass criteria. Memory fixture
cargo test --locked -p codex-memories-extension --lib prompt_contribution_uses_memory_summary_when_enabled -- --nocaptureRun the App Server steering fixture
Section titled “Run the App Server steering fixture”From the pinned checkout’s codex-rs directory, use the same local-networking setup as the core fixtures. Both test cases check the returned turn ID, the user-message notification, and the captured provider input. The fixture has a host-local command and may skip a remote executor. Fixture setup
cargo test --locked -p codex-app-server --test all turn_steer_returns_active_turn_id -- --nocaptureUse the same codex-app-server command with these filters for the related checks. The approval pair uses two separate test names.
| Filter | Observable outcome |
|---|---|
turn_start_exec_approval_decline_v2 |
Command status is Declined and a provider request contains the rejection reason. |
turn_start_exec_approval_invalid_response_v2 |
Command status is Failed and the provider receives the approval failure text. |
turn_interrupt_resolves_pending_command_approval_request |
The client sees the approval request resolved and the turn interrupted. Trace replay records the aborted tool call. |
What the evidence leaves open
Section titled “What the evidence leaves open”| Area | What we can check today | Open question or stronger check |
|---|---|---|
| Memory | A pinned CLI probe checks that use_memories toggles a seeded summary marker in the provider’s developer input. |
Automatic memory creation and useful model recall each need their own outcome. Measure generated artifacts first, then score recall on fresh prompts. |
| Compaction | Upstream assertions cover prefix preservation and, in a separate fixture, the shape of the paginated suffix. | Measure I/O and latency separately. Test summary quality by scoring whether task facts survive. |
| V2 delegation | The peer fixture explicitly checks who receives the activity event and who gets the result. | In the live worker request, check that one item contains the task and both agent paths, and tie its parent turn ID directly to the requester. |
| Steering and streaming | Fixtures check accepted steering input, interruption during approval, item identity on a successful stream, and aggregate fallback attempt counts. | Measure how quickly a client reflects interruption, and correlate each reconnect with a timestamped server attempt. |
The handbook studies the public harness. Private inference, model weights, and hosted serving internals are outside its source evidence. See the roadmap for public implementation work still to cover.
Choose the right evidence
Section titled “Choose the right evidence”Use a client event to check what the client displays, a captured provider request to check model input, and source inspection to explain the path between them. A scripted fixture can establish a harness contract for its inputs. For a model-behavior claim, define a separate observable outcome and report the model and experiment conditions. Research Lab