fix(app-server): clear_path treats absent intermediate tables as a no-op#1
Open
sumaiazaman wants to merge 1 commit into
Open
fix(app-server): clear_path treats absent intermediate tables as a no-op#1sumaiazaman wants to merge 1 commit into
sumaiazaman wants to merge 1 commit into
Conversation
… tables When config/value/write is called with a null value to clear a nested key (e.g. "features.personality") and an intermediate parent table (e.g. [features]) does not yet exist in config.toml, clear_path was returning MergeError::PathNotFound instead of treating the operation as an idempotent no-op. Clearing an already-absent value should succeed silently. Change the absent-parent arms in clear_path to return Ok(false) so callers do not need to distinguish "value exists" from "value is already unset" before issuing a clear. Fixes openai#20145
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
Fixes openai#20145.
config/value/writewithvalue: nullis the API contract for clearing/unsetting a config key. When the path points to a nested key whose parent table does not yet exist inconfig.toml(e.g. clearingfeatures.personalityfrom an empty file),clear_pathwas returningMergeError::PathNotFoundwhich surfaces to callers asconfigPathNotFound / Path not found.The correct behaviour is to treat it as an idempotent no-op — the value is already absent, so the clear succeeds with no file change.
Root cause — two arms in
clear_paththat encounter a missing intermediate table:Fix — return
Ok(false)(value unchanged) instead of propagating an error:The
as_table_mut()guard at the end of the function is updated consistently for the same reason.Changes
codex-rs/app-server/src/config_manager_service.rs— fixclear_pathcodex-rs/app-server/src/config_manager_service_tests.rs— regression testclear_missing_nested_config_is_noopTest plan
clear_missing_nested_config_is_noopreproduces the reported failure before the fix and passes afterwrite_value_*tests continue to passcargo test -p codex-app-servergreen