Repository navigation
fix(agents): parse JSON configuration with serde_json before json5 - #525
Merged
lzt404 merged 1 commit intoOct 27, 2026
Merged
Conversation
Every start validates the agent configuration files, and every file that is not TOML or YAML went through json5. The json5 (pest) parser needs about 80 times the input size in memory, so the generated Codex model catalog (~/.codex/cpa-gui-model-catalog.json, 64.6 MB with 733 models) pushed the app to a 5.6 GiB peak at every launch. Try strict JSON first and fall back to json5 only when that fails, so comments and trailing commas in hand-edited files keep working.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every start validates the agent configuration files, and every file that is not TOML or YAML goes through json5.
The json5 (pest) parser needs about 80 times the input size in memory. With the generated Codex model catalog
(
~/.codex/cpa-gui-model-catalog.json, 64.6 MB for 733 models) the app peaked at about 5.6 GiB on every launch.This tries strict JSON first and falls back to json5 only when that fails, so comments and trailing commas in
hand-edited files keep working. The same helper is used for the two discovery reads that parsed JSON with json5.
Measured on Linux aarch64 with the same
~/.codex: VmHWM after start 5,838,084 kB before, 532,304 kB after.Tests:
cargo test --manifest-path src-tauri/Cargo.toml --bin cpa-gui -- parse_json_or_json5 parse_keeps_json5_config_files_working.