fix: work path uses production /opt/gbo when env exists or path exists; mark .bas files indexed=true after compilation
All checks were successful
BotServer CI/CD / build (push) Successful in 3m20s

- 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
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-11 20:16:22 -03:00
parent 5fdb3be5b4
commit cf4a00e16e
2 changed files with 11 additions and 7 deletions

View file

@ -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()

View file

@ -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();