Files
codex/docs/config.md
Eugene Brevdo dbaf411b93 Add external approval handler support
Add config-driven external approval handling in core, surface handler failures in the TUI, and share thread labels across core and TUI.

Check in the macOS approval dialog helper under scripts/, document the config path, and fix handler stdin delivery by dropping the child stdin handle after writes so EOF reaches the helper promptly.

Co-authored-by: Codex <noreply@openai.com>
2026-03-03 19:35:30 -08:00

75 lines
3.0 KiB
Markdown

# Configuration
For basic configuration instructions, see [this documentation](https://developers.openai.com/codex/config-basic).
For advanced configuration instructions, see [this documentation](https://developers.openai.com/codex/config-advanced).
For a full configuration reference, see [this documentation](https://developers.openai.com/codex/config-reference).
## Connecting to MCP servers
Codex can connect to MCP servers configured in `~/.codex/config.toml`. See the configuration reference for the latest MCP server options:
- https://developers.openai.com/codex/config-reference
## Apps (Connectors)
Use `$` in the composer to insert a ChatGPT connector; the popover lists accessible
apps. The `/apps` command lists available and installed apps. Connected apps appear first
and are labeled as connected; others are marked as can be installed.
## Notify
Codex can run a notification hook when the agent finishes a turn. See the configuration reference for the latest notification settings:
- https://developers.openai.com/codex/config-reference
When Codex knows which client started the turn, the legacy notify JSON payload also includes a top-level `client` field. The TUI reports `codex-tui`, and the app server reports the `clientInfo.name` value from `initialize`.
## Approval handler
Codex can delegate exec, patch, and MCP elicitation approvals to an external
command via `[approval_handler]` in `config.toml`.
Example:
```toml
[approval_handler]
command = ["python3", "/path/to/codex/scripts/macos_approval_dialog.py"]
timeout_ms = 300000
on_error = "fallback"
```
Codex writes each approval request as JSON to the handler's stdin and expects a
single approval `Op` JSON object on stdout. The request payload includes
`thread_id` and, when available, `thread_label`. `thread_label` is optional and
should be treated as best-effort metadata.
On macOS, this repository includes a native approval helper at
[`scripts/macos_approval_dialog.py`](../scripts/macos_approval_dialog.py).
## JSON Schema
The generated JSON Schema for `config.toml` lives at `codex-rs/core/config.schema.json`.
## SQLite State DB
Codex stores the SQLite-backed state DB under `sqlite_home` (config key) or the
`CODEX_SQLITE_HOME` environment variable. When unset, WorkspaceWrite sandbox
sessions default to a temp directory; other modes default to `CODEX_HOME`.
## Notices
Codex stores "do not show again" flags for some UI prompts under the `[notice]` table.
## Plan mode defaults
`plan_mode_reasoning_effort` lets you set a Plan-mode-specific default reasoning
effort override. When unset, Plan mode uses the built-in Plan preset default
(currently `medium`). When explicitly set (including `none`), it overrides the
Plan preset. The string value `none` means "no reasoning" (an explicit Plan
override), not "inherit the global default". There is currently no separate
config value for "follow the global default in Plan mode".
Ctrl+C/Ctrl+D quitting uses a ~1 second double-press hint (`ctrl + c again to quit`).