Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Settings › AI: Add agent opens from the Home tab too (#3483, #3513) (#3522)

phanoobf2f9c6fe277f
diff --git a/crates/ui-egui/src/agent_chat/panel.rs b/crates/ui-egui/src/agent_chat/panel.rs
index 0b108f1779..39309352cd 100644
--- a/crates/ui-egui/src/agent_chat/panel.rs
+++ b/crates/ui-egui/src/agent_chat/panel.rs
@@ -64,7 +64,6 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
if !shown(app) {
return;
}
- super::settings::dialog(app, &ctx);
if ctx.input_mut(|i| i.consume_shortcut(&SHORTCUT)) {
toggle(app);
}
diff --git a/crates/ui-egui/src/agent_chat/tests.rs b/crates/ui-egui/src/agent_chat/tests.rs
index 193abff08d..d4ea32c878 100644
--- a/crates/ui-egui/src/agent_chat/tests.rs
+++ b/crates/ui-egui/src/agent_chat/tests.rs
@@ -1699,3 +1699,20 @@ fn an_attached_picture_and_the_views_picture_share_the_viewer() {
let Some(Item::User { pictures, .. }) = chat.items.last() else { panic!("a sent message") };
assert_eq!(pictures.len(), 2);
}
+
+/// Settings › AI › Add agent opens its dialog from the Home tab too (#3483, #3513).
+#[test]
+fn add_agent_opens_its_dialog_from_home() {
+ use crate::scenario::handle_at;
+ let mut h = crate::scenario::Harness::new();
+ h.call("ui.resize", json!({"width": 1600.0, "height": 1000.0}));
+ h.call("ui.home", json!({"open": true}));
+ h.call("ui.prefs", json!({"open": "AI"}));
+ h.frames(4);
+ assert!(h.app.home.open, "Home is showing");
+ let add = handle_at("prefs:ai_add").expect("Add agent is drawn");
+ h.call("ui.click", json!({"x": add.x, "y": add.y}));
+ h.frames(4);
+ assert!(h.app.agent_chat.settings.add.is_some(), "Add agent opened its dialog");
+ assert!(handle_at("ai_add:add").is_some(), "the dialog is drawn over Home");
+}
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 0f9445b4b0..37b6c20fa8 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -1521,6 +1521,10 @@ impl SolveApp {
documents::prompt(self, ui.ctx());
update::show(self, ui.ctx());
install::show(self, ui.ctx());
+ // Settings › AI's Add agent dialog: Settings opens over Home too (#3483).
+ if agent_chat::shown(self) {
+ agent_chat::settings::dialog(self, ui.ctx());
+ }
if self.home.open {
home::show(self, ui);
if self.home.open {