From fb8e85e40a42afd2979835fa15c89306f74afc1a Mon Sep 17 00:00:00 2001 From: Oz Date: Sun, 3 May 2026 14:53:24 +0000 Subject: [PATCH] Fix slash command skills bypassing cloud mode in old UI When a skill command (e.g. /some-skill) was typed in the old cloud mode UI (CloudModeInputV2 flag disabled), it was routed through execute_skill_command which enters the local agent view and sends the request locally, bypassing cloud mode entirely. The V2 UI already handled this correctly by returning false from maybe_handle_enter_for_slash_command when is_cloud_mode_input_v2_composing was true, letting the flow fall through to submit_ai_query which handles the cloud mode spawn_agent path. This fix broadens the guard from is_cloud_mode_input_v2_composing (which requires the V2 flag) to is_composing_cloud_mode_prompt (which only checks CloudMode flag + is_configuring_ambient_agent), covering both old and new cloud mode UIs. Co-Authored-By: Oz --- app/src/terminal/input/agent.rs | 11 +++++++++-- app/src/terminal/input/slash_commands/mod.rs | 8 ++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/terminal/input/agent.rs b/app/src/terminal/input/agent.rs index d23c0348b..dafd77293 100644 --- a/app/src/terminal/input/agent.rs +++ b/app/src/terminal/input/agent.rs @@ -65,8 +65,15 @@ const CLOUD_MODE_V2_CHIPS_ROW_TOP_PADDING: f32 = 4.; impl Input { pub fn is_cloud_mode_input_v2_composing(&self, app: &AppContext) -> bool { - FeatureFlag::CloudModeInputV2.is_enabled() - && FeatureFlag::CloudMode.is_enabled() + FeatureFlag::CloudModeInputV2.is_enabled() && self.is_composing_cloud_mode_prompt(app) + } + + /// Returns true when the user is composing a cloud-mode prompt (i.e. configuring an + /// ambient agent before submitting the first request). + /// Unlike `is_cloud_mode_input_v2_composing`, this is not gated on the V2 input flag + /// so it covers both the old and new cloud-mode UIs. + pub(super) fn is_composing_cloud_mode_prompt(&self, app: &AppContext) -> bool { + FeatureFlag::CloudMode.is_enabled() && self .ambient_agent_view_model() .is_some_and(|model| model.as_ref(app).is_configuring_ambient_agent()) diff --git a/app/src/terminal/input/slash_commands/mod.rs b/app/src/terminal/input/slash_commands/mod.rs index 91349a7f7..0db38d893 100644 --- a/app/src/terminal/input/slash_commands/mod.rs +++ b/app/src/terminal/input/slash_commands/mod.rs @@ -1127,9 +1127,7 @@ impl Input { ctx, ) } - SlashCommandEntryState::SkillCommand(_) - if self.is_cloud_mode_input_v2_composing(ctx) => - { + SlashCommandEntryState::SkillCommand(_) if self.is_composing_cloud_mode_prompt(ctx) => { false } SlashCommandEntryState::SkillCommand(detected_skill) => { @@ -1225,9 +1223,7 @@ impl Input { ctx, ) } - SlashCommandEntryState::SkillCommand(_) - if self.is_cloud_mode_input_v2_composing(ctx) => - { + SlashCommandEntryState::SkillCommand(_) if self.is_composing_cloud_mode_prompt(ctx) => { false } SlashCommandEntryState::SkillCommand(detected_skill) => {