remove agent-callable restart tool (blast radius in multi-user model)
Nightly Build / build (push) Has been cancelled

This commit is contained in:
2026-07-22 09:22:11 +01:00
parent 5d5c3ff2ff
commit ff3e6942cc
12 changed files with 14 additions and 59 deletions
-1
View File
@@ -231,7 +231,6 @@ impl ApprovalManager {
let defaults: &[(&str, &str)] = &[
(tn::EXECUTE_CMD, "require"),
(tn::RESTART, "require"),
// Opening a mobile pairing window emits a secret (the QR) into chat:
// it must be a deliberate human action, not LLM-triggerable (plugin.md §11).
("mobile_start_pairing", "require"),
@@ -41,13 +41,6 @@ impl ChatSessionHandler {
} else if tool_name == tn::EXECUTE_CMD {
let cmd = arguments["command"].as_str().unwrap_or("");
em.pending_write(request_id, tool_call_id, "$ execute_cmd".to_string(), None, format!("$ {cmd}")).await;
} else if tool_name == tn::RESTART {
em.pending_write(
request_id, tool_call_id,
"$ restart".to_string(),
None,
"Riavvia il processo (exit -1 → supervisor ricompila e rilancia)".to_string(),
).await;
} else {
em.approval_required(request_id, tool_call_id, tool_name.to_string(), arguments.clone()).await;
}
@@ -1,9 +1,8 @@
use std::sync::Arc;
use tokio::sync::mpsc;
use tokio_util::sync::CancellationToken;
use tracing::{debug, info, trace};
use tracing::{debug, trace};
use crate::tools::tool_names as tn;
use crate::chat_event_bus::ToolCallEvent;
use crate::chatbot::{LlmTurn, ToolCall};
use crate::db::{chat_history, chat_llm_tools};
@@ -264,18 +263,6 @@ impl ChatSessionHandler {
debug!(session_id = self.session_id, tool = %call.name, tool_call_id, "dispatching");
// `restart` calls process::exit — mark the call done in the DB first so it
// doesn't reappear as `pending` after the supervisor relaunches.
if call.name == tn::RESTART {
info!(session_id = self.session_id, tool_call_id, "restart approved — marking done then exiting");
chat_llm_tools::complete(pool, tool_call_id, "Riavvio avviato.", "string").await?;
em.tool_done(tool_call_id, "Riavvio avviato.".to_string(), "string".to_string(), None, None).await;
// Use _exit() to skip C atexit handlers (e.g. Metal GPU cleanup in
// whisper-rs/ggml, which aborts with SIGABRT and yields exit code 134
// instead of 255 — breaking the run.sh restart supervisor).
unsafe { libc::_exit(-1) }
}
// Route the approved call to its executor. `AbortPending` means the
// clarification WS channel closed — end the turn and leave the tool
// `pending` for resume to re-ask.
@@ -358,17 +358,6 @@ impl ChatSessionHandler {
GateOutcome::ChannelClosed => return Ok(true), // pending still, WS disconnected
}
// `restart` calls process::exit and never returns — mark done first.
if tc.name == tn::RESTART {
info!(session_id = self.session_id, tool_call_id = tc.id, "restart approved (resume) — marking done then exiting");
chat_llm_tools::complete(pool, tc.id, "Riavvio avviato.", "string").await?;
em.tool_done(tc.id, "Riavvio avviato.".to_string(), "string".to_string(), None, None).await;
// Use _exit() to skip C atexit handlers (e.g. Metal GPU cleanup in
// whisper-rs/ggml, which aborts with SIGABRT and yields exit code 134
// instead of 255 — breaking the run.sh restart supervisor).
unsafe { libc::_exit(-1) }
}
// Re-run the persisted intent through the SAME dispatcher as a live turn
// (`execute_tool_call`), not the flat `build_execution`. This routes
// sub-agent tools (`execute_task` mode=sync, `execute_subtask`,
-1
View File
@@ -211,7 +211,6 @@ impl Tools {
tool_registry.register(crate::tools::ast_outline::AstOutline::new());
tool_registry.register(crate::tools::exec::ExecuteCmd);
tool_registry.register(crate::tools::read_notification::ReadNotification);
tool_registry.register(crate::tools::restart::Restart);
// Unified listing / toggling across plugins, cron (+ agents for list). MCP
// is no longer agent-managed (blueprint §14): connectors are curated by the
// admin and activated by the user via the Connectors UI/API, not tools.
-1
View File
@@ -43,7 +43,6 @@ pub mod list_secrets;
pub mod notify;
pub mod set_secret;
pub mod read_notification;
pub mod restart;
pub mod show_file;
pub mod toggle_item;
@@ -1,6 +1,5 @@
pub const EXECUTE_TASK: &str = "execute_task";
pub const EXECUTE_SUBTASK: &str = "execute_subtask";
pub const RESTART: &str = "restart";
pub const UPDATE_SCRATCHPAD: &str = "update_scratchpad";
pub const WRITE_TODOS: &str = "write_todos";
pub const ASK_USER_CLARIFICATION: &str = "ask_user_clarification";