From 6d7add47590cead783dccd49aa5cd337b6a8e375 Mon Sep 17 00:00:00 2001
From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Date: Fri, 22 Aug 2025 08:28:03 -0300
Subject: [PATCH] thread view: Inform when editing previous messages is
unavailable (#36727)
Release Notes:
- N/A
---
assets/icons/pencil_unavailable.svg | 6 ++
crates/agent_ui/src/acp/thread_view.rs | 97 ++++++++++++-------
crates/agent_ui/src/ui.rs | 2 +
.../src/ui/unavailable_editing_tooltip.rs | 29 ++++++
crates/icons/src/icons.rs | 1 +
5 files changed, 98 insertions(+), 37 deletions(-)
create mode 100644 assets/icons/pencil_unavailable.svg
create mode 100644 crates/agent_ui/src/ui/unavailable_editing_tooltip.rs
diff --git a/assets/icons/pencil_unavailable.svg b/assets/icons/pencil_unavailable.svg
new file mode 100644
index 0000000000..4241d766ac
--- /dev/null
+++ b/assets/icons/pencil_unavailable.svg
@@ -0,0 +1,6 @@
+
diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs
index dae89b3283..619885144a 100644
--- a/crates/agent_ui/src/acp/thread_view.rs
+++ b/crates/agent_ui/src/acp/thread_view.rs
@@ -57,7 +57,9 @@ use crate::agent_diff::AgentDiff;
use crate::profile_selector::{ProfileProvider, ProfileSelector};
use crate::ui::preview::UsageCallout;
-use crate::ui::{AgentNotification, AgentNotificationEvent, BurnModeTooltip};
+use crate::ui::{
+ AgentNotification, AgentNotificationEvent, BurnModeTooltip, UnavailableEditingTooltip,
+};
use crate::{
AgentDiffPane, AgentPanel, ContinueThread, ContinueWithBurnMode, ExpandMessageEditor, Follow,
KeepAll, OpenAgentDiff, OpenHistory, RejectAll, ToggleBurnMode, ToggleProfileSelector,
@@ -1239,6 +1241,8 @@ impl AcpThreadView {
None
};
+ let agent_name = self.agent.name();
+
v_flex()
.id(("user_message", entry_ix))
.pt_2()
@@ -1292,42 +1296,61 @@ impl AcpThreadView {
.text_xs()
.child(editor.clone().into_any_element()),
)
- .when(editing && editor_focus, |this|
- this.child(
- h_flex()
- .absolute()
- .top_neg_3p5()
- .right_3()
- .gap_1()
- .rounded_sm()
- .border_1()
- .border_color(cx.theme().colors().border)
- .bg(cx.theme().colors().editor_background)
- .overflow_hidden()
- .child(
- IconButton::new("cancel", IconName::Close)
- .icon_color(Color::Error)
- .icon_size(IconSize::XSmall)
- .on_click(cx.listener(Self::cancel_editing))
- )
- .child(
- IconButton::new("regenerate", IconName::Return)
- .icon_color(Color::Muted)
- .icon_size(IconSize::XSmall)
- .tooltip(Tooltip::text(
- "Editing will restart the thread from this point."
- ))
- .on_click(cx.listener({
- let editor = editor.clone();
- move |this, _, window, cx| {
- this.regenerate(
- entry_ix, &editor, window, cx,
- );
- }
- })),
- )
- )
- ),
+ .when(editor_focus, |this| {
+ let base_container = h_flex()
+ .absolute()
+ .top_neg_3p5()
+ .right_3()
+ .gap_1()
+ .rounded_sm()
+ .border_1()
+ .border_color(cx.theme().colors().border)
+ .bg(cx.theme().colors().editor_background)
+ .overflow_hidden();
+
+ if message.id.is_some() {
+ this.child(
+ base_container
+ .child(
+ IconButton::new("cancel", IconName::Close)
+ .icon_color(Color::Error)
+ .icon_size(IconSize::XSmall)
+ .on_click(cx.listener(Self::cancel_editing))
+ )
+ .child(
+ IconButton::new("regenerate", IconName::Return)
+ .icon_color(Color::Muted)
+ .icon_size(IconSize::XSmall)
+ .tooltip(Tooltip::text(
+ "Editing will restart the thread from this point."
+ ))
+ .on_click(cx.listener({
+ let editor = editor.clone();
+ move |this, _, window, cx| {
+ this.regenerate(
+ entry_ix, &editor, window, cx,
+ );
+ }
+ })),
+ )
+ )
+ } else {
+ this.child(
+ base_container
+ .border_dashed()
+ .child(
+ IconButton::new("editing_unavailable", IconName::PencilUnavailable)
+ .icon_size(IconSize::Small)
+ .icon_color(Color::Muted)
+ .style(ButtonStyle::Transparent)
+ .tooltip(move |_window, cx| {
+ cx.new(|_| UnavailableEditingTooltip::new(agent_name.into()))
+ .into()
+ })
+ )
+ )
+ }
+ }),
)
.into_any()
}
diff --git a/crates/agent_ui/src/ui.rs b/crates/agent_ui/src/ui.rs
index e27a224240..ada973cddf 100644
--- a/crates/agent_ui/src/ui.rs
+++ b/crates/agent_ui/src/ui.rs
@@ -4,9 +4,11 @@ mod context_pill;
mod end_trial_upsell;
mod onboarding_modal;
pub mod preview;
+mod unavailable_editing_tooltip;
pub use agent_notification::*;
pub use burn_mode_tooltip::*;
pub use context_pill::*;
pub use end_trial_upsell::*;
pub use onboarding_modal::*;
+pub use unavailable_editing_tooltip::*;
diff --git a/crates/agent_ui/src/ui/unavailable_editing_tooltip.rs b/crates/agent_ui/src/ui/unavailable_editing_tooltip.rs
new file mode 100644
index 0000000000..78d4c64e0a
--- /dev/null
+++ b/crates/agent_ui/src/ui/unavailable_editing_tooltip.rs
@@ -0,0 +1,29 @@
+use gpui::{Context, IntoElement, Render, Window};
+use ui::{prelude::*, tooltip_container};
+
+pub struct UnavailableEditingTooltip {
+ agent_name: SharedString,
+}
+
+impl UnavailableEditingTooltip {
+ pub fn new(agent_name: SharedString) -> Self {
+ Self { agent_name }
+ }
+}
+
+impl Render for UnavailableEditingTooltip {
+ fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement {
+ tooltip_container(window, cx, |this, _, _| {
+ this.child(Label::new("Unavailable Editing")).child(
+ div().max_w_64().child(
+ Label::new(format!(
+ "Editing previous messages is not available for {} yet.",
+ self.agent_name
+ ))
+ .size(LabelSize::Small)
+ .color(Color::Muted),
+ ),
+ )
+ })
+ }
+}
diff --git a/crates/icons/src/icons.rs b/crates/icons/src/icons.rs
index 38f02c2206..b5f891713a 100644
--- a/crates/icons/src/icons.rs
+++ b/crates/icons/src/icons.rs
@@ -164,6 +164,7 @@ pub enum IconName {
PageDown,
PageUp,
Pencil,
+ PencilUnavailable,
Person,
Pin,
PlayOutlined,