agent: Remove feature flag checks (#30055)

This PR removes all of the feature flag checks related to the Agent.

Tried to do this in the least invasive way possible; we can follow up
with a full removal.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-06 21:38:05 -04:00 committed by GitHub
parent 0cdd8bdded
commit 5539d82ea6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 45 additions and 178 deletions

4
Cargo.lock generated
View file

@ -62,7 +62,6 @@ dependencies = [
"chrono", "chrono",
"client", "client",
"collections", "collections",
"command_palette_hooks",
"component", "component",
"context_server", "context_server",
"convert_case 0.8.0", "convert_case 0.8.0",
@ -547,7 +546,6 @@ dependencies = [
"collections", "collections",
"context_server", "context_server",
"editor", "editor",
"feature_flags",
"fs", "fs",
"futures 0.3.31", "futures 0.3.31",
"fuzzy", "fuzzy",
@ -597,7 +595,6 @@ dependencies = [
"anyhow", "anyhow",
"collections", "collections",
"deepseek", "deepseek",
"feature_flags",
"fs", "fs",
"gpui", "gpui",
"indexmap", "indexmap",
@ -15088,7 +15085,6 @@ dependencies = [
"client", "client",
"collections", "collections",
"db", "db",
"feature_flags",
"gpui", "gpui",
"http_client", "http_client",
"notifications", "notifications",

View file

@ -29,7 +29,6 @@ buffer_diff.workspace = true
chrono.workspace = true chrono.workspace = true
client.workspace = true client.workspace = true
collections.workspace = true collections.workspace = true
command_palette_hooks.workspace = true
component.workspace = true component.workspace = true
context_server.workspace = true context_server.workspace = true
convert_case.workspace = true convert_case.workspace = true

View file

@ -29,8 +29,6 @@ use std::sync::Arc;
use assistant_settings::{AgentProfileId, AssistantSettings}; use assistant_settings::{AgentProfileId, AssistantSettings};
use client::Client; use client::Client;
use command_palette_hooks::CommandPaletteFilter;
use feature_flags::{Assistant2FeatureFlag, FeatureFlagAppExt};
use fs::Fs; use fs::Fs;
use gpui::{App, actions, impl_actions}; use gpui::{App, actions, impl_actions};
use language::LanguageRegistry; use language::LanguageRegistry;
@ -107,8 +105,6 @@ impl ManageProfiles {
impl_actions!(agent, [NewThread, ManageProfiles]); impl_actions!(agent, [NewThread, ManageProfiles]);
const NAMESPACE: &str = "agent";
/// Initializes the `agent` crate. /// Initializes the `agent` crate.
pub fn init( pub fn init(
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
@ -136,25 +132,4 @@ pub fn init(
); );
cx.observe_new(AddContextServerModal::register).detach(); cx.observe_new(AddContextServerModal::register).detach();
cx.observe_new(ManageProfilesModal::register).detach(); cx.observe_new(ManageProfilesModal::register).detach();
feature_gate_agent_actions(cx);
}
fn feature_gate_agent_actions(cx: &mut App) {
CommandPaletteFilter::update_global(cx, |filter, _cx| {
filter.hide_namespace(NAMESPACE);
});
cx.observe_flag::<Assistant2FeatureFlag, _>(move |is_enabled, cx| {
if is_enabled {
CommandPaletteFilter::update_global(cx, |filter, _cx| {
filter.show_namespace(NAMESPACE);
});
} else {
CommandPaletteFilter::update_global(cx, |filter, _cx| {
filter.hide_namespace(NAMESPACE);
});
}
})
.detach();
} }

View file

@ -17,7 +17,6 @@ use editor::{
ToDisplayPoint, ToDisplayPoint,
}, },
}; };
use feature_flags::{Assistant2FeatureFlag, FeatureFlagViewExt as _};
use fs::Fs; use fs::Fs;
use gpui::{ use gpui::{
App, Context, Entity, Focusable, Global, HighlightStyle, Subscription, Task, UpdateGlobal, App, Context, Entity, Focusable, Global, HighlightStyle, Subscription, Task, UpdateGlobal,
@ -66,15 +65,6 @@ pub fn init(
InlineAssistant::update_global(cx, |inline_assistant, cx| { InlineAssistant::update_global(cx, |inline_assistant, cx| {
inline_assistant.register_workspace(&workspace, window, cx) inline_assistant.register_workspace(&workspace, window, cx)
}); });
cx.observe_flag::<Assistant2FeatureFlag, _>(window, {
|is_assistant2_enabled, _workspace, _window, cx| {
InlineAssistant::update_global(cx, |inline_assistant, _cx| {
inline_assistant.is_assistant2_enabled = is_assistant2_enabled;
});
}
})
.detach();
}) })
.detach(); .detach();
} }
@ -97,7 +87,6 @@ pub struct InlineAssistant {
prompt_builder: Arc<PromptBuilder>, prompt_builder: Arc<PromptBuilder>,
telemetry: Arc<Telemetry>, telemetry: Arc<Telemetry>,
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
is_assistant2_enabled: bool,
} }
impl Global for InlineAssistant {} impl Global for InlineAssistant {}
@ -119,7 +108,6 @@ impl InlineAssistant {
prompt_builder, prompt_builder,
telemetry, telemetry,
fs, fs,
is_assistant2_enabled: false,
} }
} }
@ -188,7 +176,7 @@ impl InlineAssistant {
window: &mut Window, window: &mut Window,
cx: &mut App, cx: &mut App,
) { ) {
let is_assistant2_enabled = self.is_assistant2_enabled; let is_assistant2_enabled = true;
if let Some(editor) = item.act_as::<Editor>(cx) { if let Some(editor) = item.act_as::<Editor>(cx) {
editor.update(cx, |editor, cx| { editor.update(cx, |editor, cx| {

View file

@ -17,7 +17,6 @@ use editor::{
AnchorRangeExt, ContextMenuOptions, ContextMenuPlacement, Editor, EditorElement, EditorEvent, AnchorRangeExt, ContextMenuOptions, ContextMenuPlacement, Editor, EditorElement, EditorEvent,
EditorMode, EditorStyle, MultiBuffer, EditorMode, EditorStyle, MultiBuffer,
}; };
use feature_flags::{FeatureFlagAppExt, NewBillingFeatureFlag};
use file_icons::FileIcons; use file_icons::FileIcons;
use fs::Fs; use fs::Fs;
use futures::future::Shared; use futures::future::Shared;
@ -464,10 +463,6 @@ impl MessageEditor {
} }
fn render_max_mode_toggle(&self, cx: &mut Context<Self>) -> Option<AnyElement> { fn render_max_mode_toggle(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
if !cx.has_flag::<NewBillingFeatureFlag>() {
return None;
}
let thread = self.thread.read(cx); let thread = self.thread.read(cx);
let model = thread.configured_model(); let model = thread.configured_model();
if !model?.model.supports_max_mode() { if !model?.model.supports_max_mode() {
@ -1074,10 +1069,6 @@ impl MessageEditor {
} }
fn render_usage_callout(&self, line_height: Pixels, cx: &mut Context<Self>) -> Option<Div> { fn render_usage_callout(&self, line_height: Pixels, cx: &mut Context<Self>) -> Option<Div> {
if !cx.has_flag::<NewBillingFeatureFlag>() {
return None;
}
let is_using_zed_provider = self let is_using_zed_provider = self
.thread .thread
.read(cx) .read(cx)
@ -1139,10 +1130,6 @@ impl MessageEditor {
token_usage_ratio: TokenUsageRatio, token_usage_ratio: TokenUsageRatio,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) -> Option<Div> { ) -> Option<Div> {
if !cx.has_flag::<NewBillingFeatureFlag>() {
return None;
}
let title = if token_usage_ratio == TokenUsageRatio::Exceeded { let title = if token_usage_ratio == TokenUsageRatio::Exceeded {
"Thread reached the token limit" "Thread reached the token limit"
} else { } else {

View file

@ -17,9 +17,7 @@ use editor::{
ToDisplayPoint, ToDisplayPoint,
}, },
}; };
use feature_flags::{ use feature_flags::{FeatureFlagAppExt as _, ZedProFeatureFlag};
Assistant2FeatureFlag, FeatureFlagAppExt as _, FeatureFlagViewExt as _, ZedProFeatureFlag,
};
use fs::Fs; use fs::Fs;
use futures::{ use futures::{
SinkExt, Stream, StreamExt, TryStreamExt as _, SinkExt, Stream, StreamExt, TryStreamExt as _,
@ -74,25 +72,19 @@ pub fn init(
cx: &mut App, cx: &mut App,
) { ) {
cx.set_global(InlineAssistant::new(fs, prompt_builder, telemetry)); cx.set_global(InlineAssistant::new(fs, prompt_builder, telemetry));
cx.observe_new(|_, window, cx| { // Don't register now that the Agent is released.
let Some(window) = window else { if false {
return; cx.observe_new(|_, window, cx| {
}; let Some(window) = window else {
let workspace = cx.entity().clone(); return;
InlineAssistant::update_global(cx, |inline_assistant, cx| { };
inline_assistant.register_workspace(&workspace, window, cx) let workspace = cx.entity().clone();
}); InlineAssistant::update_global(cx, |inline_assistant, cx| {
inline_assistant.register_workspace(&workspace, window, cx)
cx.observe_flag::<Assistant2FeatureFlag, _>(window, { });
|is_assistant2_enabled, _workspace, _window, cx| {
InlineAssistant::update_global(cx, |inline_assistant, _cx| {
inline_assistant.is_assistant2_enabled = is_assistant2_enabled;
});
}
}) })
.detach(); .detach();
}) }
.detach();
} }
const PROMPT_HISTORY_MAX_LEN: usize = 20; const PROMPT_HISTORY_MAX_LEN: usize = 20;
@ -108,7 +100,6 @@ pub struct InlineAssistant {
prompt_builder: Arc<PromptBuilder>, prompt_builder: Arc<PromptBuilder>,
telemetry: Arc<Telemetry>, telemetry: Arc<Telemetry>,
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
is_assistant2_enabled: bool,
} }
impl Global for InlineAssistant {} impl Global for InlineAssistant {}
@ -130,7 +121,6 @@ impl InlineAssistant {
prompt_builder, prompt_builder,
telemetry, telemetry,
fs, fs,
is_assistant2_enabled: false,
} }
} }
@ -199,7 +189,7 @@ impl InlineAssistant {
window: &mut Window, window: &mut Window,
cx: &mut App, cx: &mut App,
) { ) {
let is_assistant2_enabled = self.is_assistant2_enabled; let is_assistant2_enabled = true;
if let Some(editor) = item.act_as::<Editor>(cx) { if let Some(editor) = item.act_as::<Editor>(cx) {
editor.update(cx, |editor, cx| { editor.update(cx, |editor, cx| {

View file

@ -22,7 +22,6 @@ clock.workspace = true
collections.workspace = true collections.workspace = true
context_server.workspace = true context_server.workspace = true
editor.workspace = true editor.workspace = true
feature_flags.workspace = true
fs.workspace = true fs.workspace = true
futures.workspace = true futures.workspace = true
fuzzy.workspace = true fuzzy.workspace = true

View file

@ -18,7 +18,6 @@ use editor::{
scroll::Autoscroll, scroll::Autoscroll,
}; };
use editor::{FoldPlaceholder, display_map::CreaseId}; use editor::{FoldPlaceholder, display_map::CreaseId};
use feature_flags::{Assistant2FeatureFlag, FeatureFlagAppExt as _};
use fs::Fs; use fs::Fs;
use futures::FutureExt; use futures::FutureExt;
use gpui::{ use gpui::{
@ -2395,19 +2394,11 @@ impl ContextEditor {
.on_click({ .on_click({
let focus_handle = self.focus_handle(cx).clone(); let focus_handle = self.focus_handle(cx).clone();
move |_event, window, cx| { move |_event, window, cx| {
if cx.has_flag::<Assistant2FeatureFlag>() { focus_handle.dispatch_action(
focus_handle.dispatch_action( &zed_actions::agent::OpenConfiguration,
&zed_actions::agent::OpenConfiguration, window,
window, cx,
cx, );
);
} else {
focus_handle.dispatch_action(
&zed_actions::assistant::ShowConfiguration,
window,
cx,
);
};
} }
}), }),
) )

View file

@ -15,7 +15,6 @@ path = "src/assistant_settings.rs"
anthropic = { workspace = true, features = ["schemars"] } anthropic = { workspace = true, features = ["schemars"] }
anyhow.workspace = true anyhow.workspace = true
collections.workspace = true collections.workspace = true
feature_flags.workspace = true
gpui.workspace = true gpui.workspace = true
indexmap.workspace = true indexmap.workspace = true
language_model.workspace = true language_model.workspace = true

View file

@ -7,7 +7,6 @@ use anthropic::Model as AnthropicModel;
use anyhow::{Result, bail}; use anyhow::{Result, bail};
use collections::IndexMap; use collections::IndexMap;
use deepseek::Model as DeepseekModel; use deepseek::Model as DeepseekModel;
use feature_flags::{AgentStreamEditsFeatureFlag, Assistant2FeatureFlag, FeatureFlagAppExt};
use gpui::{App, Pixels, SharedString}; use gpui::{App, Pixels, SharedString};
use language_model::{CloudModel, LanguageModel}; use language_model::{CloudModel, LanguageModel};
use lmstudio::Model as LmStudioModel; use lmstudio::Model as LmStudioModel;
@ -107,16 +106,13 @@ impl AssistantSettings {
.and_then(|m| m.temperature) .and_then(|m| m.temperature)
} }
pub fn stream_edits(&self, cx: &App) -> bool { pub fn stream_edits(&self, _cx: &App) -> bool {
cx.has_flag::<AgentStreamEditsFeatureFlag>() || self.stream_edits // TODO: Remove the `stream_edits` setting.
true
} }
pub fn are_live_diffs_enabled(&self, cx: &App) -> bool { pub fn are_live_diffs_enabled(&self, _cx: &App) -> bool {
if cx.has_flag::<Assistant2FeatureFlag>() { false
return false;
}
cx.is_staff() || self.enable_experimental_live_diffs
} }
pub fn set_inline_assistant_model(&mut self, provider: String, model: String) { pub fn set_inline_assistant_model(&mut self, provider: String, model: String) {

View file

@ -27,7 +27,6 @@ use std::sync::Arc;
use assistant_settings::AssistantSettings; use assistant_settings::AssistantSettings;
use assistant_tool::ToolRegistry; use assistant_tool::ToolRegistry;
use copy_path_tool::CopyPathTool; use copy_path_tool::CopyPathTool;
use feature_flags::{AgentStreamEditsFeatureFlag, FeatureFlagAppExt};
use gpui::{App, Entity}; use gpui::{App, Entity};
use http_client::HttpClientWithUrl; use http_client::HttpClientWithUrl;
use language_model::LanguageModelRegistry; use language_model::LanguageModelRegistry;
@ -77,8 +76,6 @@ pub fn init(http_client: Arc<HttpClientWithUrl>, cx: &mut App) {
registry.register_tool(FetchTool::new(http_client)); registry.register_tool(FetchTool::new(http_client));
register_edit_file_tool(cx); register_edit_file_tool(cx);
cx.observe_flag::<AgentStreamEditsFeatureFlag, _>(|_, cx| register_edit_file_tool(cx))
.detach();
cx.observe_global::<SettingsStore>(register_edit_file_tool) cx.observe_global::<SettingsStore>(register_edit_file_tool)
.detach(); .detach();

View file

@ -56,41 +56,6 @@ pub trait FeatureFlag {
} }
} }
/// Controls the values of various feature flags for the Agent launch.
///
/// Change this to `true` when we're ready to build the release candidate.
const AGENT_LAUNCH: bool = true;
pub struct Assistant2FeatureFlag;
impl FeatureFlag for Assistant2FeatureFlag {
const NAME: &'static str = "assistant2";
fn enabled_for_all() -> bool {
AGENT_LAUNCH
}
}
pub struct AgentStreamEditsFeatureFlag;
impl FeatureFlag for AgentStreamEditsFeatureFlag {
const NAME: &'static str = "agent-stream-edits";
fn enabled_for_all() -> bool {
AGENT_LAUNCH
}
}
pub struct NewBillingFeatureFlag;
impl FeatureFlag for NewBillingFeatureFlag {
const NAME: &'static str = "new-billing";
fn enabled_for_all() -> bool {
AGENT_LAUNCH
}
}
pub struct PredictEditsRateCompletionsFeatureFlag; pub struct PredictEditsRateCompletionsFeatureFlag;
impl FeatureFlag for PredictEditsRateCompletionsFeatureFlag { impl FeatureFlag for PredictEditsRateCompletionsFeatureFlag {
const NAME: &'static str = "predict-edits-rate-completions"; const NAME: &'static str = "predict-edits-rate-completions";

View file

@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use collections::{HashSet, IndexMap}; use collections::{HashSet, IndexMap};
use feature_flags::{Assistant2FeatureFlag, ZedProFeatureFlag}; use feature_flags::ZedProFeatureFlag;
use gpui::{ use gpui::{
Action, AnyElement, AnyView, App, Corner, DismissEvent, Entity, EventEmitter, FocusHandle, Action, AnyElement, AnyView, App, Corner, DismissEvent, Entity, EventEmitter, FocusHandle,
Focusable, Subscription, Task, WeakEntity, action_with_deprecated_aliases, Focusable, Subscription, Task, WeakEntity, action_with_deprecated_aliases,
@ -597,13 +597,10 @@ impl PickerDelegate for LanguageModelPickerDelegate {
.icon_color(Color::Muted) .icon_color(Color::Muted)
.icon_position(IconPosition::Start) .icon_position(IconPosition::Start)
.on_click(|_, window, cx| { .on_click(|_, window, cx| {
let configure_action = if cx.has_flag::<Assistant2FeatureFlag>() { window.dispatch_action(
zed_actions::agent::OpenConfiguration.boxed_clone() zed_actions::agent::OpenConfiguration.boxed_clone(),
} else { cx,
zed_actions::assistant::ShowConfiguration.boxed_clone() );
};
window.dispatch_action(configure_action, cx);
}), }),
) )
.into_any(), .into_any(),

View file

@ -32,7 +32,6 @@ call.workspace = true
chrono.workspace = true chrono.workspace = true
client.workspace = true client.workspace = true
db.workspace = true db.workspace = true
feature_flags.workspace = true
gpui.workspace = true gpui.workspace = true
notifications.workspace = true notifications.workspace = true
project.workspace = true project.workspace = true

View file

@ -19,7 +19,6 @@ use crate::platforms::{platform_linux, platform_mac, platform_windows};
use auto_update::AutoUpdateStatus; use auto_update::AutoUpdateStatus;
use call::ActiveCall; use call::ActiveCall;
use client::{Client, UserStore}; use client::{Client, UserStore};
use feature_flags::{FeatureFlagAppExt, NewBillingFeatureFlag};
use gpui::{ use gpui::{
Action, AnyElement, App, Context, Corner, Decorations, Element, Entity, InteractiveElement, Action, AnyElement, App, Context, Corner, Decorations, Element, Entity, InteractiveElement,
Interactivity, IntoElement, MouseButton, ParentElement, Render, Stateful, Interactivity, IntoElement, MouseButton, ParentElement, Render, Stateful,
@ -678,22 +677,20 @@ impl TitleBar {
PopoverMenu::new("user-menu") PopoverMenu::new("user-menu")
.anchor(Corner::TopRight) .anchor(Corner::TopRight)
.menu(move |window, cx| { .menu(move |window, cx| {
ContextMenu::build(window, cx, |menu, _, cx| { ContextMenu::build(window, cx, |menu, _, _cx| {
menu.when(cx.has_flag::<NewBillingFeatureFlag>(), |menu| { menu.action(
menu.action( format!(
format!( "Current Plan: {}",
"Current Plan: {}", match plan {
match plan { None => "",
None => "", Some(proto::Plan::Free) => "Free",
Some(proto::Plan::Free) => "Free", Some(proto::Plan::ZedPro) => "Pro",
Some(proto::Plan::ZedPro) => "Pro", Some(proto::Plan::ZedProTrial) => "Pro (Trial)",
Some(proto::Plan::ZedProTrial) => "Pro (Trial)", }
} ),
), zed_actions::OpenAccountSettings.boxed_clone(),
zed_actions::OpenAccountSettings.boxed_clone(), )
) .separator()
.separator()
})
.action("Settings", zed_actions::OpenSettings.boxed_clone()) .action("Settings", zed_actions::OpenSettings.boxed_clone())
.action("Key Bindings", Box::new(zed_actions::OpenKeymap)) .action("Key Bindings", Box::new(zed_actions::OpenKeymap))
.action( .action(

View file

@ -19,7 +19,7 @@ use collections::VecDeque;
use debugger_ui::debugger_panel::DebugPanel; use debugger_ui::debugger_panel::DebugPanel;
use editor::ProposedChangesEditorToolbar; use editor::ProposedChangesEditorToolbar;
use editor::{Editor, MultiBuffer, scroll::Autoscroll}; use editor::{Editor, MultiBuffer, scroll::Autoscroll};
use feature_flags::{DebuggerFeatureFlag, FeatureFlagAppExt, FeatureFlagViewExt}; use feature_flags::{DebuggerFeatureFlag, FeatureFlagViewExt};
use futures::{StreamExt, channel::mpsc, select_biased}; use futures::{StreamExt, channel::mpsc, select_biased};
use git_ui::git_panel::GitPanel; use git_ui::git_panel::GitPanel;
use git_ui::project_diff::ProjectDiffToolbar; use git_ui::project_diff::ProjectDiffToolbar;
@ -53,7 +53,6 @@ use settings::{
}; };
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::atomic::{self, AtomicBool}; use std::sync::atomic::{self, AtomicBool};
use std::time::Duration;
use std::{borrow::Cow, path::Path, sync::Arc}; use std::{borrow::Cow, path::Path, sync::Arc};
use terminal_view::terminal_panel::{self, TerminalPanel}; use terminal_view::terminal_panel::{self, TerminalPanel};
use theme::{ActiveTheme, ThemeSettings}; use theme::{ActiveTheme, ThemeSettings};
@ -373,9 +372,6 @@ fn initialize_panels(
window: &mut Window, window: &mut Window,
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) { ) {
let assistant2_feature_flag =
cx.wait_for_flag_or_timeout::<feature_flags::Assistant2FeatureFlag>(Duration::from_secs(5));
let prompt_builder = prompt_builder.clone(); let prompt_builder = prompt_builder.clone();
cx.spawn_in(window, async move |workspace_handle, cx| { cx.spawn_in(window, async move |workspace_handle, cx| {
@ -436,11 +432,7 @@ fn initialize_panels(
workspace.add_panel(git_panel, window, cx); workspace.add_panel(git_panel, window, cx);
})?; })?;
let is_assistant2_enabled = if cfg!(test) { let is_assistant2_enabled = !cfg!(test);
false
} else {
assistant2_feature_flag.await
};
let (assistant_panel, assistant2_panel) = if is_assistant2_enabled { let (assistant_panel, assistant2_panel) = if is_assistant2_enabled {
let assistant2_panel = let assistant2_panel =