Skip to content

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

Agent chat: no per-message limit by default (#6349)

bherbruck128692da0cd6
diff --git a/assets/locales/cs.json b/assets/locales/cs.json
index 0759e77575..2b515fa4aa 100644
--- a/assets/locales/cs.json
+++ b/assets/locales/cs.json
@@ -1583,7 +1583,6 @@
"ui.ai_permissions": "Oprávnění",
"ui.ai_preset": "Předvolba",
"ui.ai_remove": "Odebrat",
- "ui.ai_request_limit": "zastaveno po 24 požadavcích na jednu zprávu; pro pokračování pošlete další zprávu",
"ui.ai_reset": "Obnovit",
"ui.ai_settings": "Nastavení AI…",
"ui.ai_show_features": "Zobrazit funkce AI",
diff --git a/assets/locales/da.json b/assets/locales/da.json
index 5f02b63622..d6cfd05aae 100644
--- a/assets/locales/da.json
+++ b/assets/locales/da.json
@@ -1416,7 +1416,6 @@
"ui.ai_permissions": "Tilladelser",
"ui.ai_preset": "Forudindstilling",
"ui.ai_remove": "Fjern",
- "ui.ai_request_limit": "stoppet efter 24 anmodninger for én besked; send en ny besked for at fortsætte",
"ui.ai_reset": "Nulstil",
"ui.ai_settings": "AI-indstillinger…",
"ui.ai_show_features": "Vis AI-funktioner",
diff --git a/assets/locales/de.json b/assets/locales/de.json
index 30f4108f72..997e902620 100644
--- a/assets/locales/de.json
+++ b/assets/locales/de.json
@@ -1668,7 +1668,6 @@
"ui.ai_permissions": "Berechtigungen",
"ui.ai_preset": "Vorlage",
"ui.ai_remove": "Entfernen",
- "ui.ai_request_limit": "nach 24 Anfragen für eine Nachricht angehalten; senden Sie eine weitere Nachricht, um fortzufahren",
"ui.ai_reset": "Zurücksetzen",
"ui.ai_settings": "KI-Einstellungen…",
"ui.ai_show_features": "KI-Funktionen anzeigen",
diff --git a/assets/locales/en.json b/assets/locales/en.json
index 13f95a5a59..cb4fdd90cc 100644
--- a/assets/locales/en.json
+++ b/assets/locales/en.json
@@ -2280,6 +2280,7 @@
"ui.agent_chat_auth_title": "Sign in to the agent",
"ui.agent_chat_cancel": "Cancel",
"ui.agent_chat_changes": "Changes: {n}, one undo step",
+ "ui.agent_chat_changes_n": "{n} changes",
"ui.agent_chat_changes_of": "{n}/{limit} changes",
"ui.agent_chat_close": "Close",
"ui.agent_chat_command": "Agent command",
@@ -2384,6 +2385,7 @@
"ui.agent_chat_stop_tip": "Stop the agent and everything it started",
"ui.agent_chat_stop_turn_tip": "Stop the agent (Esc). Queued messages stay queued.",
"ui.agent_chat_turn_limit": "Changes per message",
+ "ui.agent_chat_turn_unlimited": "Unlimited",
"ui.agent_chat_undo_changes": "Undo these changes",
"ui.agent_chat_undo_label": "Agent chat: {message}",
"ui.agent_chat_undone": "(undone)",
@@ -2452,7 +2454,6 @@
"ui.ai_preset": "Preset",
"ui.ai_protocol": "Protocol",
"ui.ai_remove": "Remove",
- "ui.ai_request_limit": "stopped after 24 requests for one message; send another message to go on",
"ui.ai_request_timed_out": "The model took longer than {seconds} s. You can raise the request timeout for this endpoint in Preferences › Assistant.",
"ui.ai_request_timeout": "Request timeout",
"ui.ai_request_timeout_hint": "How long one model request to this endpoint may take, from 30 s to an hour. Raise it for a slow local model.",
diff --git a/assets/locales/es.json b/assets/locales/es.json
index c7a8940905..f4ab9b846a 100644
--- a/assets/locales/es.json
+++ b/assets/locales/es.json
@@ -2064,7 +2064,6 @@
"ui.ai_permissions": "Permisos",
"ui.ai_preset": "Preajuste",
"ui.ai_remove": "Eliminar",
- "ui.ai_request_limit": "se ha detenido tras 24 solicitudes en un mensaje; envía otro para continuar",
"ui.ai_reset": "Restablecer",
"ui.ai_settings": "Ajustes de IA…",
"ui.ai_show_features": "Mostrar funciones de IA",
diff --git a/assets/locales/fr.json b/assets/locales/fr.json
index 0df580fc48..c323c3e5e3 100644
--- a/assets/locales/fr.json
+++ b/assets/locales/fr.json
@@ -1430,7 +1430,6 @@
"ui.ai_permissions": "Autorisations",
"ui.ai_preset": "Préréglage",
"ui.ai_remove": "Retirer",
- "ui.ai_request_limit": "arrêté après 24 requêtes pour un message ; envoyez un autre message pour poursuivre",
"ui.ai_reset": "Réinitialiser",
"ui.ai_settings": "Réglages IA…",
"ui.ai_show_features": "Afficher les fonctionnalités IA",
diff --git a/assets/locales/gl.json b/assets/locales/gl.json
index e233f2c2dc..965754b64e 100644
--- a/assets/locales/gl.json
+++ b/assets/locales/gl.json
@@ -1416,7 +1416,6 @@
"ui.ai_permissions": "Permisos",
"ui.ai_preset": "Axuste predefinido",
"ui.ai_remove": "Quitar",
- "ui.ai_request_limit": "detívose tras 24 solicitudes para unha mensaxe; envía outra mensaxe para continuar",
"ui.ai_reset": "Restablecer",
"ui.ai_settings": "Axustes de IA…",
"ui.ai_show_features": "Mostrar as funcións de IA",
diff --git a/assets/locales/hu.json b/assets/locales/hu.json
index 841abd131d..cb190dca26 100644
--- a/assets/locales/hu.json
+++ b/assets/locales/hu.json
@@ -1359,7 +1359,6 @@
"ui.ai_permissions": "Jogosultságok",
"ui.ai_preset": "Előbeállítás",
"ui.ai_remove": "Eltávolítás",
- "ui.ai_request_limit": "egy üzenetre eső 24 kérés után leállt; küldjön újabb üzenetet a folytatáshoz",
"ui.ai_reset": "Visszaállítás",
"ui.ai_settings": "AI-beállítások…",
"ui.ai_show_features": "AI-funkciók megjelenítése",
diff --git a/assets/locales/id.json b/assets/locales/id.json
index fe29b447a4..29577da26a 100644
--- a/assets/locales/id.json
+++ b/assets/locales/id.json
@@ -1359,7 +1359,6 @@
"ui.ai_permissions": "Izin",
"ui.ai_preset": "Preset",
"ui.ai_remove": "Hapus",
- "ui.ai_request_limit": "dihentikan setelah 24 permintaan untuk satu pesan; kirim pesan lain untuk melanjutkan",
"ui.ai_reset": "Reset",
"ui.ai_settings": "Pengaturan AI…",
"ui.ai_show_features": "Tampilkan fitur AI",
diff --git a/assets/locales/it.json b/assets/locales/it.json
index 96b6925f84..849eff42b4 100644
--- a/assets/locales/it.json
+++ b/assets/locales/it.json
@@ -1432,7 +1432,6 @@
"ui.ai_permissions": "Autorizzazioni",
"ui.ai_preset": "Preimpostazione",
"ui.ai_remove": "Rimuovi",
- "ui.ai_request_limit": "arrestato dopo 24 richieste per un messaggio; invia un altro messaggio per proseguire",
"ui.ai_reset": "Reimposta",
"ui.ai_settings": "Impostazioni IA…",
"ui.ai_show_features": "Mostra funzioni IA",
diff --git a/assets/locales/ja.json b/assets/locales/ja.json
index e7b07595ce..44f6a226d1 100644
--- a/assets/locales/ja.json
+++ b/assets/locales/ja.json
@@ -2280,6 +2280,7 @@
"ui.agent_chat_auth_title": "エージェントにサインイン",
"ui.agent_chat_cancel": "キャンセル",
"ui.agent_chat_changes": "{n} 件の変更(元に戻すは1回)",
+ "ui.agent_chat_changes_n": "{n} 件の変更",
"ui.agent_chat_changes_of": "変更 {n}/{limit}",
"ui.agent_chat_close": "閉じる",
"ui.agent_chat_command": "エージェントのコマンド",
@@ -2384,6 +2385,7 @@
"ui.agent_chat_stop_tip": "エージェントと、それが起動したものをすべて停止します",
"ui.agent_chat_stop_turn_tip": "エージェントを停止します(Esc)。待機中のメッセージは待機のままです。",
"ui.agent_chat_turn_limit": "1メッセージあたりの変更数",
+ "ui.agent_chat_turn_unlimited": "無制限",
"ui.agent_chat_undo_changes": "これらの変更を元に戻す",
"ui.agent_chat_undo_label": "エージェントチャット: {message}",
"ui.agent_chat_undone": "(元に戻しました)",
@@ -2452,7 +2454,6 @@
"ui.ai_preset": "プリセット",
"ui.ai_protocol": "プロトコル",
"ui.ai_remove": "削除",
- "ui.ai_request_limit": "1メッセージあたり24リクエストで停止しました。続けるには、もう一度メッセージを送ってください",
"ui.ai_request_timed_out": "モデルの応答に {seconds} 秒以上かかりました。このエンドポイントのリクエストのタイムアウトは、環境設定 › アシスタントで長くできます。",
"ui.ai_request_timeout": "リクエストのタイムアウト",
"ui.ai_request_timeout_hint": "このエンドポイントへのモデルリクエスト1回にかけられる時間です(30秒〜1時間)。遅いローカルモデルでは長くしてください。",
diff --git a/assets/locales/ko.json b/assets/locales/ko.json
index f0c1456edc..1d938767e8 100644
--- a/assets/locales/ko.json
+++ b/assets/locales/ko.json
@@ -1837,7 +1837,6 @@
"ui.ai_permissions": "권한",
"ui.ai_preset": "프리셋",
"ui.ai_remove": "제거",
- "ui.ai_request_limit": "메시지 하나에 24번 요청 후 멈췄습니다. 계속하려면 메시지를 하나 더 보내세요",
"ui.ai_reset": "재설정",
"ui.ai_settings": "AI 설정…",
"ui.ai_show_features": "AI 기능 표시",
diff --git a/assets/locales/ms.json b/assets/locales/ms.json
index b4a4619a2c..8452d8d2b5 100644
--- a/assets/locales/ms.json
+++ b/assets/locales/ms.json
@@ -1416,7 +1416,6 @@
"ui.ai_permissions": "Kebenaran",
"ui.ai_preset": "Pratetap",
"ui.ai_remove": "Buang",
- "ui.ai_request_limit": "berhenti selepas 24 permintaan untuk satu mesej; hantar mesej lain untuk meneruskan",
"ui.ai_reset": "Set Semula",
"ui.ai_settings": "Tetapan AI…",
"ui.ai_show_features": "Papar ciri AI",
diff --git a/assets/locales/nl.json b/assets/locales/nl.json
index 10d3aff318..89c8c28f9c 100644
--- a/assets/locales/nl.json
+++ b/assets/locales/nl.json
@@ -1359,7 +1359,6 @@
"ui.ai_permissions": "Machtigingen",
"ui.ai_preset": "Voorinstelling",
"ui.ai_remove": "Verwijderen",
- "ui.ai_request_limit": "gestopt na 24 verzoeken voor één bericht; stuur nog een bericht om verder te gaan",
"ui.ai_reset": "Herstellen",
"ui.ai_settings": "AI-instellingen…",
"ui.ai_show_features": "AI-functies tonen",
diff --git a/assets/locales/pl.json b/assets/locales/pl.json
index da3b85b6a0..605c5e099c 100644
--- a/assets/locales/pl.json
+++ b/assets/locales/pl.json
@@ -1602,7 +1602,6 @@
"ui.ai_permissions": "Uprawnienia",
"ui.ai_preset": "Ustawienie wstępne",
"ui.ai_remove": "Usuń",
- "ui.ai_request_limit": "zatrzymano po 24 żądaniach dla jednej wiadomości; wyślij kolejną wiadomość, aby kontynuować",
"ui.ai_reset": "Resetuj",
"ui.ai_settings": "Ustawienia AI…",
"ui.ai_show_features": "Pokaż funkcje AI",
diff --git a/assets/locales/pt-BR.json b/assets/locales/pt-BR.json
index 78f8ed94c7..4e9b5dac92 100644
--- a/assets/locales/pt-BR.json
+++ b/assets/locales/pt-BR.json
@@ -1423,7 +1423,6 @@
"ui.ai_permissions": "Permissões",
"ui.ai_preset": "Predefinição",
"ui.ai_remove": "Remover",
- "ui.ai_request_limit": "parou após 24 requisições para uma mensagem; envie outra mensagem para continuar",
"ui.ai_reset": "Redefinir",
"ui.ai_settings": "Configurações de IA…",
"ui.ai_show_features": "Mostrar recursos de IA",
diff --git a/assets/locales/ro.json b/assets/locales/ro.json
index 3bdaba4cba..28291ec383 100644
--- a/assets/locales/ro.json
+++ b/assets/locales/ro.json
@@ -1359,7 +1359,6 @@
"ui.ai_permissions": "Permisiuni",
"ui.ai_preset": "Presetare",
"ui.ai_remove": "Elimină",
- "ui.ai_request_limit": "oprit după 24 de cereri pentru un mesaj; trimiteți alt mesaj pentru a continua",
"ui.ai_reset": "Resetează",
"ui.ai_settings": "Setări AI…",
"ui.ai_show_features": "Afișează funcțiile AI",
diff --git a/assets/locales/ru.json b/assets/locales/ru.json
index 8a9cc0dc57..22219473d0 100644
--- a/assets/locales/ru.json
+++ b/assets/locales/ru.json
@@ -1415,7 +1415,6 @@
"ui.ai_permissions": "Разрешения",
"ui.ai_preset": "Пресет",
"ui.ai_remove": "Удалить",
- "ui.ai_request_limit": "остановлено после 24 запросов на одно сообщение; отправьте ещё одно сообщение, чтобы продолжить",
"ui.ai_reset": "Сбросить",
"ui.ai_settings": "Настройки ИИ…",
"ui.ai_show_features": "Показывать функции ИИ",
diff --git a/assets/locales/sv.json b/assets/locales/sv.json
index a84b7a2e1f..01fdfcb24e 100644
--- a/assets/locales/sv.json
+++ b/assets/locales/sv.json
@@ -1359,7 +1359,6 @@
"ui.ai_permissions": "Behörigheter",
"ui.ai_preset": "Förinställning",
"ui.ai_remove": "Ta bort",
- "ui.ai_request_limit": "stoppades efter 24 förfrågningar för ett meddelande; skicka ett nytt meddelande för att fortsätta",
"ui.ai_reset": "Återställ",
"ui.ai_settings": "AI-inställningar…",
"ui.ai_show_features": "Visa AI-funktioner",
diff --git a/assets/locales/tr.json b/assets/locales/tr.json
index 6016b718d7..9ed6e685ea 100644
--- a/assets/locales/tr.json
+++ b/assets/locales/tr.json
@@ -1415,7 +1415,6 @@
"ui.ai_permissions": "İzinler",
"ui.ai_preset": "Şablon",
"ui.ai_remove": "Kaldır",
- "ui.ai_request_limit": "bir mesaj için 24 istekten sonra durduruldu; devam etmek için başka bir mesaj gönderin",
"ui.ai_reset": "Sıfırla",
"ui.ai_settings": "AI ayarları…",
"ui.ai_show_features": "AI özelliklerini göster",
diff --git a/assets/locales/uk.json b/assets/locales/uk.json
index 5b30c5cf81..fff4e5325d 100644
--- a/assets/locales/uk.json
+++ b/assets/locales/uk.json
@@ -1416,7 +1416,6 @@
"ui.ai_permissions": "Дозволи",
"ui.ai_preset": "Набір",
"ui.ai_remove": "Видалити",
- "ui.ai_request_limit": "зупинено після 24 запитів на одне повідомлення; надішліть інше повідомлення, щоб продовжити",
"ui.ai_reset": "Скинути",
"ui.ai_settings": "Налаштування ШІ…",
"ui.ai_show_features": "Показувати функції ШІ",
diff --git a/assets/locales/vi.json b/assets/locales/vi.json
index 5e13a7b3f1..a38e024a11 100644
--- a/assets/locales/vi.json
+++ b/assets/locales/vi.json
@@ -1416,7 +1416,6 @@
"ui.ai_permissions": "Quyền hạn",
"ui.ai_preset": "Mẫu cấu hình sẵn",
"ui.ai_remove": "Xóa",
- "ui.ai_request_limit": "đã dừng sau 24 yêu cầu cho một tin nhắn; gửi tin nhắn khác để tiếp tục",
"ui.ai_reset": "Đặt lại",
"ui.ai_settings": "AI cài đặt…",
"ui.ai_show_features": "Hiển thị các tính năng AI",
diff --git a/assets/locales/zh-TW.json b/assets/locales/zh-TW.json
index 521896d4c2..d607d55193 100644
--- a/assets/locales/zh-TW.json
+++ b/assets/locales/zh-TW.json
@@ -1359,7 +1359,6 @@
"ui.ai_permissions": "權限",
"ui.ai_preset": "預設",
"ui.ai_remove": "移除",
- "ui.ai_request_limit": "每條訊息 24 次請求後已停止;再傳送一條訊息即可繼續",
"ui.ai_reset": "重設",
"ui.ai_settings": "AI 設定…",
"ui.ai_show_features": "顯示 AI 功能",
diff --git a/assets/locales/zh.json b/assets/locales/zh.json
index 1d7ae67b1d..85a5bd7bd4 100644
--- a/assets/locales/zh.json
+++ b/assets/locales/zh.json
@@ -2280,6 +2280,7 @@
"ui.agent_chat_auth_title": "登录智能体",
"ui.agent_chat_cancel": "取消",
"ui.agent_chat_changes": "{n} 项更改,一步撤销",
+ "ui.agent_chat_changes_n": "{n} 项更改",
"ui.agent_chat_changes_of": "更改 {n}/{limit}",
"ui.agent_chat_close": "关闭",
"ui.agent_chat_command": "智能体命令",
@@ -2384,6 +2385,7 @@
"ui.agent_chat_stop_tip": "停止智能体及其启动的所有进程",
"ui.agent_chat_stop_turn_tip": "停止智能体(Esc)。排队的消息仍保持排队。",
"ui.agent_chat_turn_limit": "每条消息的更改数",
+ "ui.agent_chat_turn_unlimited": "不限",
"ui.agent_chat_undo_changes": "撤销这些更改",
"ui.agent_chat_undo_label": "智能体聊天:{message}",
"ui.agent_chat_undone": "(已撤销)",
@@ -2452,7 +2454,6 @@
"ui.ai_preset": "预设",
"ui.ai_protocol": "协议",
"ui.ai_remove": "移除",
- "ui.ai_request_limit": "每条消息 24 次请求后已停止;再发送一条消息即可继续",
"ui.ai_request_timed_out": "模型用时超过 {seconds} 秒。可在“首选项 › 助手”中调高此端点的请求超时。",
"ui.ai_request_timeout": "请求超时",
"ui.ai_request_timeout_hint": "对此端点的一次模型请求最多可用的时间,30 秒到 1 小时。本地模型较慢时请调高。",
diff --git a/crates/ui-egui/src/agent_chat/api_client.rs b/crates/ui-egui/src/agent_chat/api_client.rs
index d4b13678c8..58e75f1ac2 100644
--- a/crates/ui-egui/src/agent_chat/api_client.rs
+++ b/crates/ui-egui/src/agent_chat/api_client.rs
@@ -20,8 +20,6 @@ use super::agents::Protocol;
use super::backend::{ChatBackend, Event, HttpFn, HttpRequest, PromptPart, StartContext, ToolStatus};
use super::process::{AgentProcess, FromAgent, ProcessHandle};
-/// Model requests for one message, at most (each answer with tool calls is one).
-pub const MAX_REQUESTS_PER_TURN: usize = 24;
/// Longest tool result handed back to the model.
const MAX_TOOL_TEXT: usize = 20_000;
/// Messages kept in the conversation (the system note stays).
@@ -276,7 +274,8 @@ impl Worker {
fn turn(&mut self, parts: Vec<PromptPart>) {
self.history.push(user_message(self.cfg.protocol, &parts));
self.trim_history();
- for _ in 0..MAX_REQUESTS_PER_TURN {
+ // No cap on requests: Stop sets `cancel`, checked at the top of every round.
+ loop {
// The history as of here is complete (every tool call answered): a cancelled request
// goes back to it, so no half-finished round is left to confuse the next message.
let sound = self.history.len();
@@ -356,8 +355,6 @@ impl Worker {
self.history.push(json!({"role": "user", "content": results}));
}
}
- self.emit(Event::Text { thought: false, text: format!("\n({})", crate::i18n::tr("ui.ai_request_limit")) });
- self.emit(Event::TurnEnded { reason: "max_turn_requests".into() });
}
/// Keep the conversation bounded and starting at a user message, so neither protocol sees a
diff --git a/crates/ui-egui/src/agent_chat/gate.rs b/crates/ui-egui/src/agent_chat/gate.rs
index ecf49851a4..0674e49b63 100644
--- a/crates/ui-egui/src/agent_chat/gate.rs
+++ b/crates/ui-egui/src/agent_chat/gate.rs
@@ -7,11 +7,14 @@
use serde_json::Value;
-/// Changes the agent may make in one turn (requests that run commands; reads don't count). The
-/// user can continue with another message.
-pub const DEFAULT_TURN_LIMIT: u32 = 24;
-/// Requests of any kind in one turn, so an agent stuck reading the design in a loop stops too.
-pub const MAX_REQUESTS_PER_TURN: u32 = 400;
+/// Changes the agent may make in one turn (requests that run commands; reads don't count); 0 is
+/// no limit, the default. The user can always press Stop.
+pub const DEFAULT_TURN_LIMIT: u32 = 0;
+/// What the limit field shows when the user turns the limit on.
+pub const SEEDED_TURN_LIMIT: u32 = 24;
+/// The default before the limit became optional; saved preferences still carry it, so it reads
+/// as no limit.
+pub const OLD_DEFAULT_TURN_LIMIT: u32 = 24;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Verdict {
diff --git a/crates/ui-egui/src/agent_chat/mod.rs b/crates/ui-egui/src/agent_chat/mod.rs
index 0e36206c2e..950b24f575 100644
--- a/crates/ui-egui/src/agent_chat/mod.rs
+++ b/crates/ui-egui/src/agent_chat/mod.rs
@@ -1395,7 +1395,8 @@ pub fn undo_changes(app: &mut SolveApp, index: usize) {
/// The requests the agent's tools sent through the chat's endpoint: each one passes the gate.
fn pump_tools(app: &mut SolveApp) {
let Some(rx) = app.agent_chat.tools_rx.take() else { return };
- let limit = app.preferences.agent_chat_turn_limit.clamp(1, 1000);
+ let configured = app.preferences.agent_chat_turn_limit;
+ let limit = if configured == 0 { u32::MAX } else { configured.clamp(1, 1000) };
for mut req in rx.try_iter().take(64) {
let refuse = |req: ControlRequest, e: String| {
let _ = req.reply.send(json!({"ok": false, "error": e}));
@@ -1406,10 +1407,6 @@ fn pump_tools(app: &mut SolveApp) {
continue;
};
turn.requests += 1;
- if turn.requests > gate::MAX_REQUESTS_PER_TURN {
- refuse(req, format!("too many requests in one message (at most {})", gate::MAX_REQUESTS_PER_TURN));
- continue;
- }
// Requests without folders of their own stay inside the chat's working folder.
if let Some(o) = req.params.as_object_mut()
&& !o.contains_key("allow_paths")
diff --git a/crates/ui-egui/src/agent_chat/panel.rs b/crates/ui-egui/src/agent_chat/panel.rs
index b15974b653..93a0d63fb2 100644
--- a/crates/ui-egui/src/agent_chat/panel.rs
+++ b/crates/ui-egui/src/agent_chat/panel.rs
@@ -977,10 +977,11 @@ fn desktop_body(app: &mut SolveApp, ui: &mut egui::Ui) {
crate::scenario::publish_handle("agent_chat:pick_context", picker.rect.center());
pick_clicked = picker.clicked();
if let Some(turn) = &app.agent_chat.turn {
- let count = trf(
- "ui.agent_chat_changes_of",
- &[("n", &turn.changes.to_string()), ("limit", &app.preferences.agent_chat_turn_limit.to_string())],
- );
+ let n = turn.changes.to_string();
+ let count = match app.preferences.agent_chat_turn_limit {
+ 0 => trf("ui.agent_chat_changes_n", &[("n", &n)]),
+ limit => trf("ui.agent_chat_changes_of", &[("n", &n), ("limit", &limit.to_string())]),
+ };
ui.label(RichText::new(count).color(Tokens::get().text_dim).size(Tokens::get().font_small));
}
},
diff --git a/crates/ui-egui/src/agent_chat/settings.rs b/crates/ui-egui/src/agent_chat/settings.rs
index 0222734c2f..4c10d4d962 100644
--- a/crates/ui-egui/src/agent_chat/settings.rs
+++ b/crates/ui-egui/src/agent_chat/settings.rs
@@ -248,7 +248,14 @@ fn panel_section(app: &mut SolveApp, ui: &mut egui::Ui) {
}
});
ui_kit::row(ui, tr("ui.agent_chat_turn_limit"), |ui| {
- ui_kit::settings_number(ui, &mut app.preferences.agent_chat_turn_limit, 1..=200, 1.0).on_hover_text(tr("ai.prefs.turn_limit_hint"));
+ let p = &mut app.preferences;
+ let mut unlimited = p.agent_chat_turn_limit == 0;
+ if ui_kit::checkbox(ui, tr("ui.agent_chat_turn_unlimited"), &mut unlimited).changed() {
+ p.agent_chat_turn_limit = if unlimited { 0 } else { gate::SEEDED_TURN_LIMIT };
+ }
+ if !unlimited {
+ ui_kit::settings_number(ui, &mut p.agent_chat_turn_limit, 1..=200, 1.0).on_hover_text(tr("ai.prefs.turn_limit_hint"));
+ }
});
});
ui_kit::text(ui, tr("ai.prefs.privacy_note"), ui_kit::Text::Hint("privacy"));
diff --git a/crates/ui-egui/src/agent_chat/tests.rs b/crates/ui-egui/src/agent_chat/tests.rs
index 3feb5dcc57..ed714a3aaf 100644
--- a/crates/ui-egui/src/agent_chat/tests.rs
+++ b/crates/ui-egui/src/agent_chat/tests.rs
@@ -145,6 +145,7 @@ fn file_actions_wait_for_the_user() {
#[test]
fn the_gate_refuses_and_limits() {
let (mut app, tx) = app_in_a_turn();
+ assert_eq!(app.preferences.agent_chat_turn_limit, 0, "no limit by default");
app.preferences.agent_chat_turn_limit = 2;
let crash = ask(&tx, "engine.execute", json!({"command": "diagnostics.crash_reports", "params": {}}));
let quit = ask(&tx, "app.quit", json!({"force": true}));
diff --git a/crates/ui-egui/src/prefs.rs b/crates/ui-egui/src/prefs.rs
index 77add20370..61d9863bc9 100644
--- a/crates/ui-egui/src/prefs.rs
+++ b/crates/ui-egui/src/prefs.rs
@@ -651,7 +651,7 @@ preference_settings! {
/// negative or past the main screen when the window sits on another one).
agent_chat_popped: bool = false, PAGE_AI;
agent_chat_window: Option<[f32; 4]> = None, PAGE_AI;
- /// Changes the agent may make for one message.
+ /// Changes the agent may make for one message; 0 is no limit.
agent_chat_turn_limit: u32 = crate::agent_chat::gate::DEFAULT_TURN_LIMIT, PAGE_AI;
// ---- Sketch / selection modifier bindings (classic defaults; alternate mapping is opt-in) ----
@@ -2075,6 +2075,10 @@ fn theme_file(app: &SolveApp, id: &str, system_dark: bool) -> serde_json::Value
/// calibration that can't be used as it is (a hand edit) is dropped, so the device is read as it
/// reports rather than spinning the view.
pub fn migrate(mut p: Prefs) -> Prefs {
+ // Every saved file carries the old default limit; it reads as no limit.
+ if p.agent_chat_turn_limit == crate::agent_chat::gate::OLD_DEFAULT_TURN_LIMIT {
+ p.agent_chat_turn_limit = 0;
+ }
if p.orbit_cursor {
p.orbit_around = OrbitAround::Cursor;
p.orbit_cursor = false;
@@ -4057,6 +4061,13 @@ mod tests {
assert!(!app.preferences.orbit_cursor, "and is folded away");
}
+ #[test]
+ fn the_agent_chat_limit_is_off_unless_chosen() {
+ assert_eq!(Prefs::default().agent_chat_turn_limit, 0);
+ assert_eq!(migrate(lenient(&json!({"agent_chat_turn_limit": 24}))).agent_chat_turn_limit, 0, "the old default reads as no limit");
+ assert_eq!(lenient(&json!({"agent_chat_turn_limit": 10})).agent_chat_turn_limit, 10);
+ }
+
#[test]
fn orbiting_around_the_cursor_keeps_that_point_still() {
let mut app = SolveApp::new(solidcraft_engine::Session::default(), Default::default());
diff --git a/docs/agent-chat.md b/docs/agent-chat.md
index a1c8eeda8c..faf5cd2ec5 100644
--- a/docs/agent-chat.md
+++ b/docs/agent-chat.md
@@ -208,7 +208,7 @@ Grok Build also supports `XAI_API_KEY` for users who choose API authentication.
OpenAI-compatible endpoint for its models; an Anthropic-compatible one gets a short message,
because not every such endpoint lists models (Qwen's has no model list). For these agents
SolidCraft runs the conversation itself, with the same tools, limits and questions as for a
- coding agent, and at most 24 model requests per message. **Request timeout** is how long one model request may
+ coding agent, and no cap on model requests per message (Stop ends it). **Request timeout** is how long one model request may
take: 300 s by default, from 30 s to an hour. A slow local model (a large model on modest
hardware, or a long message with many tool results) may need more; raise it here or in the
endpoint's entry under **Agents**, where a change applies from the next request. A request that
@@ -318,9 +318,10 @@ saves, opens or inserts. A sweep's or pattern's `path` (curve ids) and an occurr
everything that's waiting, and a question nobody answers is declined after four minutes. The
[MCP server's folder limits](mcp.md) still apply after you allow: the design's folder, the
recovery folder and the server's own scratch folder.
-- **A limit per message.** The agent may make 24 changes per message by default; you can set
- the number on the AI page. Reading the design doesn't count. When it reaches the limit, it's
- told to stop and report what's left; send another message to let it carry on.
+- **An optional limit per message.** There's none by default. Untick **Unlimited** on the AI
+ page to cap the changes the agent may make per message (it starts at 24). Reading the design
+ doesn't count. At the limit, it's told to stop and report what's left; send another message to
+ let it carry on. **Stop** always works.
- **No crash reports,** whatever the permissions. Crash reports can hold other designs and file
paths.
- **Not the rest of the app.** It can't click the interface, change settings, quit, or drive the