From b2d6a51ebd1061f095597b858a7550a8ffd07c0b Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Tue, 3 Mar 2026 10:01:33 -0300 Subject: [PATCH] fix: correct tool file path resolution to match architecture - Updated get_tool_bas_path to look in /opt/gbo/data (source) first - Then check botserver-stack/data/system/work (compiled) second - Removed incorrect $HOME/data and $HOME/gb/work paths - Fixes 'Tool file not found' error when executing inscricao tool According to AGENTS.md architecture: - Bots are in /opt/gbo/data primary - They are compiled into work directory by local_file_monitor - tool_executor was looking in wrong directories --- src/core/bot/tool_executor.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/core/bot/tool_executor.rs b/src/core/bot/tool_executor.rs index 29233d04c..32028641b 100644 --- a/src/core/bot/tool_executor.rs +++ b/src/core/bot/tool_executor.rs @@ -340,28 +340,30 @@ impl ToolExecutor { /// Get the path to a tool's .bas file fn get_tool_bas_path(bot_name: &str, tool_name: &str) -> std::path::PathBuf { - let home_dir = std::env::var("HOME").unwrap_or_else(|_| ".".to_string()); - - // Try data directory first - let data_path = Path::new(&home_dir) - .join("data") + // Try source directory first (/opt/gbo/data - primary location for bot source files) + let source_path = Path::new("/opt/gbo/data") .join(format!("{}.gbai", bot_name)) .join(format!("{}.gbdialog", bot_name)) .join(format!("{}.bas", tool_name)); - if data_path.exists() { - return data_path; + if source_path.exists() { + return source_path; } - // Try work directory (for development/testing) - let work_path = Path::new(&home_dir) - .join("gb") - .join("work") + // Try compiled work directory (botserver-stack/data/system/work relative to current dir) + let work_path = std::env::current_dir() + .unwrap_or_else(|_| PathBuf::from(".")) + .join("botserver-stack/data/system/work") .join(format!("{}.gbai", bot_name)) .join(format!("{}.gbdialog", bot_name)) .join(format!("{}.bas", tool_name)); - work_path + if work_path.exists() { + return work_path; + } + + // Fallback to source path for error messages (even if it doesn't exist) + source_path } }