Commit graph

4153 commits

Author SHA1 Message Date
3f3ecc5320 fix: make email tracking and draft saving non-fatal for bots without those tables
All checks were successful
BotServer CI/CD / build (push) Successful in 4m43s
2026-04-04 18:13:46 -03:00
01db253900 fix: add log::info import, fix ContentType parse, remove unused RedisClient import
All checks were successful
BotServer CI/CD / build (push) Successful in 4m38s
2026-04-04 17:49:40 -03:00
5cfd93b050 fix: remove dead code leftover in email/types.rs
Some checks failed
BotServer CI/CD / build (push) Failing after 5m38s
2026-04-04 17:39:12 -03:00
a3ad927a21 fix: remove mime crate dependency, use lettre ContentType for mime types
Some checks failed
BotServer CI/CD / build (push) Failing after 14s
2026-04-04 17:29:45 -03:00
45eb8357cb feat: implement real email sending via lettre + Vault credentials
Some checks failed
BotServer CI/CD / build (push) Failing after 8m6s
- Replace EmailService::send_email stub with full lettre SMTP implementation
- Vault resolution chain: bot-specific → default bot → system fallback
- Seed Vault prod with default email config (contato@pragmatismo.com.br)
- Update all call sites to pass bot_id for Vault lookup
- Support attachments via lettre MultiPart/Attachment API
- Remove unused imports and dead code
2026-04-04 17:16:50 -03:00
0de4565e5a refactor: Generalize WhatsAppAdapter::new to accept &AppState
All checks were successful
BotServer CI/CD / build (push) Successful in 4m55s
- Simplify constructor from (pool, bot_id, cache) to (&state, bot_id)
- Adapter now extracts conn and cache from AppState internally
- Updates 15 call sites across 6 files
- Removes redundant parameter plumbing at every call site
2026-04-04 15:46:10 -03:00
62e9a64340 fix: Remove duplicate code in table_migration.rs
All checks were successful
BotServer CI/CD / build (push) Successful in 4m27s
- Removed duplicate DbColumn struct, PROTECTED_COLUMNS const, and sync_table_schema fn
- File now has single clean implementation with column drop protection
2026-04-04 11:11:22 -03:00
d785d255c6 feat: Add column drop protection in table schema sync
Some checks failed
BotServer CI/CD / build (push) Failing after 2m30s
- Add columns_dropped counter to MigrationResult
- Add PROTECTED_COLUMNS list (id, bot_id, org_id, user_id, created_at, etc.)
- Detect orphaned columns (in DB but not in tables.bas) and drop them
- Protected columns are never dropped automatically
- Uses DROP COLUMN IF EXISTS for safety
- Logs warnings for orphaned columns before dropping
2026-04-04 11:02:47 -03:00
44669c3825 fix: Fix resolve_export_path typo and remove unused PathBuf imports
All checks were successful
BotServer CI/CD / build (push) Successful in 4m28s
2026-04-04 10:23:42 -03:00
5006159008 fix: Fix last E0716 in bootstrap.rs and remove unused PathBuf imports
Some checks failed
BotServer CI/CD / build (push) Failing after 5m47s
2026-04-04 10:16:27 -03:00
be6f0306cc fix: Fix remaining E0716 borrow errors in path refactoring
Some checks failed
BotServer CI/CD / build (push) Has been cancelled
- server.rs: Use PathBuf for cert_dir
- auth_routes.rs: Use PathBuf for pat_path
- qrcode.rs: Bind get_work_path() to local var before unwrap_or
- import_export.rs: Bind get_work_path() to local var in both functions (2 occurrences)
2026-04-04 10:13:40 -03:00
552d58376f fix: Fix compilation errors from path refactoring
Some checks failed
BotServer CI/CD / build (push) Failing after 1m27s
- bootstrap_utils.rs: Change Vec<(&'static str,...)> to Vec<(String,...)> to avoid dangling references
- bootstrap_manager.rs: Use name.as_str() for safe_pkill
- setup.rs: Use PathBuf instead of Path::new with format!
- directory/bootstrap.rs: Use PathBuf for pat_dir
- main.rs: Use PathBuf for vault_init_path_early
2026-04-04 10:04:00 -03:00
7d8f141fc2 refactor: Replace all hardcoded ./botserver-stack paths with get_stack_path()/get_work_path()
Some checks failed
BotServer CI/CD / build (push) Failing after 1m28s
- Adds get_stack_path() helper: returns /opt/gbo in production (.env without botserver-stack), ./botserver-stack in dev
- Adds get_work_path() helper: returns /opt/gbo/work in production, ./botserver-stack/data/system/work in dev
- Updated 35+ files to use dynamic path resolution
- Production system container no longer needs botserver-stack directory
- Work files go to /opt/gbo/work instead of /opt/gbo/bin/botserver-stack
2026-04-04 09:24:44 -03:00
c05e40d35b fix: Use anyhow::anyhow! instead of .into() for error type
All checks were successful
BotServer CI/CD / build (push) Successful in 4m19s
2026-04-04 08:28:54 -03:00
0d3cfbe0f7 fix: Replace Runtime::new().block_on() with thread::spawn in AuthConfig
Some checks failed
BotServer CI/CD / build (push) Failing after 1m14s
- AuthConfig::from_env() was creating a new Runtime and calling block_on
  directly, causing panic when main tokio runtime is already active
- Now uses std:🧵:spawn + new_current_thread().block_on() pattern
- Follows AGENTS.md pattern for async-from-sync bridges
2026-04-04 08:25:43 -03:00
c0c06e92eb ci: Fix sccache by removing --depth 1 shallow clones and --features chat
All checks were successful
BotServer CI/CD / build (push) Successful in 48s
- Remove --depth 1 from git clones (breaks sccache fingerprints)
- Remove --features chat (already in default features)
- Use git pull instead of fetch+checkout for incremental updates
- Properly restart sccache server between builds
- Ensure target directory persists across builds
2026-04-04 08:09:50 -03:00
6ec82c27a6 fix: Replace futures::executor::block_on with thread::spawn in SET USER
All checks were successful
BotServer CI/CD / build (push) Successful in 4m25s
- Fixes panic: Cannot start a runtime from within a runtime
- set_user.rs was using futures::executor::block_on directly in Rhai callback
- Now uses std:🧵:spawn + new_current_thread().block_on() pattern
- This is called during bootstrap and was causing startup crash
2026-04-04 08:01:04 -03:00
7cd759f810 ci: bump version to 6.3.1 to force rebuild
All checks were successful
BotServer CI/CD / build (push) Successful in 10m59s
2026-04-04 07:46:33 -03:00
2a042d400b fix: Replace Handle::try_current().block_on() with thread::spawn pattern
All checks were successful
BotServer CI/CD / build (push) Successful in 2m38s
- Fixes panic: Cannot start a runtime from within a runtime
- kb_statistics.rs: Wrap all async calls in std:🧵:spawn
- post_to.rs: Replace Handle::try_current with thread::spawn + mpsc
- Removes dead Handle::try_current checks from sync functions
- Follows AGENTS.md pattern for async-from-sync callbacks
2026-04-04 07:35:03 -03:00
4d7297243e Fix clippy warnings: reduce 17 warnings to 0
All checks were successful
BotServer CI/CD / build (push) Successful in 6m58s
- Fix double_ended_iterator_last: use next_back() instead of last()
- Fix manual_clamp: use .clamp() instead of min().max()
- Fix too_many_arguments: create KbInjectionContext struct
- Fix needless_borrow: remove unnecessary & reference
- Fix let_and_return: return value directly
- Fix await_holding_lock: drop guard before await
- Fix collapsible_else_if: collapse nested if-else

All changes verified with cargo clippy (0 warnings, 0 errors)
Note: Local botserver crashes with existing panic during LocalFileMonitor initialization
This panic exists in original code too, not caused by these changes
2026-04-03 22:34:43 -03:00
9f55e864ff ci: force rebuild
All checks were successful
BotServer CI/CD / build (push) Successful in 2m31s
2026-04-03 21:42:33 -03:00
b5270133db ci: force rebuild after clearing cached binary
All checks were successful
BotServer CI/CD / build (push) Successful in 46s
2026-04-03 21:38:51 -03:00
a96a25aee9 ci: trigger deploy with transfer_to_human fix
All checks were successful
BotServer CI/CD / build (push) Successful in 48s
2026-04-03 21:32:40 -03:00
eb98574c8a fix(runtime): use TransferResult instead of Result in transfer_to_human
All checks were successful
BotServer CI/CD / build (push) Successful in 5m19s
2026-04-03 20:49:17 -03:00
3f94d23e1f fix(runtime): replace Handle::current().block_on() with std:🧵:spawn in transfer_to_human
Some checks failed
BotServer CI/CD / build (push) Failing after 1m18s
- Handle::current().block_on() panics when called from within a runtime
- replaced all 5 occurrences with std:🧵:spawn + mpsc::channel
- matches the pattern already used across other keyword files
2026-04-03 20:43:48 -03:00
f2f81415e4 fix(ci): use systemctl stop/start instead of killall/nohup
All checks were successful
BotServer CI/CD / build (push) Successful in 46s
2026-04-03 20:39:42 -03:00
684bd87683 fix(ci): remove error masking, show all errors in console
Some checks failed
BotServer CI/CD / build (push) Failing after 3s
2026-04-03 20:36:25 -03:00
72bc18b7de fix(ci): separate deploy steps - backup, kill, transfer, start
All checks were successful
BotServer CI/CD / build (push) Successful in 46s
2026-04-03 20:35:38 -03:00
bf704c0f6e fix(ci): use systemctl restart instead of killall
Some checks failed
BotServer CI/CD / build (push) Has been cancelled
2026-04-03 20:31:45 -03:00
4bf3da36bb fix(ci): wrap all SSH with timeout, combine steps, remove set -e
Some checks failed
BotServer CI/CD / build (push) Has been cancelled
2026-04-03 20:04:31 -03:00
452e674e09 fix(ci): use killall -9 with fuser fallback for reliable process kill
Some checks failed
BotServer CI/CD / build (push) Has been cancelled
2026-04-03 20:01:11 -03:00
bf140a870e fix(ci): resolve deploy step hanging on pkill
Some checks failed
BotServer CI/CD / build (push) Has been cancelled
- pgrep -f botserver matched the SSH command itself causing deadlock
- replaced with pkill -f '/opt/gbo/bin/botserver' || true
- added SSH keepalive (ServerAliveInterval=10, ServerAliveCountMax=3)
- added Step 7: explicitly start botserver after deploy
- fixed unquoted SSH_ARGS causing argument splitting
2026-04-03 19:51:30 -03:00
8019107ebf fix: remove last remaining block_in_place in TALK TO keyword
Some checks failed
BotServer CI/CD / build (push) Failing after 19m14s
This was the only block_in_place left causing the production panic during
bot compilation. Replaced with std:🧵:spawn + mpsc channel pattern.
2026-04-03 18:35:27 -03:00
6f183c63d2 feat: dual-mode service configs - Vault first, fallback to DB/localhost
Some checks failed
BotServer CI/CD / build (push) Has been cancelled
All services now try Vault first (remote/distributed mode), then fall back
to database config, then localhost defaults (local/dev mode).

Services fixed:
- Qdrant/VectorDB: kb_indexer.rs, kb_statistics.rs, bootstrap_utils.rs, kb_context.rs
- LLM/Embedding: email/vectordb.rs (was hardcoded localhost:8082)
- All services: security/integration.rs (postgres, cache, drive, directory, qdrant, llm)

Pattern: SecretsManager::get_X_config_sync() → DB config → localhost default
2026-04-03 15:01:37 -03:00
edff5de662 ci: trigger after fixing all permissions to gbuser
Some checks failed
BotServer CI/CD / build (push) Has been cancelled
2026-04-03 14:27:25 -03:00
750f93e731 ci: trigger after fixing workspace permissions 2026-04-03 14:27:05 -03:00
6e1701b0f3 ci: trigger build with runner 21 online
Some checks failed
BotServer CI/CD / build (push) Failing after 0s
2026-04-03 14:26:08 -03:00
f097f000d8 Fix: nested runtime panic in AuthConfig::from_env()
Some checks failed
BotServer CI/CD / build (push) Failing after 1s
Root cause: AuthConfig::from_env() was creating a new tokio runtime
with Runtime::new() inside an existing runtime during initialization.

Impact: Botserver crashed with "Cannot start a runtime from within a
runtime" panic right after CORS layer initialization.

Fix: Use new_current_thread() + std:🧵:spawn pattern (same as
get_database_url_sync fix) to create an isolated thread for async operations.

Files: src/security/auth_api/config.rs

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

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 14:02:08 -03:00
61642343a8 fix: replace all block_in_place with std:🧵:spawn to fix nested runtime panic
Some checks are pending
BotServer CI/CD / build (push) Waiting to run
Root cause: block_in_place + new_current_thread().block_on() panics when
called from within tokio runtime (including spawn_blocking). Tokio doesn't
allow nested block_on() calls.

Fix: Replace ALL block_in_place patterns with std:🧵:spawn + mpsc channel.
This creates a completely separate OS thread with its own runtime, avoiding
any nesting issues. Works from any context: async, spawn_blocking, or sync.

Files: 14 files across secrets, utils, state, calendar, analytics, email,
and all keyword handlers (universal_messaging, search, book, create_draft,
create_site, hearing/syntax, use_tool, find, admin_email, goals)
2026-04-03 12:54:36 -03:00
4bdf46bdfc fix: use Result instead Option for runtime builder in get_work_path
Some checks are pending
BotServer CI/CD / build (push) Waiting to run
2026-04-03 12:16:08 -03:00
b2a9c8213d fix: use std:🧵:spawn for sync-to-async bridges to avoid nested block_on panic
Some checks are pending
BotServer CI/CD / build (push) Waiting to run
Root cause: new_current_thread().block_on() panics when called from within
an existing tokio runtime (including from spawn_blocking). Tokio doesn't
allow nested block_on() calls.

Fix: Use std:🧵:spawn to create a completely separate OS thread
with its own runtime, communicating via mpsc channel. This works from
any context: async, spawn_blocking, or sync.
2026-04-03 12:12:59 -03:00
21170faea9 fix: remove block_in_place wrappers that panic inside spawn_blocking
Some checks are pending
BotServer CI/CD / build (push) Waiting to run
Root cause: block_in_place + new_current_thread().block_on() panics when
called from within tokio::task::spawn_blocking because block_in_place is
designed for async worker threads, not blocking threads.

Fix: Remove all block_in_place wrappers and use new_current_thread().build().block_on()
directly. This works from both async contexts and spawn_blocking contexts.

Affected: utils.rs (get_database_url_sync, get_work_path)
2026-04-03 12:05:18 -03:00
c2982f2a33 fix: remove unused handle variable warning in get_database_url_sync
Some checks are pending
BotServer CI/CD / build (push) Waiting to run
2026-04-03 11:31:50 -03:00
b628313b4c ci: trigger fresh run after runner 20 registration
Some checks are pending
BotServer CI/CD / build (push) Waiting to run
2026-04-03 11:18:41 -03:00
6f89b72a80 ci: trigger test with host runner
Some checks are pending
BotServer CI/CD / build (push) Waiting to run
2026-04-03 11:14:29 -03:00
b61926dbd6 ci: trigger test with debug runner
Some checks are pending
BotServer CI/CD / build (push) Waiting to run
2026-04-03 11:13:30 -03:00
8f1d6411b5 ci: trigger test with runner 19 (Docker label)
Some checks are pending
BotServer CI/CD / build (push) Waiting to run
2026-04-03 11:00:08 -03:00
354e3402fa ci: trigger test with Docker label fix
Some checks are pending
BotServer CI/CD / build (push) Waiting to run
2026-04-03 10:45:34 -03:00
7ed341de71 ci: trigger test with Docker installed
Some checks failed
BotServer CI/CD / build (push) Failing after 1s
2026-04-03 10:41:53 -03:00
10f34b7f2c ci: trigger test after runner restart
Some checks failed
BotServer CI/CD / build (push) Failing after 1s
2026-04-03 10:39:35 -03:00