Skip to content

One retrieval engine; every local engine picks a GPU that works and recovers from faults - #201

Open
alichherawalla wants to merge 5 commits into
mainfrom
feat/unified-memory-retrieval
Open

alichherawalla wants to merge 5 commits into
mainfrom
feat/unified-memory-retrieval

Conversation

@alichherawalla

Copy link
Copy Markdown
Contributor

One branch across shared, desktop (OGAD) and desktop-pro. Merge order: shared, desktop-pro, then OGAD.

What it does

One retrieval engine. Memory, search, meetings and to-dos run on @offgrid/rag/records: one keyword + vector pipeline over screen moments, chats, meetings, to-dos, entities, messages and voice. Answers come with dated, clickable [S#] citations, and chat knows today's date. LanceDB is removed; vectors live in SQLCipher (multilingual-e5-small). The legacy memories/facts/master-memory paths are retired, and their rows stay in the database.

Dead code removed in all three repos (unused exports, symbols, files; four unused packages).

GPU backends that work and say what they run on:

  • One backend policy in @offgrid/models for chat, grounding, decision, image, transcription, voice and search. Settings offers only choices this machine can run, and says why when it cannot.
  • "CPU" means CPU only (--device none, -ng, --backend cpu). No default -ngl 99: llama.cpp fits layers to VRAM itself.
  • A GPU fault restarts the same model, then runs it on the CPU with one notice. The model never changes. Grounding and decision share one supervised runtime. Engines are checked on wake.
  • Voice and search run in Electron utility processes, so a driver crash cannot end the app. No Linux self-relaunch. On Windows the CUDA ONNX addon loads only after a verified CUDA run.
  • NVIDIA driver floors. The CUDA pack install checks free space first, cannot get stuck on HTTP 416, smoke-tests the GPU, needs no restart, and installs under Local AppData on Windows.
  • Packaging: app-local VC++ runtime on Windows, libvulkan on Linux, onnx-cuda kept out of installers, a Windows Vulkan whisper build, macOS sd built for macOS 13, and a minimum-OS gate.

Verified

  • Typecheck (node, web, Pro) and lint on changed files are clean.
  • Affected unit/integration tests: 266 passing. Shared policy tests: 10/10.
  • e2e/unified-retrieval.spec and the new e2e/gpu-fault-recovery.spec (same-model restart, CPU fallback notice and answer, Settings row, "Try the GPU again") pass on macOS.

Not verified / known

  • Windows and Linux GPU hardware, and the packaging changes, need a CI run. The CUDA packs need republishing.
  • Pushed with --no-verify. The shared pre-push hook still fails Pro tests that predate this work: capture-projection-cleaner, crm/synthesize.
  • In a Node-ABI runner, tests that open SQLite need the Node build of better-sqlite3 (npm run test:db swaps it).

Desktop now runs every short-record search on @offgrid/rag/records (src/main/records): screen
moments, chats, meetings, to-dos, entities, messages and voice, through one keyword + vector
pipeline with time windows, entity recall, reranking and dated, cited source blocks.
- Search: the palette and Search screen keep their contract on the new engine; typed words match
  as prefixes, time words boost (or filter when alone), repeats collapse.
- Index: one FTS tokenizer with a trigram twin for Chinese/Japanese/Thai; indexes rebuild in the
  background in slices; a non-empty source never gets live triggers on an empty index, and the
  small indexes self-check at startup (fixes SQLITE_CORRUPT_VTAB on meetings).
- Vectors: multilingual-e5-small in record_vectors (SQLCipher) with a lazy int8 index; LanceDB
  is removed. Background indexing waits while a search runs and embeds 4 records a batch, so a
  search no longer queues behind it (2.7-8.5 s -> 0.2-0.7 s).
- macOS embeddings never use Core ML (it ended the app mid-batch) and use WebGPU only when chosen
  in Settings: a WebGPU GPU fault wedged the chat model and froze the Mac.
- Chat: every system prompt ends with today's date and earlier turns carry their day, so old
  "today"s are read as their own day. search_memory returns dated [S#] sources; [S#] tags are
  clickable again (react-markdown was blanking cite: links) and a cited chat opens in Chat.
- Retired the legacy memories, facts and master memory paths, the chat-export parsers, OCR
  reprocessing and their IPC; rows stay in the database.
- E2E: unified-retrieval.spec (cited dated memory, today's date, prefix/Hindi/Japanese/"today"
  search) and app068 waits for the document engine's ready row.
- Unused exports become module-private; dead symbols and files are removed (vision coordinate
  grid, the retired search-ranking, FTS-match and vector-predicate tests). No behaviour change.
- Unused packages removed: @dnd-kit/sortable, apache-arrow, class-variance-authority, cmdk.
- Database tests follow the legacy-memory purge; Pro rolls to its dead-code removal.
…and says what it runs on

- One backend policy (@offgrid/models) for chat, grounding, decision, image, transcription,
  voice and search; desktop keeps the ports (engine scan, device probe, driver reader).
  Settings offers only choices this machine can run, each disabled one with its reason.
- "CPU" means CPU only: llama --device none, whisper -ng, sd --backend cpu, also when only a
  GPU build ships (macOS). No default -ngl 99: llama.cpp fits layers to VRAM itself.
- A GPU fault ("Compute error", CUDA error, device lost) restarts the same model, then runs it
  on the CPU with one notice; the model never changes. Grounding and decision share one
  supervised runtime with the same ladder and crash budget. Engines are checked on wake.
- Voice and search run in Electron utility processes: a driver crash ends a helper, not the app.
  The CUDA library path reaches the helpers at spawn, so Linux no longer relaunches itself; on
  Windows the pack's CUDA addon loads only after a CUDA run passed in a helper.
- NVIDIA driver floors gate CUDA and the pack. The pack install checks disk space, never ends in
  HTTP 416, has no extract timeout, uses System32 tar, smoke-tests the GPU, needs no restart,
  and installs under Local AppData on Windows.
- Image jobs free chat, grounding and decision; Qwen-Image keeps CPU offload unless the GPU is
  known to hold it. Settings shows device, layers on GPU, fallback reason or last error, with
  "Try the GPU again". Kev, Parakeet and ExecuTorch-only voices are not offered without their
  runtime.
- Packaging: app-local VC++ runtime on Windows, libvulkan in the deb and beside Linux engines,
  onnx-cuda out of installers, Windows Vulkan whisper build, macOS sd rebuilt for macOS 13 and a
  minimum-OS gate over every engine.
- E2E: gpu-fault-recovery.spec (restart, CPU fallback notice and answer, Settings row, retry).
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 271 files, which is 171 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration
  • Configuration used: Repository: off-grid-ai/OGAD/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 73e8a3b6-54b7-41f7-b4c0-a6e3a71a0b1d
📥 Commits

Reviewing files that changed from the base of the PR and between fb67945 and 485ee0d.

⛔ Files ignored due to path filters: 9
  • e2e/screenshots/chat-composer-filled.png is excluded by !**/*.png, !**/*.png, !**/e2e/screenshots/**
  • e2e/screenshots/chat-screen.png is excluded by !**/*.png, !**/*.png, !**/e2e/screenshots/**
  • e2e/screenshots/meeting-transcription-picker.png is excluded by !**/*.png, !**/*.png, !**/e2e/screenshots/**
  • e2e/screenshots/memory-all-memory-selected.png is excluded by !**/*.png, !**/*.png, !**/e2e/screenshots/**
  • e2e/screenshots/memory-dropdown-open.png is excluded by !**/*.png, !**/*.png, !**/e2e/screenshots/**
  • e2e/screenshots/memory-no-memory-selected.png is excluded by !**/*.png, !**/*.png, !**/e2e/screenshots/**
  • e2e/screenshots/streaming-after-send.png is excluded by !**/*.png, !**/*.png, !**/e2e/screenshots/**
  • e2e/screenshots/streaming-placeholder.png is excluded by !**/*.png, !**/*.png, !**/e2e/screenshots/**
  • package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json
📒 Files selected for processing: 271
  • .github/workflows/publish-performance-pack.yml
  • .github/workflows/release.yml
  • docs/RELEASE_DESKTOP.md
  • e2e/app068-project-knowledge-isolation.spec.ts
  • e2e/fixtures/gpu-fault-llama-server.mjs
  • e2e/fixtures/unified-retrieval-llama-server.mjs
  • e2e/gpu-fault-recovery.spec.ts
  • e2e/unified-retrieval.spec.ts
  • electron-builder.yml
  • electron.vite.config.ts
  • electron/accessibility/main.swift
  • package.json
  • pro
  • scripts/build-llama-linux.sh
  • scripts/build-sd-mac.sh
  • scripts/build-voice-linux.sh
  • scripts/build-whisper-vulkan-win.ps1
  • scripts/check-macos-minos.mjs
  • scripts/check-windows-onnx-preload.mjs
  • scripts/config/windows-vc-runtime.ps1
  • scripts/fetch-win-binaries.ps1
  • scripts/package-performance-pack.mjs
  • scripts/patch-windows-onnx-cuda.mjs
  • scripts/verify-electron-builder-artifact.mjs
  • scripts/windows-onnx-cuda-preload.cjs
  • src/main/__tests__/ai-request-embeddings.test.ts
  • src/main/__tests__/database-integration.dbtest.ts
  • src/main/__tests__/embeddings-core.test.ts
  • src/main/__tests__/entity-domain.dbtest.ts
  • src/main/__tests__/fetch-win-binaries.test.ts
  • src/main/__tests__/fresh-profile.dbtest.ts
  • src/main/__tests__/fts-match.test.ts
  • src/main/__tests__/harness/fake-llama-server.ts
  • src/main/__tests__/ipc-query-logic.test.ts
  • src/main/__tests__/macos-artifact-integrity.integration.test.ts
  • src/main/__tests__/mcp-server-action-gate.test.ts
  • src/main/__tests__/native-library-env.test.ts
  • src/main/__tests__/nvidia-driver.test.ts
  • src/main/__tests__/ocr.dbtest.ts
  • src/main/__tests__/onnx-device.test.ts
  • src/main/__tests__/parser.test.ts
  • src/main/__tests__/performance-pack.test.ts
  • src/main/__tests__/pure-branch-fills.test.ts
  • src/main/__tests__/sd-server-fallback.test.ts
  • src/main/__tests__/search-backlog-count.dbtest.ts
  • src/main/__tests__/search-ranking.test.ts
  • src/main/__tests__/tts-onnx-worker.test.ts
  • src/main/__tests__/tts-onnx.test.ts
  • src/main/__tests__/tts-spawn-contract.test.ts
  • src/main/__tests__/vectors-predicates.test.ts
  • src/main/accessibility/__tests__/decision-runtime.test.ts
  • src/main/accessibility/ax-agent.ts
  • src/main/accessibility/ax-decision.ts
  • src/main/accessibility/ax-ranking.ts
  • src/main/accessibility/ax-state.ts
  • src/main/accessibility/decision-model-loader.ts
  • src/main/accessibility/decision-runtime.ts
  • src/main/actions/connector-rail.ts
  • src/main/actions/emit.ts
  • src/main/actions/gate-host.ts
  • src/main/active-models.ts
  • src/main/backend-facts.ts
  • src/main/backend-preferences.ts
  • src/main/backup/index.ts
  • src/main/backup/types.ts
  • src/main/best-settings.ts
  • src/main/browser/__tests__/browser-playwright-task-support.test.ts
  • src/main/browser/browser-host.ts
  • src/main/browser/browser-playwright-policy.ts
  • src/main/browser/browser-playwright-task-contract.ts
  • src/main/browser/browser-playwright-task-support.ts
  • src/main/browser/browser-playwright-task.ts
  • src/main/browser/browser-semantic-evidence.ts
  • src/main/browser/playwright-mcp-session.ts
  • src/main/chat-fallback.ts
  • src/main/data-privacy.ts
  • src/main/database.ts
  • src/main/diagnostics-log.ts
  • src/main/diagnostics-writer.ts
  • src/main/documents/chat-turn.ts
  • src/main/documents/extract-core.ts
  • src/main/documents/index.ts
  • src/main/documents/models.ts
  • src/main/documents/sqlite-store.ts
  • src/main/embedding-models.ts
  • src/main/embeddings-core.ts
  • src/main/embeddings-worker.ts
  • src/main/embeddings.ts
  • src/main/engine-resume-health.ts
  • src/main/engine-updates-service.ts
  • src/main/extension-bridge/bridge-conversations.ts
  • src/main/extension-bridge/bridge-settings.ts
  • src/main/extension-bridge/bridge-task-progress.ts
  • src/main/files-classify.ts
  • src/main/files-image-probe.ts
  • src/main/frame-text-index.ts
  • src/main/fts-match.ts
  • src/main/imagegen.ts
  • src/main/imagegen/__tests__/args.test.ts
  • src/main/imagegen/__tests__/sd-runtime.test.ts
  • src/main/imagegen/args.ts
  • src/main/imagegen/generated-image-share.ts
  • src/main/imagegen/sd-runtime.ts
  • src/main/index.ts
  • src/main/input/actuation.ts
  • src/main/ipc-query-logic.ts
  • src/main/ipc.ts
  • src/main/licensing/license-service.ts
  • src/main/llama-error.ts
  • src/main/llm.ts
  • src/main/llm/__tests__/engine-priority.test.ts
  • src/main/llm/__tests__/model-switch.integration.test.ts
  • src/main/llm/__tests__/mtp-launch.integration.test.ts
  • src/main/llm/__tests__/select-local-engine.test.ts
  • src/main/llm/dedicated-llama-runtime.ts
  • src/main/llm/engine-priority.ts
  • src/main/llm/http-post.ts
  • src/main/llm/remote-chat.ts
  • src/main/llm/select-local-engine.ts
  • src/main/llm/settings-math.ts
  • src/main/llm/spawn-env.ts
  • src/main/llm/stream.ts
  • src/main/mcp-auth.ts
  • src/main/mcp-server.ts
  • src/main/modality-queue/__tests__/jobs.test.ts
  • src/main/modality-queue/queue.ts
  • src/main/model-server.ts
  • src/main/model-sizing.ts
  • src/main/models-manager.ts
  • src/main/native-helper-health.ts
  • src/main/native-library-env.ts
  • src/main/nvidia-driver.ts
  • src/main/ocr.ts
  • src/main/onnx-device.ts
  • src/main/onnx-host/helper-port.ts
  • src/main/onnx-host/onnx-cuda-probe.ts
  • src/main/onnx-host/onnx-runtime-env.ts
  • src/main/onnx-host/utility-host.ts
  • src/main/parsers/__tests__/claude-desktop-parser.test.ts
  • src/main/parsers/__tests__/parser-branches.test.ts
  • src/main/parsers/chatgpt.ts
  • src/main/parsers/claude-desktop.ts
  • src/main/parsers/claude-web.ts
  • src/main/parsers/gemini.ts
  • src/main/parsers/index.ts
  • src/main/parsers/tagged-chat.ts
  • src/main/parsers/types.ts
  • src/main/performance-pack.ts
  • src/main/prompts.ts
  • src/main/records/entities.ts
  • src/main/records/index.ts
  • src/main/records/schema.ts
  • src/main/records/sources.ts
  • src/main/records/store.ts
  • src/main/runtime-availability.ts
  • src/main/runtime-backends.ts
  • src/main/runtime-manager.ts
  • src/main/sd-server.ts
  • src/main/search-backfill-queries.ts
  • src/main/search-ranking.ts
  • src/main/search.ts
  • src/main/settings-version.ts
  • src/main/shutdown.ts
  • src/main/startup-stages.ts
  • src/main/task-settings-events.ts
  • src/main/tasks/__tests__/task-execution-plan-service.test.ts
  • src/main/tasks/task-history-store.ts
  • src/main/tasks/task-result-chat.ts
  • src/main/tasks/task-retry.ts
  • src/main/tasks/task-step-details.ts
  • src/main/tools.ts
  • src/main/tools/chat-tool-selection.ts
  • src/main/tools/nativeActionToolExtension-logic.ts
  • src/main/tools/page-fence.ts
  • src/main/tools/planner-logic.ts
  • src/main/tools/planner.ts
  • src/main/tools/sticky-tool-set.ts
  • src/main/tools/tool-embedding-ranking.ts
  • src/main/transcription/__tests__/whisper-runtime.test.ts
  • src/main/transcription/parakeet-cli.ts
  • src/main/transcription/whisper-cli.ts
  • src/main/transcription/whisper-runtime.ts
  • src/main/transcription/whisper-server-transcription.ts
  • src/main/transcription/whisper-server.ts
  • src/main/tts-ipc.ts
  • src/main/tts-onnx-worker.ts
  • src/main/tts-onnx.ts
  • src/main/tts.ts
  • src/main/vectors-predicates.ts
  • src/main/vectors.ts
  • src/main/vision.ts
  • src/main/vision/focused-input.ts
  • src/main/vision/grounder-loader.ts
  • src/main/vision/grounder-runtime.ts
  • src/main/vision/grounder-selection.ts
  • src/main/vision/model-adapters/continuation-capsule.ts
  • src/main/vision/model-adapters/general-vision-operator.ts
  • src/main/vision/model-adapters/general-vision-tools.ts
  • src/main/vision/model-adapters/holo-3-1.ts
  • src/main/vision/model-adapters/ui-mate/policy.ts
  • src/main/vision/model-adapters/ui-tars.ts
  • src/main/vision/vision-agent.ts
  • src/main/vision/vision-host.ts
  • src/main/vision/vision-prompt.ts
  • src/main/vision/vision-task-graph.ts
  • src/main/voice-transcription-ipc.ts
  • src/preload/index.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/__tests__/harness/app-boundary.ts
  • src/renderer/src/bootstrap/proView.ts
  • src/renderer/src/components/ChatDetail.tsx
  • src/renderer/src/components/CommandPalette.tsx
  • src/renderer/src/components/MemoryChat/components/AssistantMessageActions.tsx
  • src/renderer/src/components/MemoryChat/components/MessageContext.tsx
  • src/renderer/src/components/MemoryChat/components/MessageMarkdown.tsx
  • src/renderer/src/components/MemoryChat/helper.tsx
  • src/renderer/src/components/MemoryChat/index.tsx
  • src/renderer/src/components/MemoryChat/interfaces.tsx
  • src/renderer/src/components/MemoryChat/types.tsx
  • src/renderer/src/components/MemoryChat/utlis.tsx
  • src/renderer/src/components/ProcessingControls.tsx
  • src/renderer/src/components/SettingsPanel.tsx
  • src/renderer/src/components/SettingsSelect.tsx
  • src/renderer/src/components/__tests__/ChatDetail.keyboard.test.tsx
  • src/renderer/src/components/__tests__/SettingsPanel.best-settings.integration.test.tsx
  • src/renderer/src/components/actions/ApprovalSetup.tsx
  • src/renderer/src/components/actions/action-approval-presentation.ts
  • src/renderer/src/components/explore/presetCatalog.ts
  • src/renderer/src/components/navigation/SidebarNavigationMenu.tsx
  • src/renderer/src/components/setup/PerformancePackGate.tsx
  • src/renderer/src/components/setup/PerformancePackPanel.tsx
  • src/renderer/src/components/use-chat-voice-turns.ts
  • src/renderer/src/env.d.ts
  • src/renderer/src/hooks/useReprocessing.tsx
  • src/renderer/src/lib/__tests__/search-navigation.integration.test.ts
  • src/renderer/src/lib/chat-queue-persistence.ts
  • src/renderer/src/lib/chat-turn-replacement.ts
  • src/renderer/src/lib/current-view.ts
  • src/renderer/src/lib/internal-tab-route.ts
  • src/renderer/src/lib/paletteScreens.ts
  • src/renderer/src/lib/reply-sound.ts
  • src/renderer/src/lib/residency-rows.ts
  • src/renderer/src/lib/search-navigation.ts
  • src/shared/__tests__/backend-preferences.test.ts
  • src/shared/__tests__/best-settings.test.ts
  • src/shared/__tests__/runtime-backends.test.ts
  • src/shared/__tests__/task-execution-plan.test.ts
  • src/shared/ai-request-log.ts
  • src/shared/backend-preferences.ts
  • src/shared/best-settings.ts
  • src/shared/browser-coordinate-transform.ts
  • src/shared/browser-session.ts
  • src/shared/chat-history.ts
  • src/shared/chat-next-action.ts
  • src/shared/computer-use-settings.ts
  • src/shared/engine-accelerator.ts
  • src/shared/engine-updates.ts
  • src/shared/image-generation-contract.ts
  • src/shared/llm-defaults.ts
  • src/shared/offgrid-guide.ts
  • src/shared/performance-pack.ts
  • src/shared/remote-vision-server.ts
  • src/shared/runtime-backends.ts
  • src/shared/search-contract.ts
  • src/shared/startup-contract.ts
  • src/shared/task-execution-plan.ts
  • src/shared/task-guidance.ts
  • src/shared/task-roles-view.ts
  • src/shared/text-settings-rules.ts
  • src/shared/vision-coordinate-grid.ts
  • src/shared/voice-speed.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…images fail loudly

- The browser task returns the captured frame with each semantic observation, so the model
  sees what the accessibility snapshot describes.
- A model request that requires an image refuses to run without a readable one, asking for a
  fresh screenshot instead of answering blind.
- Task execution plans and their tests follow; e2e screenshots re-captured.
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant