Repository navigation
STA-1598: Prevent duplicate TOML project keys from breaking Codex startup - #8138
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughCodex trust updates now parse project headers with TOML-aware scanning and normalize Windows, UNC, WSL, and POSIX paths for matching. Configuration mirroring deduplicates equivalent project sections and preserves untrusted trust entries when duplicates conflict. New tests cover canonical and literal-string headers, path representation variants, duplicate runtime and system tables, trust revocation precedence, and paths containing quotes or backslashes. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
[projects.*]headers by decoded TOML key value instead of their raw quote representation/vs\separators, including already-canonical SSH pathsuntrustedwins every conflictRoot cause
Orca wrote project trust as a TOML basic-string key while Codex/toml_edit can write the same Windows path as a literal-string key.
buildProjectHeaderPatternonly recognized double-quoted headers, and the mirror compared raw trimmed header text. The representation mismatch let both tables survive even though TOML decodes them to the same project key, causing Codex startup to fail with a duplicate-table parse error.This predates and is unrelated to #7896 and #7960; those changes touch neighboring hook-trust/settings write-back paths but did not create the duplicate project key.
Self-heal and hooks
Every managed-config mirror pass now collapses semantically equivalent project sections from either input. Runtime project trust remains authoritative unless the system config marks the same normalized project
untrusted; among already-duplicated sections, anyuntrustedentry survives.[hooks.state.*]is intentionally not path-normalized by this deduper. The current hook upsert path already parses basic and literal keys and removes all quote-equivalent blocks before writing, while its paired Windows slash variants are required for Codex 0.140 raw native-path matching. This preserves the #6318 compatibility behavior and cannot recreate the reporter's quote-only hook duplication.Test evidence
pnpm vitest run src/main/codex/config-toml-trust.test.ts src/main/codex/codex-config-mirror.test.ts— 114 passedpnpm vitest run src/main/codex src/main/codex-accounts— 396 passed, 7 skippedpnpm typecheck— passedpnpm check:max-lines-ratchet— passedoxlinton all changed files — passedUSERPROFILE/ORCA_USER_DATA_PATH: real Codex rejected the seeded duplicate config, the real mirror healed it to one project table, andcodex features listthen parsed successfully with sandboxedCODEX_HOMEReferences