fix(core): separate daemon runtime env from graph identity - #36565
Merged
leosvelperez merged 2 commits intoSep 3, 2026
Merged
Conversation
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
3 tasks
Yarn Berry creates a fresh BERRY_BIN_FOLDER for every invocation and puts it first on PATH. The daemon compared raw environments, so every yarn nx invocation discarded an unchanged cached graph. Graph identity is now compared after normalizing the Berry folder out; workers still receive every runtime change. Fixes nrwl#36564
sdjayna
force-pushed
the
fix/berry-daemon-graph-identity
branch
from
September 2, 2026 17:12
fd477cd to
6fe7f96
Compare
sdjayna
marked this pull request as ready for review
September 2, 2026 17:14
Contributor
|
View your CI Pipeline Execution ↗ for commit 47c243a
☁️ Nx Cloud last updated this comment at |
Contributor
There was a problem hiding this comment.
Nx Cloud has identified a flaky task in your failed CI:
Since the failure was identified as flaky, the solution is to rerun CI. Because this branch comes from a fork, it is not possible for us to push directly, but you can rerun by pushing an empty commit:
git commit --allow-empty -m "chore: trigger rerun"
git push
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
🎓 Learn more about Self-Healing CI on nx.dev
Member
|
@sdjayna thanks for the contribution! Could you please rebase? I merged a fix for a failing e2e that should unblock this one. |
meeroslav
approved these changes
Sep 3, 2026
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.
Current Behavior
"Berry" is Yarn's name for Yarn 2 and later; this reproduction uses Yarn 4.15.0. When Yarn runs a workspace binary it creates a fresh temporary
xfs-*directory for that invocation, writes wrappers into it for the selectednode,yarn,node-gypand package binaries, exports it asBERRY_BIN_FOLDER, and prepends it toPATH.The daemon compares the raw client environment against the previous one and invalidates the project graph when any value differs. The Berry folder differs on every invocation by design, so every
yarn nxcommand on a completely unchanged workspace pays full graph construction:Measured on a large workspace: 10.0-16.5s per invocation, against 0.27s from the retained graph when the daemon is reached without Yarn's wrapper environment. Reproduced on stock Nx across Windows, macOS and Ubuntu (workflow linked from #36564).
Expected Behavior
The daemon separates two concerns that currently share one comparison:
normalizeDaemonEnvironmentForGraphremoves the exactBERRY_BIN_FOLDERsegment fromPATH(case- and separator-insensitively on win32) and pinsBERRY_BIN_FOLDERto a sentinel, so two Yarn invocations compare equal while a Yarn invocation and a direct Node invocation remain distinct identities.The decision happens in
handle-client-env.tsand unions two normalized diffs:process.envbefore versus after the existingapplyDaemonEnvFromClient(whose signature, behaviour and generation semantics are unchanged), and the previously applied client environment versus the incoming one. A real toolchain change (a different SDK onPATH) still invalidates; lockfile and file changes continue to invalidate through file watching.Tests: 54/54 in the touched suites, including every pre-existing upstream test unchanged, plus a Berry-rotation test (two environments differing only by
xfs-*folder produce no invalidation and the new folder is still forwarded to workers) and unit coverage for the normalization and changed-key helpers.Related Issue(s)
Fixes #36564