Skip to content

fix: disable llama embeddings by default, switch to opt-in via BRAIN_EMBED_ENABLE #115 - #116

Merged
four-bytes-robby merged 3 commits into
mainfrom
feat/115-db-resilience-yields-tui
Jun 8, 2026
Merged

four-bytes-robby merged 3 commits into
mainfrom
feat/115-db-resilience-yields-tui

Conversation

@four-bytes-robby

@four-bytes-robby four-bytes-robby commented Jun 8, 2026

Copy link
Copy Markdown
Member

Changes

  • Flip BRAIN_EMBED_DISABLE → BRAIN_EMBED_ENABLE (opt-in, default off)
  • Update @four-bytes/opencode-plugin-lib 0.2.0 → 0.3.0 (EventBus export)
  • Bump version 1.7.0 → 1.7.1

Closes #115


Summary by cubic

Switches llama embeddings to opt-in (off by default) and improves DB resilience and responsiveness so search isn’t blocked during ingest. Addresses #115.

  • New Features

    • Real embeddings are opt-in via BRAIN_EMBED_ENABLE; graceful fallback to hash-based vectors when disabled or unavailable.
    • EmbeddingService adds a priority queue (search ahead of ingest), batch embeds, and a Promise-locked init.
    • TUI shows a “connecting…” state with stale detection; logs are streamed via app.log for clearer diagnostics.
    • Added scripts/test-llama.ts to validate node-llama-cpp binaries and model loading.
  • Refactors

    • SQLite hardening: busy_timeout 30s, WAL checkpoint at startup and after large ingests, and withDbRetry() for SQLITE_BUSY.
    • Ingest and chunking yield to the event loop (between files and every 50 chunks) to keep the UI and tools responsive.
    • Search/memory ops wrapped with retries and better timeout handling; clearer user-facing messages on contention.
    • Embedding pipeline uses session cache and batch insert; reduced console noise unless BRAIN_DEBUG is set.
  • Migration

    • To enable real embeddings, set BRAIN_EMBED_ENABLE=true (BRAIN_EMBED_DISABLE is no longer used).
    • After upgrading, run a fresh install to pick up the postinstall fix that symlinks node-llama-cpp bins (Linux x64).

Written for commit 681edd1. Summary will update on new commits.

Review in cubic

…115

- schema.ts: busy_timeout 30s, WAL checkpoint, withDbRetry helper
- ingest/index.ts: yield between files, per-file BRAIN_DEBUG timing
- chunker.ts: async windowChunks with yield every 50 chunks
- tui.tsx: 'connecting...' default, red dot, stale detection (2s)
- logger.ts: app.log structured logging, console preserved
- embeddingService.ts: opt-out (BRAIN_EMBED_DISABLE), build:never
- embed.ts: BRAIN_EMBED_DISABLE gate
- four-opencode-brain.ts: retry on search/memory, checkpoint at startup
- package.json: postinstall llama symlink
@four-bytes-robby
four-bytes-robby merged commit e5c8c9e into main Jun 8, 2026
4 checks passed
@four-bytes-robby
four-bytes-robby deleted the feat/115-db-resilience-yields-tui branch June 8, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DB resilience + ingest yields + TUI connecting state + logging fixes

1 participant