Fix stale eval-cache invalidation for devenv up process config changes#2632
Merged
domenkozar merged 1 commit intoMar 18, 2026
Merged
Conversation
…uation entirely. It is reusing the cached build result for devenv.config.procfileScript from devenv/src/devenv.rs
domenkozar
added a commit
that referenced
this pull request
Mar 18, 2026
Verifies that dropping one ObserverClearGuard does not remove another evaluation's observer from the shared NixLogBridge. Also adds changelog entry for the fix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
|
Added a test and changelog in 44ff299, thank you! |
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.
DISCLAIMER: Both bug triage, fix and this summary is AI Generated (Codex 5.4).
(However, a human experienced the bug and validated the fix.)
This fixes a cache invalidation bug that could cause devenv up to keep using an old processes configuration even after devenv.nix changed.
In the failing case, devenv up would still rebuild the procfile-related attribute path, but the evaluation could hit a stale cached result because not all file dependencies from nested evaluations were preserved. The visible symptom was that changes under processes were not reflected unless the user manually forced --refresh-eval-cache.
Root Cause
The eval-cache layer registers an observer to collect file and environment inputs during cache misses. That observer is used to determine when a cached evaluation should be invalidated.
On drop, the observer guard called clear_observers(), which removed every active observer from NixLogBridge, not just the collector created for that specific evaluation. In nested or overlapping evaluation paths, this could accidentally remove other collectors that were still needed.
As a result, some cached entries could be stored with incomplete dependency sets. When devenv.nix or related imported files later changed, those cache entries could still validate as fresh and return stale results.
Fix
The observer guard now removes only the observer it owns, using remove_observer(...), instead of clearing the full observer list.
This keeps dependency collection isolated per evaluation and preserves the complete input set needed for correct eval-cache invalidation.
User Impact
Before this change:
After this change: