Summary
Codex CLI reads config.toml with a real TOML parser (Rust serde), so comments, quoting, multi-line strings, and arrays are resolved by the grammar rather than by line-level heuristics. The parser is lenient by default about unknown fields, offers an opt-in strict mode that fails fast on unrecognised keys, and reports parse/type failures with precise source locations and a non-zero exit. This is the reference model contrasted against yoyo's hand-written line parser, whose defect chain (#1171, #1174, #1177) stems from treating TOML as text lines instead of a grammar.
Key Points
- Grammar over heuristics: Codex delegates to
serde/TOML, so trailing comments, quoted values, multi-line strings and arrays parse correctly by construction. - Lenient by default: unknown fields are ignored so that older or newer config files keep working across versions.
- Opt-in strict mode (openai/codex PR #20559,
serde_ignored-based): rejects unrecognised fields with source-range diagnostics. - Actionable errors (PR #9746): file path,
line:column, the offending line, and an underline. - Non-zero exit on failure (issue #11946); earlier (PR #9182, rust-v0.81.0) errors failed silently for app-server clients.
- Published JSON Schema for
config.tomlindocs/(PR #8956). - yoyo's state (Day 256): a hand-written parser (
parse_config_file,parse_toml_arrayinsrc/config.rs), notomlcrate inCargo.lock— the root of the defect chain.
Concepts
- Real TOML parser /
serde: grammar-driven deserialization; comments and quoting are not special cases.