fix: abort install/uninstall on config parse errors to prevent data loss - #34
Closed
abhinavkr26104 wants to merge 1 commit into
Closed
fix: abort install/uninstall on config parse errors to prevent data loss#34abhinavkr26104 wants to merge 1 commit into
abhinavkr26104 wants to merge 1 commit into
Conversation
Member
|
Thanks for this — the fail-closed approach is the right fix for #33. We're landing a slightly simpler version on the same idea: keep parse-and-merge into the existing config, and only abort (no write) when parse fails. Same treatment for Happy to close this PR in favor of that once it's up, or we can pull any bits from here if useful. Appreciate the regression tests either way. |
5 tasks
Member
|
Landed the simpler parse-and-merge fix in #35 — fine to close this in favor of that. |
Contributor
Author
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.
Summary
Prevent accidental loss of user configuration during install and uninstall when existing Codex configuration files contain invalid TOML or JSON.
Changes
config.tomlTOML parse failures instead of falling back to an empty config.hooks.jsonJSON parse failures instead of recreating hook configuration.Problem
Previously, parse failures were silently ignored in the install/uninstall merge paths. If
~/.codex/config.tomlor~/.codex/hooks.jsoncontained a syntax error, the command could continue with an empty configuration object and overwrite the original file, potentially erasing unrelated user settings.Result
Configuration files are now treated as authoritative. If an existing file cannot be parsed, the operation stops safely, reports the issue, and leaves the existing file untouched.
Testing
npm testpassedissue fixed: #33