From 7df0011164a6a588ae822afdc7f6c5d38e5c0c0c Mon Sep 17 00:00:00 2001 From: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com> Date: Fri, 15 May 2026 10:14:16 -0700 Subject: [PATCH] Hide Rules UI when Skills feature flag is enabled (#56782) Hides the legacy Rules surfaces when the `skills` feature flag is enabled, since Rules are surfaced through the Skills UI in that case: - The **Rules** entry in the agent panel's ellipsis (triple-dot) dropdown menu is hidden. - The `assistant: open rules library` command palette action is hidden. The `@rules` autocomplete in the chat input is intentionally left alone for now. ### Implementation notes `cx.has_flag::()` reads from a global feature-flag store that is populated asynchronously from the server: - **Command palette**: `update_command_palette_filter` is already re-run via `cx.on_flags_ready` once flags arrive, so the filter is reapplied with the correct value. No new wiring needed. - **Dropdown menu**: the popover's menu closure runs on every open, so the latest flag value is reflected at click time. Release Notes: - N/A --- crates/agent_ui/src/agent_panel.rs | 17 ++++++++++++++--- crates/agent_ui/src/agent_ui.rs | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index 57fcc22a9c..a511b36563 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -60,6 +60,7 @@ use collections::HashMap; use editor::{Editor, MultiBuffer}; use extension::ExtensionEvents; use extension_host::ExtensionStore; +use feature_flags::{FeatureFlagAppExt as _, SkillsFeatureFlag}; use fs::Fs; use gpui::{ Action, Anchor, Animation, AnimationExt, AnyElement, App, AsyncWindowContext, ClipboardItem, @@ -4178,6 +4179,12 @@ impl AgentPanel { .with_handle(self.agent_panel_menu_handle.clone()) .menu({ move |window, cx| { + // When the Skills feature flag is on, hide the legacy Rules menu entry. + // The flag is read from a global store populated asynchronously, and + // this menu builder runs on every open, so the latest resolved value is + // reflected when the user clicks the ellipsis. + let skills_enabled = cx.has_flag::(); + Some(ContextMenu::build(window, cx, |mut menu, _window, _| { menu = menu.context(focus_handle.clone()); @@ -4212,9 +4219,13 @@ impl AgentPanel { }), ) .action("Add Custom Server…", Box::new(AddContextServer)) - .separator() - .action("Rules", Box::new(OpenRulesLibrary::default())) - .action("Profiles", Box::new(ManageProfiles::default())); + .separator(); + + if !skills_enabled { + menu = menu.action("Rules", Box::new(OpenRulesLibrary::default())); + } + + menu = menu.action("Profiles", Box::new(ManageProfiles::default())); } menu = menu diff --git a/crates/agent_ui/src/agent_ui.rs b/crates/agent_ui/src/agent_ui.rs index a9af71ddf7..99297e20a7 100644 --- a/crates/agent_ui/src/agent_ui.rs +++ b/crates/agent_ui/src/agent_ui.rs @@ -651,6 +651,12 @@ fn update_command_palette_filter(cx: &mut App) { .edit_predictions .provider; + // The Skills feature flag is loaded asynchronously, so this value may + // be `false` before flags resolve. `update_command_palette_filter` + // gets re-run from `cx.on_flags_ready` (see `init`), which means the + // filter is reapplied with the correct value once flags arrive. + let skills_enabled = cx.has_flag::(); + CommandPaletteFilter::update_global(cx, |filter, _| { use editor::actions::{ AcceptEditPrediction, AcceptNextLineEditPrediction, AcceptNextWordEditPrediction, @@ -667,6 +673,8 @@ fn update_command_palette_filter(cx: &mut App) { TypeId::of::(), ]; + let open_rules_library_action = [TypeId::of::()]; + if disable_ai { filter.hide_namespace("agent"); filter.hide_namespace("agents"); @@ -715,6 +723,17 @@ fn update_command_palette_filter(cx: &mut App) { filter.show_namespace("multi_workspace"); } + + // Hide `assistant: open rules library` when Skills are enabled — + // Rules are surfaced through the Skills UI in that case. Applied + // after the disable-ai / agent-enabled branches so it overrides + // the `show_namespace("assistant")` call above without affecting + // the rest of that namespace's actions. + if !disable_ai && skills_enabled { + filter.hide_action_types(&open_rules_library_action); + } else { + filter.show_action_types(open_rules_library_action.iter()); + } }); }