feat(core): add neverConfigureAiAgents opt-out for AI agent disclaimer#35558
feat(core): add neverConfigureAiAgents opt-out for AI agent disclaimer#35558comp615 wants to merge 2 commits intonrwl:masterfrom
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
|
f4283a0 to
4307904
Compare
Workspaces can disable Nx's automatic AI agent configuration drift detection by setting `neverConfigureAiAgents: true` in nx.json or `NX_NEVER_CONFIGURE_AI_AGENTS=true` (env var takes precedence). When opted out, Nx skips the post-task 'Run nx configure-ai-agents to update' disclaimer and the daemon stops computing agent configuration status in the background. The explicit `nx configure-ai-agents` command is unaffected — only the implicit detection/nag is suppressed. Naming mirrors `neverConnectToCloud` for consistency. This is useful in monorepos where AI agent configuration depends on each developer's local editor setup (e.g., MCP detection via Nx Console), so the disclaimer can produce noise that the workspace cannot resolve centrally. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019ddf73-acd7-7107-beed-5c67b1dcb1ec
4307904 to
7fc77d6
Compare
|
View your CI Pipeline Execution ↗ for commit 7fc77d6
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Nx Cloud is proposing a fix for your failed CI:
We replaced Nx's with automatic in the NX_NEVER_CONFIGURE_AI_AGENTS table row description to fix the Nx.ProductPossessives vale error that was the sole cause of the astro-docs:vale task failure. This change preserves the full intent of the PR while making the description compliant with the workspace's documentation style rules.
Tip
✅ We verified this fix by re-running astro-docs:vale.
diff --git a/astro-docs/src/content/docs/reference/environment-variables.mdoc b/astro-docs/src/content/docs/reference/environment-variables.mdoc
index 629833d1..f5d608c4 100644
--- a/astro-docs/src/content/docs/reference/environment-variables.mdoc
+++ b/astro-docs/src/content/docs/reference/environment-variables.mdoc
@@ -33,7 +33,7 @@ The following environment variables are ones that you can set to change the beha
| `NX_MIGRATE_CLI_VERSION` | string | The version of Nx to use for running the `nx migrate` command. If not set, it defaults to `latest`. |
| `NX_MIGRATE_SKIP_INSTALL` | boolean | If set to `true`, `nx migrate --run-migrations` will not automatically perform the installation of the packages. |
| `NX_MIGRATE_USE_LOCAL` | boolean | If set to `true`, will use the locally installed version of `nx` instead of downloading the latest version to run the `nx migrate` command. |
-| `NX_NEVER_CONFIGURE_AI_AGENTS` | boolean | If set to `true`, disables Nx's automatic AI agent configuration drift detection and the post-task `Run "nx configure-ai-agents" to update.` disclaimer. The explicit `nx configure-ai-agents` command still works. Mirrors `neverConfigureAiAgents` in `nx.json`. |
+| `NX_NEVER_CONFIGURE_AI_AGENTS` | boolean | If set to `true`, disables automatic AI agent configuration drift detection and the post-task `Run "nx configure-ai-agents" to update.` disclaimer. The explicit `nx configure-ai-agents` command still works. Mirrors `neverConfigureAiAgents` in `nx.json`. |
| `NX_PARALLEL` | number | The number of tasks Nx should run in parallel. Overrides any configured value inside nx.json |
| `NX_SKIP_NX_CACHE` | boolean | Rerun the tasks even when the results are available in the cache. |
| `NX_SKIP_REMOTE_CACHE` | boolean | Disable all remote caching features. This means that the remote cache will not be read from or written to. Includes Nx Cloud and self-hosted caches. |
Because this branch comes from a fork, it is not possible for us to apply fixes directly, but you can apply the changes locally using the available options below.
Apply changes locally with:
npx nx-cloud apply-locally zmG4-B3ui
Apply fix locally with your editor ↗ View interactive diff ↗
🎓 Learn more about Self-Healing CI on nx.dev
…TS row Replace "Nx's" with "automatic" to satisfy Nx.ProductPossessives vale rule. 🤖 Per nx-cloud self-healing CI suggestion. Amp-Thread-ID: https://ampcode.com/threads/T-019dfd8d-ece5-75df-81fb-2537ddcee5c3 Co-authored-by: Amp <amp@ampcode.com>
Current Behavior
Nx automatically runs an AI-agent configuration drift check after every task run. When the daemon detects that any configured agent (Claude, Codex, Copilot, Cursor, Gemini, opencode) is "outdated" — meaning it has both MCP + rules configured locally and the configure-ai-agents generator would change something — it prints a dim disclaimer:
There is currently no way to opt out. This produces noise in workspaces where:
The daemon also unconditionally computes status in the background.
Expected Behavior
Workspaces can opt out of the automatic detection via
nx.jsonand/or an env var. The naming mirrors the existingneverConnectToCloud/NX_NO_CLOUDopt-out for Nx Cloud:Or per-invocation:
When opted out:
printConfigureAiAgentsDisclaimer()no-ops, so the post-task disclaimer is never printed.handleGetConfigureAiAgentsStatusshort-circuits and returns the empty status without computing or caching anything.nx configure-ai-agentscommand is unaffected — running it manually still works as before.The env var takes precedence over
nx.json(matching the precedent set byNX_NO_CLOUD/neverConnectToCloud), so users can temporarily re-enable detection in a workspace that opts out, or vice versa.Implementation summary
isConfigureAiAgentsEnabledatpackages/nx/src/ai/is-configure-ai-agents-enabled.ts(with unit tests covering all combinations of env var + nx.json).neverConfigureAiAgents?: booleanadded toNxJsonConfiguration, the JSON schema, and theallowedWorkspaceExtensionscompat list.printConfigureAiAgentsDisclaimerinrun-command.tsandhandleGetConfigureAiAgentsStatusin the daemon handler.astro-docs/src/content/docs/reference/nx-json.mdoc.Related Issue(s)
Discussed in #nrwl-block-shared on Slack with @MaxKless — direct request that opt-out be supported via both env var and nx.json. No GitHub issue exists yet.