fix: update work directory paths to use botserver-stack/data/system/work
All checks were successful
BotServer CI / build (push) Successful in 7m4s

Updated all hardcoded work/ directory references to use the correct
relative path from the current working directory:
- botserver-stack/data/system/work

This ensures consistent file location resolution regardless of where
botserver is run from (/home/rodriguez/src/gb/ or /opt/gbo/bin/).

Changes:
- local_file_monitor.rs: Use std::env::current_dir() for work_root
- drive_monitor/mod.rs: Use work_root PathBuf for tool compilation
- website_crawler_service.rs: Use std::env::current_dir() for work_path

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-02-22 16:20:07 -03:00
parent 1856215d05
commit 764f058653
3 changed files with 16 additions and 9 deletions

View file

@ -216,7 +216,9 @@ impl WebsiteCrawlerService {
let kb_name = format!("website_{}", sanitize_url_for_kb(&website.url));
let work_path = std::path::PathBuf::from("work")
let work_path = std::env::current_dir()
.unwrap_or_else(|_| std::path::PathBuf::from("."))
.join("botserver-stack/data/system/work")
.join(&bot_name)
.join(format!("{}.gbkb", bot_name))
.join(&kb_name);

View file

@ -57,7 +57,9 @@ impl DriveMonitor {
}
pub fn new(state: Arc<AppState>, bucket_name: String, bot_id: uuid::Uuid) -> Self {
let work_root = PathBuf::from("work");
let work_root = std::env::current_dir()
.unwrap_or_else(|_| PathBuf::from("."))
.join("botserver-stack/data/system/work");
#[cfg(any(feature = "research", feature = "llm"))]
let kb_manager = Arc::new(KnowledgeBaseManager::new(work_root.clone()));
@ -829,9 +831,10 @@ impl DriveMonitor {
.bucket_name
.strip_suffix(".gbai")
.unwrap_or(&self.bucket_name);
let work_dir = format!("./work/{}.gbai/{}.gbdialog", bot_name, bot_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();
let state_clone = Arc::clone(&self.state);
let work_dir_clone = work_dir.clone();
let work_dir_clone = work_dir_str.clone();
let tool_name_clone = tool_name.clone();
let source_content_clone = source_content.clone();
let bot_id = self.bot_id;
@ -840,7 +843,7 @@ impl DriveMonitor {
let local_source_path = format!("{}/{}.bas", work_dir_clone, tool_name_clone);
std::fs::write(&local_source_path, &source_content_clone)?;
let mut compiler = BasicCompiler::new(state_clone, bot_id);
let result = compiler.compile_file(&local_source_path, &work_dir_clone)?;
let result = compiler.compile_file(&local_source_path, &work_dir_str)?;
if let Some(mcp_tool) = result.mcp_tool {
info!(
"MCP tool definition generated with {} parameters",

View file

@ -30,11 +30,13 @@ pub struct LocalFileMonitor {
impl LocalFileMonitor {
pub fn new(state: Arc<AppState>) -> Self {
// Use /opt/gbo/data as the base directory
let data_dir = PathBuf::from("/opt/gbo/data");
// Use botserver-stack/data/system/work as the work directory
let work_root = std::env::current_dir()
.unwrap_or_else(|_| PathBuf::from("."))
.join("botserver-stack/data/system/work");
// Use botserver/work as the work directory for generated files
let work_root = PathBuf::from("work");
// Use /opt/gbo/data as the base directory for source files
let data_dir = PathBuf::from("/opt/gbo/data");
info!("Initializing with data_dir: {:?}, work_root: {:?}", data_dir, work_root);