feat(core): add neverConfigureAiAgents opt-out for AI agent disclaimer#35558
Open
comp615 wants to merge 1 commit intonrwl:masterfrom
Open
feat(core): add neverConfigureAiAgents opt-out for AI agent disclaimer#35558comp615 wants to merge 1 commit intonrwl:masterfrom
comp615 wants to merge 1 commit 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
|
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
f4283a0 to
4307904
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.
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.