Commit graph

4715 commits

Author SHA1 Message Date
a0f0b26c95 fix: Runner agora roda como gbuser (não-root)
- Criado serviço systemd para forgejo-runner como gbuser
- Removido runner root antigo
- Todas permissões de /opt/gbo/work agora são gbuser:gbuser
- Fim dos erros de permissão no cache do sccache
2026-04-28 16:31:28 -03:00
c0269fadc2 fix: Use IP instead of hostname for stage deploy
Some checks failed
BotServer CI / build (push) Failing after 1m43s
- Change STAGE_SYSTEM_HOST from 'system' to '10.0.3.10'
- Fixes SSH 'Connection closed by 127.0.0.1' error
- Build successful (17m with sccache + mold)
2026-04-28 16:22:33 -03:00
d9be5e3e51 fix: Add rustup default stable before build
Some checks failed
BotServer CI / build (push) Has been cancelled
- Fixes 'rustup could not choose a version of cargo' error
- Sets stable toolchain as default before cargo build
- Preserves sccache configuration and workspace cache
2026-04-28 16:19:22 -03:00
a41e8973a5 docs: Add formal language guidelines to AGENTS.md
- Use formal language in comments and documentation
- Avoid slang, neologisms, or informal expressions
- Maintain professional tone in code
2026-04-28 16:17:18 -03:00
54882bcddd test: Trigger rebuild to test mold+sccache
Some checks failed
BotServer CI / build (push) Failing after 8s
2026-04-28 16:14:45 -03:00
e25ae1c084 chore: DEV-DEPENDENCIES.sh minimal KISS 2026-04-28 16:09:57 -03:00
685c7d6a96 fix: DEV-DEPENDENCIES.sh só instala ferramentas, não configura cargo
- Remove configuração automática do ~/.cargo/config.toml
- O workspace já tem .cargo/config.toml que sobrescreve o global
- Devs só precisam rodar ./DEV-DEPENDENCIES.sh para instalar mold/lld/clang
- Config do projeto (./.cargo/config.toml) é usado automaticamente
2026-04-28 16:08:56 -03:00
abc8a8eaf3 fix: DEV-DEPENDENCIES.sh usa home dinâmico
- Detecta automaticamente o home do usuário atual
- Substitui /home/gbuser hardcoded por $USER_HOME
- Funciona em qualquer máquina (dev local, CI, etc)
2026-04-28 15:51:56 -03:00
1bf8cd65cd feat: Adicionar mold/lld para linkagem rápida + sccache
All checks were successful
BotServer CI / build (push) Successful in 47m36s
- Adiciona .cargo/config.toml com configuração de linker
- Usa clang + lld para linkagem 30-40% mais rápida
- Adiciona sccache para cache de compilação
- Remove comentários do workflow CI
- Ganho total esperado: 17min → 2-5min (incremental)
2026-04-28 15:10:26 -03:00
c2de4781cc fix: Adicionar sccache explícito no build do workflow CI
Some checks failed
BotServer CI / build (push) Failing after 8s
- Adiciona 'export RUSTC_WRAPPER=sccache' no passo de build
- Adiciona sccache --show-stats antes e depois do build para monitorar cache
- Workflow agora usa sccache corretamente para builds incrementais
- Ganho esperado: 17min → 2-5min (após 1º build)
2026-04-28 15:04:50 -03:00
61897d9dfd Merge branch 'main' of github.com:generalbots/generalbots 2026-04-28 14:59:08 -03:00
f3c3b80822 feat: Adicionar configuração automática do mold/lld no DEV-DEPENDENCIES.sh
- Adiciona função configure_cargo() que cria ~/.cargo/config.toml
- Configura linker clang + lld para linkagem rápida
- Reduz tempo de link em ~30-40%
- Aplica para todas as máquinas de desenvolvimento
2026-04-28 14:57:32 -03:00
1a36f4aed2 fix: Embedding server auto-config and KB indexing fixes
- botserver/src/llm/local.rs:
  * Auto-configure embedding-url when empty (http://localhost:8082/v1/embeddings)
  * Auto-configure llm-url when empty (http://localhost:8081/v1/chat/completions)
  * Persist defaults to bot_configuration table via ConfigManager
  * Fix llama-server command path and add LD_LIBRARY_PATH
  * Fix working_dir for Linux (not just Windows)
  * Fix embedding server args: --embeddings --pooling mean --ctx-size 512

- botserver/src/core/bootstrap/bootstrap_manager.rs:
  * Temp disable alm-ci startup (causes 20s hang in bootstrap)
  * Remove unused alm_ci_health_check import

- Database changes:
  * bot_configuration.embedding-model: 'bge-small-en-v1.5-f32.gguf' (full filename)
  * bot_configuration.embedding-url: 'http://localhost:8082/v1/embeddings' (auto-generated)

- Testing:
  * Embedding server responds on port 8082
  * Generates 384-dimension embeddings
  * KB file exists: minio://default.gbai/default.gbkb/manual/test-kb-manual.txt
  * Next: Verify KB indexing and search functionality

Refs: #498
2026-04-28 14:27:00 -03:00
18396aa316 fix: Otimizar workflow CI - corrigir sccache e paths
Some checks failed
BotServer CI / build (push) Has been cancelled
- Corrigir RUSTC_WRAPPER para usar sccache corretamente
- Corrigir caminho do binary para /opt/gbo/work/target/debug
- Usar hostname 'system' ao invés de IP
- Adicionar comentários sobre features padrão
- Remover killall redundante (systemctl já para)
- Manter features padrão otimizadas (sem ooxmlsdk)

Features padrão já são eficientes:
- chat, automation, cache, llm, vectordb, crawler, drive, directory, kb-extraction
- ooxmlsdk NÃO incluído (apenas em docs feature opcional)
- Economia com sccache: 17min → 2-5min (incremental)
2026-04-28 14:25:07 -03:00
b574564651 fix CI. 2026-04-28 13:58:14 -03:00
11ea023eec fix CI. 2026-04-28 13:36:07 -03:00
5c3284e25f Remove botlib.yaml - botserver/botui workflow includes botlib auto 2026-04-28 12:20:36 -03:00
c6d82e68c4 Remove customer-named test file
Some checks failed
Botlib CI / build (push) Failing after 4m8s
2026-04-28 12:17:02 -03:00
cee6732d78 feat: Unified CI workflow - build botserver + botui, remove tests
Some checks failed
Botlib CI / build (push) Successful in 19s
BotServer CI / build (push) Has been cancelled
- Combined botserver and botui builds in single workflow
- Removed bottest from CI (no test execution)
- Deploy both binaries to STAGE-GBO system container via SSH
- Simplified to single workflow file
- Removed separate bottest.yaml and botui.yaml
2026-04-28 12:16:25 -03:00
ba47818e86 Re-trigger CI with fixed workflow
Some checks failed
Botlib CI / build (push) Successful in 3m44s
Bottest CI / build (push) Has been cancelled
BotUI CI / build (push) Has been cancelled
2026-04-28 11:52:05 -03:00
c26c3a31d6 Trigger CI with updated workflow
Some checks failed
Botlib CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Has been cancelled
2026-04-28 11:28:17 -03:00
984ee848d3 Fix: Hardcode SYSTEM_HOST for deploy to work
Some checks failed
Botlib CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
BotServer CI / build (push) Has been cancelled
- Temporary fix: Hardcoded SYSTEM_HOST to 10.157.134.196
- Issue: Repository variables not being resolved in workflow
- Next: Test deploy works, then fix variable system
2026-04-28 11:21:48 -03:00
60b92024e5 Re-trigger CI for ADD SWITCHER fix
Some checks are pending
Botlib CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
2026-04-28 11:17:18 -03:00
30056c29da Fix: ADD SWITCHER keyword normalization
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
- Root cause: Compiler wasn't converting 'ADD SWITCHER' to 'ADD_SWITCHER'
- Impact: Users writing 'ADD SWITCHER' (with space) had keyword fail to parse
- Files: botserver/src/basic/compiler/mod.rs (added normalization)
- Files: botserver/src/basic/mod.rs (fixed case-sensitive 'AS' check, removed redundant pattern)
- Testing: Verified syntax patterns match after normalization
2026-04-28 09:54:03 -03:00
6083beb248 Fix debug log format
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
2026-04-27 21:11:15 -03:00
6636f376f2 Fix: as_deref -> as_ref for String
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
2026-04-27 21:03:23 -03:00
12e4d1bd21 Use debug! macro for switcher logging (no file logging)
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
2026-04-27 20:59:29 -03:00
1ad2f7e528 Fix: use OpenOptions for file logging instead of non-existent append_to_file
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
2026-04-27 20:53:16 -03:00
8d82efa4e6 Add file-based debug logging to trace switcher storage/retrieval
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
Write to /tmp/switcher_debug.log when add_switcher() and
get_switchers() are called to debug why switchers aren't
rendering on stage.
2026-04-27 20:47:16 -03:00
47988eff92 Add debug logging to trace switcher storage/retrieval
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
Added info! logs to add_switcher() and get_switchers() to debug
why switchers are not rendering on stage.
2026-04-27 20:30:38 -03:00
2cc4fa65df Remove Redis flag - start.bas now runs on every WebSocket connection/message
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
Previously start.bas was prevented from re-running via a Redis flag
(set for 24h). This prevented switchers from being re-sent when
users reloaded the page. Now start.bas executes unconditionally
on every WebSocket connection and every first message.
2026-04-27 20:15:52 -03:00
ce0bb3791a Fix switcher Redis key mismatch: use DB session ID instead of WebSocket session ID
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
The switchers were stored in Redis with the DB session ID (session.id)
but retrieved using the WebSocket session ID, causing switchers to
never be found. Fix by saving session.id before the move into
spawn_blocking closure.
2026-04-27 19:52:37 -03:00
d723974410 fix(drive-monitor): sync bas files when not yet indexed + INFRA.md MinIO docs
Some checks failed
Botlib CI / build (push) Failing after 1s
BotServer CI / build (push) Failing after 1s
Bottest CI / build (push) Failing after 0s
BotUI CI / build (push) Failing after 1s
- Fix DriveMonitor skipping .bas files that exist but have indexed=false
  and same ETag (needs_reindex was computed but not used for bas sync)
- Mark bas files as indexed after successful sync to work dir
- Update INFRA.md: MinIO connection setup (port 9100, creds from drive.service)
- Remove erroneously created bottemplates start.bas (bots live in MinIO)
2026-04-27 17:27:00 -03:00
2eebbe9b0d Issue #495: Add switchers to default template and fix infra paths
Some checks failed
Botlib CI / build (push) Failing after 1s
Bottest CI / build (push) Failing after 0s
BotUI CI / build (push) Failing after 1s
- Add start.bas with ADD SWITCHER keywords (tables, list, cards)
- Remove /opt/gbo/data references from AGENTS.md and INFRA.md
- Bots are stored in MinIO drive, not in /opt/gbo/data
- Update infrastructure paths documentation
2026-04-27 17:44:58 +00:00
091ba6f71c Issue #498: KB indexing fix - add continuation notes
Some checks failed
Botlib CI / build (push) Failing after 1s
Bottest CI / build (push) Failing after 1s
BotUI CI / build (push) Failing after 1s
- Fixed KB indexing logic that skipped re-index when DB showed docs but Qdrant was empty
- Added Qdrant collection validation before skipping indexing
- Updated AGENTS.md with correct log locations for staging/production
- Deployed to staging, awaiting CI completion
- Next: monitor chat.stage for KB search functionality

Continuation instructions:
1. Check CI status on ALM (action_run table in PROD-ALM DB)
2. Verify botserver binary updated on staging system container
3. Test KB search: ask question about PDF content in bot
4. Check /opt/gbo/logs/out.log for DriveMonitor indexing activity
5. Verify Qdrant collection has indexed_vectors_count > 0

Root cause: handle_gbkb_change() only checked DB document_count, not Qdrant state
Fix: Added get_collection_info() call to validate Qdrant has points before skipping
2026-04-27 17:23:59 +00:00
9d82aaa804 docs: Update log locations for staging/production in AGENTS.md
Some checks failed
Botlib CI / build (push) Failing after 3s
Bottest CI / build (push) Failing after 1s
BotUI CI / build (push) Failing after 2s
- Add note to check err.log and out.log in /opt/gbo/logs/ on staging/production
- botserver.log is only for dev environment
2026-04-27 17:15:28 +00:00
e9c5d2442e ci: trigger botserver CI for #495 stage deploy 2026-04-27 17:15:28 +00:00
d33349e4bc ci: re-trigger CI for #495 switcher testing on stage 2026-04-27 17:15:27 +00:00
52dc10c867 ci: trigger botserver CI for #495 stage deploy 2026-04-27 17:15:27 +00:00
b3e5938978 ci: re-trigger CI for #495 switcher testing on stage 2026-04-27 17:15:27 +00:00
50977b5fa7 fix: KB indexing fails when Qdrant collection exists but has no vectors
- Check Qdrant collection exists and has points before skipping re-index
- Previously only checked database document_count, causing issues when:
  * Qdrant collection was deleted but DB still showed docs
  * Vectors were not properly indexed (indexed_vectors_count = 0)
  * New PDFs added to existing KB folder
- Now validates both DB and Qdrant state before deciding to skip indexing
- Logs warning when DB and Qdrant are out of sync

Fixes issue where KB from PDF files in drive were not being indexed to Qdrant
2026-04-27 16:49:38 +00:00
602a7da1dd fix: ADD SWITCHER keyword - compiler early normalization broke Rhai custom syntax
- Remove 'ADD SWITCHER' → 'ADD_SWITCHER' early replacement in preprocess_basic
  which prevented convert_multiword_keywords from properly handling the AS keyword
- Add ADD_SWITCHER (underscore) pattern alongside ADD SWITCHER (space) pattern
  so both forms are correctly converted to Rhai custom syntax
- Fix skip condition: only skip ADD_SWITCHER lines when 'as' is lowercase
  (already properly converted), not when AS is uppercase (needs conversion)
- Fix ADD\s+MEMBER double-escaped regex → ADD_MEMBER + ADD\s+MEMBER patterns
- Add CLEAR SWITCHERS pattern to convert_multiword_keywords
- Add CLEAR_SWITCHERS() skip condition

Closes #495
2026-04-27 11:19:59 +00:00
173418a141 ci: trigger botserver workflow for #495 stage deploy 2026-04-27 11:19:59 +00:00
a41f4cfbf5 ci: trigger botserver CI for #495 stage deploy 2026-04-27 11:19:58 +00:00
e7475125b7 ci: re-trigger CI for #495 switcher testing on stage 2026-04-27 11:19:58 +00:00
75ca8cf513 Update botserver: Add bot access control with org membership check (#499) 2026-04-26 19:53:03 -03:00
7d2d8a5674 feat: Add bot access control with org membership check (#499)
All checks were successful
Botlib CI / build (push) Successful in 53s
BotServer CI / build (push) Successful in 19m23s
Bottest CI / build (push) Successful in 45s
BotUI CI / build (push) Successful in 58s
- Add is_public column to bots table (migration 6.3.2-01)
- Add user_organizations to Diesel schema for org membership lookup
- Implement check_bot_access(): public bots allow all users, private bots
  require user membership in the bot's organization via user_organizations
- Wire access check into websocket_handler before WS upgrade
- Read is_public from bots table instead of bot_configuration
- Add database_name field to Bot model
2026-04-26 19:45:30 -03:00
0911448548 feat: Add switcher toggle functionality
- Added SWITCHER_TOGGLE message type (8) for reprocessing last user message with active switchers
- Backend: Handler fetches last user question from DB, mutates message in-place, injects switcher prompts into system_prompt
- Backend: Switcher replays skip message_history save to avoid duplication
- Frontend: toggleSwitcher() sends SWITCHER_TOGGLE when input empty, sendMessage() when text present
- Frontend: Added TOOL_EXEC and SWITCHER_TOGGLE to MessageType constants
- Fixed session_id shadowing bug in DB query (used session_id_for_query)
- Preserves conversation history for LLM context when reprocessing with switchers
2026-04-26 16:36:03 -03:00
6a64756bfd ci: re-trigger deploy for #495 ADD SWITCHER fix
Some checks failed
Botlib CI / build (push) Successful in 5s
Bottest CI / build (push) Successful in 37s
BotUI CI / build (push) Failing after 20s
2026-04-25 21:45:59 +00:00
bd113323c7 fix: ADD SWITCHER parse_parameters handles AS keyword split (3-param case)
Some checks failed
Botlib CI / build (push) Successful in 24s
BotServer CI / build (push) Failing after 3m42s
Bottest CI / build (push) Successful in 41s
BotUI CI / build (push) Failing after 27s
2026-04-25 21:24:14 +00:00