agent: Add project-level disable_ai setting#47902
agent: Add project-level disable_ai setting#47902probably-neb merged 4 commits intozed-industries:mainfrom
disable_ai setting#47902Conversation
Move `disable_ai` from root settings to `ProjectSettingsContent` to enable per-project AI configuration via `.zed/settings.json`. - Add `DisableAiSettings::is_ai_disabled()` helper that checks settings based on file's worktree location - Update editor to check project-level settings for edit predictions and context menus - Prevent MCP servers from starting when AI is disabled at project level - Merge project-level `disable_ai` into global settings (using SaturatingBool OR logic - once disabled, cannot be re-enabled by lower-precedence settings) - Update settings UI to allow viewing/editing at both user and project level Note: SaturatingBool ensures that if user globally disables AI, projects cannot re-enable it. Projects can only further restrict AI, not grant it.
disable_ai setting
|
Great work @oliverbarnes! I've pushed up a commit that adds a second helper to the |
|
Thanks @probably-neb! That's good to hear, and I like the refactor too - it's cleaner this way. Ship it :) 🚢 🇮🇹 |
As a developer working across dozens–hundreds of repositories of which only a few can currently accept changes made with AI, I regret this implementation detail (as described) undermines your change. It was safest to leave Zed's AI support disabled beforehand, and it strikes me it's still safest to leave Zed's AI support disabled now. I'm happy to be straightened out: what do I put in the global and project settings so it's only enabled for projects in which I opt-in with |
|
Hey @garthk, I can see where you're coming from, it's not a scenario I had considered. I have the opposite situation: on most projects I want to use AI, but on a couple, like repos with manual coding exercises, I want to disable it. I guess my interpretation of I think this deserves a larger discussion, as it involves a strategic decision by the Zed team if it were to change. I suggest opening a feature request discussion, or opening a thread on Discord, to kick it off. |
|
No worries. I've painted myself into a corner with Boolean config variables before, too. They're so often intuitive, obvious, and wrong. :) |
Why? I mean, isn't better to just let project settings override globals? I think this way both scenarios are covered:
|
It being a SaturatingBool ensures that projects can't violate a user's preference not to use AI. |
|
This is clear, my question was about the behavior, not the implementation. Let's consider three possible scenarios: The current implementation covers scenarios b and c. Using different values such as I was wondering if those options have been considered and then discarded for some reasons. |
|
@davc0n those are also valid possibilities, I hadn't considered those when implementing this. But like I explained to Garth above, I think expanding the functionality needs some discussion and a decision from the Zed team, and the best way is to kick it off is as a feature request. Another option is to post on Discord to see what the community thinks there. Comments on merged PRs aren't very likely to get noticed. |
|
Thank you @oliverbarnes |
Closes #47854
Move
disable_aifrom root settings toProjectSettingsContentto enable per-project AI configuration via.zed/settings.json.Note: SaturatingBool ensures that if user globally disables AI, projects cannot re-enable it. Projects can only further restrict AI, not grant it.
Release Notes: