- Added stub start_kb_processor() for non-llm builds
- Added _pending_kb_index field for non-llm builds
- Extracted KB processor logic into start_kb_processor_inner()
- Removed unused is_embedding_server_ready import
This ensures DriveMonitor compiles and runs correctly in production
where CI builds without --features llm.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Added start_kb_processor() method: long-running background task per bot
- check_gbkb_changes now queues KB folders to pending_kb_index (non-blocking)
- KB processor polls pending_kb_index and processes one at a time per bot
- Removed inline tokio::spawn from check_gbkb_changes that was causing 5min timeouts
- Added pending_kb_index field to DriveMonitor struct
This fixes salesianos DriveMonitor timeout - check_for_changes now completes
in seconds instead of hanging on KB embedding/indexing.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Added prefix filter to list_objects_v2 call: only scans {bot}.gbot/
- Removed scanning of .gbkb and .gbdialog paths which caused 5min timeouts
- This fixes salesianos DriveMonitor timeout and embed/index failure
Also fixed header detection for name,value CSV format.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Removed unconditional .skip(1) that was skipping first config line
- Added header detection: skips first line only if it looks like 'key,value' header
- Added validation to skip empty keys
- Also fixed indentation in drive_monitor gbkb file processing
This fixes the issue where config.csv changes on Drive weren't being
synced to bot_configuration database table for salesianos bot.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add ETag tracking for config.csv files in DriveMonitor
- Only download and sync config.csv when ETag changes
- Prevents unnecessary database updates on every check
- Uses __config__ prefix for config.csv state keys
When a .gbkb file is deleted from the bucket, DriveMonitor now:
- Deletes the downloaded file from work directory
- When entire KB folder is empty, removes the folder too
- Prevents disk accumulation of orphaned knowledge base files
When a .bas file is deleted from the bucket, DriveMonitor now:
- Deletes the corresponding .ast compiled file
- Deletes .bas, .mcp.json, .tool.json files from work directory
- Removes the path from file_states tracking
This prevents stale compiled files from accumulating in production.
Fixed bug where DriveMonitor would overwrite indexed=true status after
successful compilation, causing files to be recompiled on every cycle.
Changes:
- Track successful compilations in HashSet before acquiring write lock
- Set indexed=true for successfully compiled files in merge loop
- Preserve indexed status for unchanged files
- Handle compilation failures with proper fail_count tracking
This ensures new .bas files are compiled to .ast once and the indexed
status is preserved, preventing unnecessary recompilation.
- Do not mark .bas files as indexed unconditionally
- Only set indexed=true when compile_tool() completes successfully
- Reset fail_count and last_failed_at on successful compilation
- Retry failed compilations automatically on next cycle
- Fixes permanent compilation failure state for salesianos start.bas
- Filter states by kb_folder_pattern (e.g. 'cartas/', 'proc/')
- Only apply backoff based on files in that specific KB folder
- Each KB folder has independent retry timing
- Skip re-indexing files that failed 3+ times within 1 hour
- Update file_states on indexing success (indexed=true, fail_count=0)
- Update file_states on indexing failure (fail_count++, last_failed_at=now)
- Don't skip KB indexing when embedding server not marked ready yet
- Embedding server health will be detected via wait_for_server() in kb_indexer
- Remove drive_monitor bypass of embedding check - let kb_indexer handle it
- Remove hardcoded URL list for remote API detection
- Try /health first, then probe with HEAD if 404/405
- Re-enable embedding server ready check in drive_monitor
- No more embedding_key hack that skipped health checks entirely
- Bug 1: check_gbkb_changes now preserves indexed=true from previous
state when etag matches, preventing redundant re-indexing every cycle
- Bug 2: USE KB fallback uses bot_id_short (8 chars) instead of random
UUID, matching the collection name convention used by DriveMonitor
- Bug 3: handle_gbkb_change now upserts into kb_collections table after
successful indexing, so USE KB can find the collection at runtime
- Changed ON CONFLICT DO NOTHING to DO UPDATE for kb_collections inserts
- Changed process_gbkb_folder return type to Result<IndexingResult>
File states were stored under /opt/gbo/work/{UUID}/file_states.json
but should be under /opt/gbo/work/{bucket_name}/file_states.json
like other bot data (e.g. /opt/gbo/work/salesianos.gbai/)
Also fixed file_states_static signature to use bucket_name consistently.
- 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
- Removed duplicate file_state_path() and load_file_states() methods
- Kept only new save_file_states_static() helper
- Original methods still exist at lines 79-84 and 87-128
- Fixes compilation errors from previous commit
- Added static save_file_states_static() helper method
- Changed tokio::spawn calls to use Arc::clone instead of Arc::new(self.clone())
- This prevents double Arc wrapping which causes 'dispatch failure' errors
- Fixes config.csv not syncing from bucket to database for salesianos/default bots
- Update get_work_path_default() to check for .env in /opt/gbo/bin/.env
- Update get_stack_path() to check for .env in /opt/gbo/bin/.env
- Update DriveMonitor::new() to use get_work_path() instead of hardcoded path
- Update start_config_watcher() to use get_work_path() instead of hardcoded path
This fixes the issue where botserver was using development paths
(/home/rodriguez/src/gb/botserver-stack/data/system/work) in production
instead of production paths (/opt/gbo/work).
- When system-prompt-file is configured in config.csv, download the file from MinIO
- Save to {bot}.gbai/{bot}.gbot/ folder in work directory
- Config loaded from MinIO (gbo-* buckets)
- Remove all std::env::var calls except VAULT_* and PORT
- get_from_env returns hardcoded defaults only (no env var reading)
- Auth config, rate limits, email, analytics, calendar all use Vault
- WORK_PATH replaced with get_work_path() helper reading from Vault
- .env on production cleaned to only VAULT_ADDR, VAULT_TOKEN, VAULT_CACERT, PORT
- All service IPs/credentials stored in Vault secret/gbo/*
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>
- Escape format placeholders in designer_ai.rs ({{botname}})
- Remove undefined 'prefix' filter in drive_monitor
- Fix type mismatch in use_tool.rs (str vs &String)
- Remove unused TextExpressionMethods import
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add generate_secure_password() for OTP generation during admin bootstrap
- Display admin credentials (username/password) in console on first run
- Save credentials to ~/.gb-setup-credentials file
- Fix Zitadel client to support PAT token authentication
- Replace OAuth2 password grant with Zitadel Session API for login
- Fix get_current_user to fetch user data from Zitadel session
- Return session_id as access_token for proper authentication
- Set email as verified on user creation to skip verification
- Add password grant type to OAuth application config
- Update directory_setup to include proper redirect URIs