Fix required configuration option cache invalidation - #980
Merged
ZipFile merged 1 commit intoAug 11, 2026
Merged
Conversation
Kryptonzy
marked this pull request as ready for review
August 10, 2026 12:44
Kryptonzy
marked this pull request as draft
August 10, 2026 12:51
Kryptonzy
marked this pull request as ready for review
August 10, 2026 14:25
Kryptonzy
force-pushed
the
agent/fix-configuration-option-cache-override
branch
from
August 10, 2026 15:21
9f1500a to
840ac00
Compare
ZipFile
approved these changes
Aug 11, 2026
ZipFile
left a comment
Contributor
There was a problem hiding this comment.
Not exactly fond of this solution, but given that we have to keep backward compatibility this is probably good enough one. For v5 we have to rethink config management for sure.
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
Make a configuration option reuse and track its derived
.required()provider so configuration cache resets also invalidate the required view.Fixes #954.
Root cause and approach
ConfigurationOption.required()created a detached provider each time. After that provider resolved a value, the original option had no reference to its cache. An override correctly reset the root/original option tree, but could not reach the required provider captured by aSingletonorFactory, so recreating the consumer still returned the stale value.The original option now lazily creates and retains one required provider.
reset_cache()cascades to that provider, deepcopy preserves the relationship, and callingrequired()on an already-required option is idempotent. This keeps the existing cache for performance, as requested in the issue discussion, instead of recomputing every access.Verification
{"value": "initial"}during the override..venv/bin/pytest -q tests/unit/providers/configuration/test_config_py2_py3.py::test_required_cache_is_reset_after_option_override— 1 passed..venv/bin/pytest -q tests/unit/providers/configuration— 204 passed.git diff --checkpasses. (providers.pyxis Cython and is not directly parseable by Flake8.)Tests and lintersworkflow is currentlyaction_requiredand generated no jobs. This is the repository's approval gate for workflows from forks, not a test execution failure; no remote-green result is claimed before a maintainer approves it.Scope
The change is limited to
ConfigurationOptioncache linkage/copying and one focused regression. It does not remove caching, change configuration lookup rules, or alterSingleton/Factorybehavior.AI assistance
OpenAI Codex (GPT-5) was used to investigate the cache lifecycle, implement the focused change and regression, rebuild the extension, and run/review the verification above. I reviewed the final diff and am disclosing this assistance explicitly.