Development Workflow
If you’ve been invited by a Codex team member to contribute a PR, follow this recommended workflow:Keep Changes Focused
Multiple unrelated fixes should be opened as separate PRs. Focus on one problem at a time.
Ensure Quality
Before pushing, ensure your change is free of:
- Lint warnings
- Test failures
- Type errors (TypeScript)
Guidance for Invited Code Contributions
1. Start with an Issue
Open a new issue or comment on an existing discussion to agree on the solution before writing code.
2. Add or Update Tests
Bug fixes should come with test coverage that fails before your change and passes afterwards. Aim for meaningful assertions.
3. Document Behavior
If your change affects user-facing behavior, update the README, inline help (
codex --help), or relevant example projects.4. Keep Commits Atomic
Each commit should compile and tests should pass. This makes reviews and potential rollbacks easier.
Rust Code Conventions
General Rules
Crate naming
Crate naming
Crate names are prefixed with
codex-. For example, the core folder’s crate is named codex-core.Formatting and linting
Formatting and linting
- Always run
just fmtafter making Rust code changes - Run
just fix -p <crate>to fix linter issues before finalizing changes - Do not re-run tests after running
fixorfmt
Control flow
Control flow
- Always collapse if statements per clippy::collapsible_if
- When possible, make
matchstatements exhaustive and avoid wildcard arms
String formatting
String formatting
- Always inline format! args when possible per clippy::uninlined_format_args
- Use method references over closures per clippy::redundant_closure_for_method_calls
Helper methods
Helper methods
Do not create small helper methods that are referenced only once. Keep code inline for clarity.
TUI Code Conventions
For the terminal user interface (codex-tui), follow these ratatui styling conventions:
Text Wrapping
- Always use
textwrap::wrapto wrap plain strings - For ratatui
Linewrapping, use helpers intui/src/wrapping.rs(e.g.,word_wrap_lines,word_wrap_line) - Use
initial_indent/subsequent_indentoptions fromRtOptionsfor indenting wrapped lines - Use
prefix_lineshelper fromline_utilsfor prefixing lines
TypeScript Code Conventions
Code Quality Tools
- Vitest for unit tests
- ESLint for linting
- Prettier for code formatting
- TypeScript for type checking
Before Pushing
Opening a Pull Request
Fill in the PR Template
Include:
- What? - What does this PR change?
- Why? - Why is this change necessary?
- How? - How does it work?
- Link to the bug report or enhancement request
Model Metadata Updates
When updating model catalogs or model metadata (/models payloads, presets, or fixtures):
- Set
input_modalitiesexplicitly for any model that does not support images - Keep compatibility defaults in mind: omitted
input_modalitiescurrently implies text + image support - Ensure client surfaces that accept images (e.g., TUI paste/attach) consume the same capability signal
- Add/update tests that cover unsupported-image behavior and warning paths
App-Server API Development
When working on app-server protocol incodex-rs:
Core Rules
v2 Development
All active API development should happen in app-server v2. Do not add new API surface area to v1.
Payload Naming
*Paramsfor request payloads*Responsefor responses*Notificationfor notifications
RPC Methods
Expose as
<resource>/<method> with singular <resource> (e.g., thread/read, app/list)Field Casing
Use camelCase on the wire with
#[serde(rename_all = "camelCase")]Development Workflow
Review Process
Scope Verification
If your invited PR introduces scope or behavior that was not previously discussed and approved, the PR may be closed.
Requested Changes
We may ask for changes. Please do not take this personally. We value the work, but also value consistency and long-term maintainability.
Contributor License Agreement (CLA)
The process is lightweight:
No special Git commands, email attachments, or commit footers required.
Configuration Changes
If you changeConfigToml or nested config types:
codex-rs/core/config.schema.json.
Dependency Changes
If you change Rust dependencies (Cargo.toml or Cargo.lock):
Community Values
Be Kind and Inclusive
Treat others with respect. We follow the Contributor Covenant.
Assume Good Intent
Written communication is hard - err on the side of generosity.
Teach & Learn
If you spot something confusing, open an issue or discussion with suggestions or clarifications.
Getting Help
If you run into problems:- Open a Discussion topic
- Jump into the relevant issue
- Ask in community channels
Security & Responsible AI
Next Steps
Setup
Set up your development environment
Building
Learn how to build the project
Testing
Run tests to validate changes