fix: invalidate shell eval cache when devenv config changes#2643
Merged
domenkozar merged 3 commits intoMar 20, 2026
Merged
Conversation
domenkozar
reviewed
Mar 20, 2026
Member
|
Looks good, could you also add an entry to |
Contributor
Author
|
Thank you. Will do! |
Track core project config files explicitly in the FFI eval cache and bump the shared shell cache key version so stale shell cache rows are not reused. This fixes cases where `devenv info` reflected updated config but `devenv print-dev-env`, `devenv shell`, and direnv activation kept serving an older cached shell environment.
bffb1db to
8923b5c
Compare
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 most of this summary is AI Generated (Codex 5.4).
Human bug report
My changes in devenv.nix did not reflect in the build environment.
This happened both in
direnv activation. anddevenv shell`.Changes to these attributes in
devenv.nixdidn't have effect on my shell:languages(like adding gradle; and it not ending up on PATH).This PR fixes this, but I have no idea if it's a desired approach. Please complete it with taste :D.
Everything that follows is AI-generated
This was caused by stale shell evaluation cache entries being reused after project configuration changed.
The key symptom was that different commands disagreed about the current configuration:
devenv infoshowed the updated packages and environmentdevenv print-dev-envcould still return an older cached shell environmentBecause
devenv shellanddirenvactivation both consume the shell environment output, they inherited the stale result as well. That made the issue look like a broadlanguagesproblem, but the language modules were not the root cause. The same failure mode affected top-levelpackages,env, and generatedscripts.The underlying issue was incomplete cache invalidation for shell environment evaluation. Changes to core project configuration files such as
devenv.nixcould leave an existing shell cache entry looking valid when it was no longer correct.Fix approach
This PR fixes the problem by explicitly tracking core project configuration files as shell eval-cache inputs.
The shell cache now watches the project files that directly define the environment, including
devenv.nix,devenv.yaml,devenv.lock, and local override files when they exist.This keeps the change focused on cache correctness instead of adding special handling for individual features like
languages,env, orscripts.Why this approach
The failure was not specific to any one module. It was a generic shell-environment caching bug. Fixing cache input tracking addresses the common cause and keeps
devenv info,devenv print-dev-env,devenv shell, anddirenvactivation consistent with each other.Verification
The change is covered by focused tests for:
This is intended to be a low-maintenance fix: it hardens the cache boundary directly, rather than adding feature-specific behavior or a large end-to-end regression test.