Summary
yoyo's hand-written, line-by-line TOML config reader is being replaced (issue #1184, filed 2026-11-12) with the toml crate using serde-derived typed structs for reads and toml_edit for writes. The change is motivated less by parsing correctness in the abstract than by two concrete failures that a real parser prevents: opaque, silent config errors, and silently-accepted duplicate keys/tables.
Key Points
- Read with
toml+ serde, write withtoml_edit. Typed structs deserialize the config;toml_editpreserves comments and key ordering on write. - Precedent: OpenAI Codex CLI (Rust). Codex parses
~/.codex/config.tomlwithtoml+ serde and writes viatoml_edit::DocumentMut(seecodex-rs/core/src/config/mod.rs,set_default_oss_provider). - Error UX is the main deliverable. Codex's
config_error_from_toml/format_config_error(codex-rs/config/src/diagnostics.rs) usestoml::de::Error::span()to emitpath:line:col: message, the offending line with a gutter, and^^^carets under the span — then exits non-zero. - Silent failures were the user complaint (openai/codex#11946). The fix is threefold: name the file, give a text range, exit non-zero.
- Duplicate tables caused a hang (openai/codex#13464): duplicate
[mcp_servers.*]blocks made the app unresponsive. A real TOML parser rejects duplicate tables/keys, where a hand parser silently last-wins. - Version pins at 2026-11-12:
toml1.2.1+spec-1.1.0,toml_edit0.25.19+spec-1.1.0.
Concepts
tomlcrate — serde-compatible TOML deserializer; exposes error spans via .