## **Problem** Codex’s TUI uses a single “task running” indicator (spinner + Esc interrupt hint) to communicate “the UI is busy”. In practice, “busy” can mean two different things: an agent turn is running, or MCP servers are still starting up. Without a clear contract, those lifecycles can interfere: startup completion can clear the spinner while a turn is still in progress, or the UI can appear idle while MCP is still booting. This is user-visible confusion during the most important moments (startup and the first turn), so it was worth making the contract explicit and guarding it. ## **Mental model** `ChatWidget` is the UI-side adapter for the `codex_core::protocol` event stream. It receives `EventMsg` events and updates two major UI surfaces: the transcript (history/streaming cells) and the bottom pane (composer + status indicator). The key concept after this change is that the bottom pane’s “task running” indicator is treated as **derived UI-busy state**, not “agent is running”. It is considered active while either: - an agent turn is in progress (`TurnStarted` → completion/abort), or - MCP startup is in progress (`McpStartupUpdate` → `McpStartupComplete`). Those lifecycles are tracked independently, and the bottom-pane indicator is defined as their union. ## **Non-goals** - This does not introduce separate UI indicators for “turn busy” vs “MCP busy”. - This does not change MCP startup behavior, ordering guarantees, or core protocol semantics. - This does not rework unrelated status/header rendering or transcript layout. ## **Tradeoffs** - The “one flag represents multiple lifecycles” approach remains lossy: it preserves correct “busy vs idle” semantics but cannot express *which* kind of busy is happening without further UI changes. - The design keeps complexity low by keeping a single derived boolean, rather than adding a more expressive bottom-pane state machine. That’s chosen because it matches existing UX and minimizes churn while fixing the confusion. ## **Architecture** - `codex-core` owns the actual lifecycles and emits `codex_core::protocol` events. - `ChatWidget` owns the UI interpretation of those lifecycles. It is responsible for keeping the bottom pane’s derived “busy” state consistent with the event stream, and for updating the status header when MCP progress updates arrive. - The bottom pane remains a dumb renderer of the single “task running” flag; it does not learn about MCP or agent turns directly. ## **Observability** - When working: the spinner/Esc hint stays visible during MCP startup and does not disappear mid-turn when `McpStartupComplete` arrives; startup status headers can update without clearing “busy” for an active turn. - When broken: you’ll see the spinner/hint flicker off while output is still streaming, or the UI appears idle while MCP startup status is still changing. ## **Tests** - Adds/strengthens a regression test that asserts MCP startup completion does not clear the “task running” indicator for an active turn (in both `tui` and `tui2` variants). - These tests prove the **contract** (“busy is the union of turn + startup”) at the UI boundary; they do not attempt to validate MCP startup ordering, real-world startup timing, or backend integration behavior. Fixes #7017 Signed-off-by: 2mawi2 <2mawi2@users.noreply.github.com> Co-authored-by: 2mawi2 <2mawi2@users.noreply.github.com> Co-authored-by: Josh McKinney <joshka@openai.com> |
||
|---|---|---|
| .devcontainer | ||
| .github | ||
| .vscode | ||
| codex-cli | ||
| codex-rs | ||
| docs | ||
| patches | ||
| scripts | ||
| sdk/typescript | ||
| shell-tool-mcp | ||
| third_party/wezterm | ||
| .bazelignore | ||
| .bazelrc | ||
| .codespellignore | ||
| .codespellrc | ||
| .gitignore | ||
| .markdownlint-cli2.yaml | ||
| .npmrc | ||
| .prettierignore | ||
| .prettierrc.toml | ||
| AGENTS.md | ||
| announcement_tip.toml | ||
| BUILD.bazel | ||
| CHANGELOG.md | ||
| cliff.toml | ||
| defs.bzl | ||
| flake.lock | ||
| flake.nix | ||
| justfile | ||
| LICENSE | ||
| MODULE.bazel | ||
| MODULE.bazel.lock | ||
| NOTICE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| PNPM.md | ||
| rbe.bzl | ||
| README.md | ||
npm i -g @openai/codex
or brew install --cask codex
Codex CLI is a coding agent from OpenAI that runs locally on your computer.
If you want Codex in your code editor (VS Code, Cursor, Windsurf), install in your IDE.
If you are looking for the cloud-based agent from OpenAI, Codex Web, go to chatgpt.com/codex.
Quickstart
Installing and running Codex CLI
Install globally with your preferred package manager:
# Install using npm
npm install -g @openai/codex
# Install using Homebrew
brew install --cask codex
Then simply run codex to get started.
You can also go to the latest GitHub Release and download the appropriate binary for your platform.
Each GitHub Release contains many executables, but in practice, you likely want one of these:
- macOS
- Apple Silicon/arm64:
codex-aarch64-apple-darwin.tar.gz - x86_64 (older Mac hardware):
codex-x86_64-apple-darwin.tar.gz
- Apple Silicon/arm64:
- Linux
- x86_64:
codex-x86_64-unknown-linux-musl.tar.gz - arm64:
codex-aarch64-unknown-linux-musl.tar.gz
- x86_64:
Each archive contains a single entry with the platform baked into the name (e.g., codex-x86_64-unknown-linux-musl), so you likely want to rename it to codex after extracting it.
Using Codex with your ChatGPT plan
Run codex and select Sign in with ChatGPT. We recommend signing into your ChatGPT account to use Codex as part of your Plus, Pro, Team, Edu, or Enterprise plan. Learn more about what's included in your ChatGPT plan.
You can also use Codex with an API key, but this requires additional setup.
Docs
This repository is licensed under the Apache-2.0 License.