From cf4a00e16e5339e642f67fec0637add3dbe697af Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Sat, 11 Apr 2026 20:16:22 -0300 Subject: [PATCH] fix: work path uses production /opt/gbo when env exists or path exists; mark .bas files indexed=true after compilation - get_work_path_default/get_stack_path no longer rely on CWD-relative botserver-stack check which caused wrong output path in production when CI left that directory - DriveMonitor now marks .bas file states as indexed=true after list+compile cycle - Added compile_tool logging for work_dir path --- src/core/shared/utils.rs | 12 ++++++------ src/drive/drive_monitor/mod.rs | 6 +++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/core/shared/utils.rs b/src/core/shared/utils.rs index b3da4caa..958f232c 100644 --- a/src/core/shared/utils.rs +++ b/src/core/shared/utils.rs @@ -112,10 +112,10 @@ pub fn get_work_path() -> String { /// In production (system container with .env but no botserver-stack): /opt/gbo/work /// In development (with botserver-stack directory): ./botserver-stack/data/system/work fn get_work_path_default() -> String { - let has_stack = std::path::Path::new("./botserver-stack").exists(); let has_env = std::path::Path::new("./.env").exists() || std::path::Path::new("/opt/gbo/bin/.env").exists(); - if has_env && !has_stack { + let production_work = std::path::Path::new("/opt/gbo/work"); + if has_env || production_work.exists() { "/opt/gbo/work".to_string() } else { "./botserver-stack/data/system/work".to_string() @@ -123,13 +123,13 @@ fn get_work_path_default() -> String { } /// Returns the stack base path. -/// In production (system container with .env but no botserver-stack): /opt/gbo -/// In development (with botserver-stack directory): ./botserver-stack +/// In production (system container with .env): /opt/gbo +/// In development: ./botserver-stack pub fn get_stack_path() -> String { - let has_stack = std::path::Path::new("./botserver-stack").exists(); let has_env = std::path::Path::new("./.env").exists() || std::path::Path::new("/opt/gbo/bin/.env").exists(); - if has_env && !has_stack { + let production_base = std::path::Path::new("/opt/gbo/bin/botserver"); + if has_env || production_base.exists() { "/opt/gbo".to_string() } else { "./botserver-stack".to_string() diff --git a/src/drive/drive_monitor/mod.rs b/src/drive/drive_monitor/mod.rs index 4761d9b4..780e6019 100644 --- a/src/drive/drive_monitor/mod.rs +++ b/src/drive/drive_monitor/mod.rs @@ -533,7 +533,10 @@ impl DriveMonitor { file_states.remove(&path); } } - for (path, state) in current_files { + for (path, mut state) in current_files { + if path.ends_with(".bas") { + state.indexed = true; + } file_states.insert(path, state); } // Save file states to disk in background to avoid blocking @@ -951,6 +954,7 @@ impl DriveMonitor { .unwrap_or(&self.bucket_name); let work_dir = self.work_root.join(format!("{}.gbai/{}.gbdialog", bot_name, bot_name)); let work_dir_str = work_dir.to_string_lossy().to_string(); + info!("Compiling tool '{}' to work_dir: {}", tool_name, work_dir_str); let state_clone = Arc::clone(&self.state); let work_dir_clone = work_dir_str.clone(); let tool_name_clone = tool_name.clone();