Human TL;DR - in some situations, pasting/rapidly inputting text will currently cause `?` characters to be stripped from the input message content, and display the key bindings helper. For instance, writing "Where is X defined? Can we do Y?" results in "Where is X defined Can we do Y" being added to the message draft area. This is mildly annoying. The fix was a simple one line addition. Added a test, ran linters, and all looks good to me. I didn't create an issue to link to in this PR - I had submitted this bug as a report a while ago but can't seem to find it now. Let me know if it's an absolute must for the PR to be accepted. I have read the CLA Document and I hereby sign the CLA Below is Codex's summary. --- # `?` characters toggling shortcuts / being dropped ## Symptom On Termux (and potentially other terminal environments), composing text in the native input field and sending it to the TTY can cause: - The shortcuts overlay to appear (as if `?` was pressed on an empty prompt), and - All of the literal `?` characters in the text to be **missing** from the composer input, even when `?` is not the first character. This typically happens when the composer was previously empty and the terminal delivers the text as a rapid sequence of key events rather than a single bracketed paste event. ## Root cause The TUI has two relevant behaviors: 1. **Shortcut toggle on `?` when empty** - `ChatComposer::handle_shortcut_overlay_key` treats a plain `?` press as a toggle between the shortcut summary and the full shortcut overlay, but only when the composer is empty. - When it toggles, it consumes the key event (so `?` is *not* inserted into the text input). 2. **“Paste burst” buffering for fast key streams** - The TUI uses a heuristic to detect “paste-like” input bursts even when the terminal doesn’t send an explicit paste event. - During that burst detection, characters can be buffered (and the text area can remain empty temporarily) while the system decides whether to treat the stream as paste-like input. In Termux’s “send composed text all at once” mode, the input often arrives as a very fast stream of `KeyCode::Char(...)` events. While that stream is being buffered as a burst, the visible textarea can still be empty. If a `?` arrives during this window, it matches “empty composer” and is interpreted as “toggle shortcuts” instead of “insert literal `?`”, so the `?` is dropped. ## Fix Make the `?` toggle conditional on not being in any paste-burst transient state. Implementation: - `ChatComposer::handle_shortcut_overlay_key` now checks `!self.is_in_paste_burst()` in addition to `self.is_empty()` before toggling. - This ensures that when input is arriving as a fast burst (including the “pending first char” case), `?` is treated as normal text input rather than a UI toggle. ## Test coverage Added a test that simulates a Termux-like fast stream: - Sends `h i ? t h e r e` as immediate successive `KeyEvent::Char` events (no delays). - Asserts that a paste burst is active and the textarea is still empty while buffering. - Flushes the burst and verifies: - The final text contains the literal `?` (`"hi?there"`), and - The footer mode is not `ShortcutOverlay`. ## Notes This fix intentionally keeps the existing UX: - `?` still toggles shortcuts when the composer is genuinely empty and the user is not in the middle of entering text. - `?` typed while composing content (including IME/native-input fast streams) remains literal. |
||
|---|---|---|
| .devcontainer | ||
| .github | ||
| .vscode | ||
| codex-cli | ||
| codex-rs | ||
| docs | ||
| scripts | ||
| sdk/typescript | ||
| shell-tool-mcp | ||
| third_party/wezterm | ||
| .codespellignore | ||
| .codespellrc | ||
| .gitignore | ||
| .npmrc | ||
| .prettierignore | ||
| .prettierrc.toml | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| cliff.toml | ||
| flake.lock | ||
| flake.nix | ||
| justfile | ||
| LICENSE | ||
| NOTICE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| PNPM.md | ||
| 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. If you use npm:
npm install -g @openai/codex
Alternatively, if you use Homebrew:
brew install --cask codex
Then simply run codex to get started:
codex
If you're running into upgrade issues with Homebrew, see the FAQ entry on brew upgrade codex.
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. If you previously used an API key for usage-based billing, see the migration steps. If you're having trouble with login, please comment on this issue.
Model Context Protocol (MCP)
Codex can access MCP servers. To configure them, refer to the config docs.
Configuration
Codex CLI supports a rich set of configuration options, with preferences stored in ~/.codex/config.toml. For full configuration options, see Configuration.
Execpolicy
See the Execpolicy quickstart to set up rules that govern what commands Codex can execute.
Docs & FAQ
- Getting started
- Configuration
- Sandbox & approvals
- Execpolicy quickstart
- Authentication
- Automating Codex
- Advanced
- Zero data retention (ZDR)
- Contributing
- Install & build
- FAQ
- Open source fund
License
This repository is licensed under the Apache-2.0 License.