Frontend session startup and user-facing initialization
This stage happens after the backend services are ready, but before the user can really start working. It is where Codex turns its prepared engine into something a person or script can use.
For the interactive terminal app, the TUI startup path opens the front door. It loads settings, connects to the app server, guides first-time users through sign-in and trust choices, checks project setup, and builds or resumes the visible chat. It also takes careful control of the terminal window: drawing the interface, reading keys, handling resize and suspend, showing notifications, and restoring the shell when finished.
For non-interactive use, exec mode starts a single scripted session instead of a full screen app. It gathers the prompt, configuration, saved session details, or review request, then runs once and writes predictable output, such as JSON lines for other programs to read. The resume helper makes sure an old conversation restarts with the right folder and model. Together, these parts make Codex ready for either a human at a terminal or an automation script.
Sub-stages
State registers touched23
reg-effective-configThe final set of settings Codex runs with after combining files, policies, profiles, cloud settings, thread overrides, and command-line flags.reg-feature-flagsThe shared list of enabled or disabled experimental and product features that changes what the app exposes.reg-install-home-contextThe discovered Codex home folder, install location, bundled resources, and stable local installation identity.reg-shell-workspace-environmentThe current machine, shell, PATH, working directory, project root, Git state, and environment variables used to make commands behave like the user’s terminal.reg-auth-identityThe signed-in user or service identity, including account facts such as email, plan, workspace, and login mode.reg-credential-storeThe saved tokens, API keys, OAuth credentials, MCP tokens, and other secrets used to authenticate later requests.reg-rate-limit-quotaThe current account limits, credit status, token usage, and reset information used to avoid overusing backend services.reg-state-databasesThe opened local SQLite stores and migration state that hold structured runtime data for threads, agents, goals, jobs, and summaries.reg-rollout-thread-storeThe durable conversation log and searchable thread index used to resume, rebuild, archive, restore, and display sessions.reg-cloud-config-cacheThe cached and refreshed cloud-delivered configuration bundles that can alter settings, requirements, and available features.reg-model-provider-catalogThe combined menu of usable model providers and models from bundled data, cache, live services, local servers, and account access.reg-app-server-runtimeThe live app-server or daemon state, including open transports, connected clients, request routing, and server lifecycle status.reg-permission-sandbox-policyThe shared rules for file access, command execution, network access, approvals, and sandbox modes.reg-plugin-marketplace-catalogThe installed, built-in, workspace, and marketplace plugin information that controls extra tools, hooks, connectors, and prompt additions.reg-live-session-servicesThe toolbox attached to one running session, such as model access, auth, telemetry, approvals, tools, extensions, networking, and MCP connections.reg-thread-session-stateThe live state of a conversation thread, including its identity, workspace, selected model, history, permissions, listeners, and lifecycle status.reg-conversation-history-budgetThe accumulated messages, compacted summaries, token counts, and trimming decisions that determine what conversation context still fits.reg-tui-visible-stateThe current terminal user-interface state, including visible transcript cells, inputs, popups, keymaps, headers, status lines, notifications, and restored history.reg-cloud-task-stateCloud task lists, task details, submission attempts, selected task environments, and polling/refresh status shared by cloud task commands and clients.reg-terminal-runtime-stateLive terminal control state such as raw mode, alternate screen ownership, resize/suspend handling, input streams, and restoration obligations.reg-collaboration-mode-catalogBuilt-in and configured collaboration-mode presets/templates that clients can list and apply to choose model, mode, reasoning, and prompt behavior.reg-launch-invocation-contextThe raw launch context, including invoked binary/arg0, selected subcommand or runtime mode, startup flags, and output/interaction mode chosen before dispatch.reg-project-trust-storePersisted and effective trust decisions for workspaces/projects that influence onboarding, permission assembly, sandbox behavior, and session startup.