[PR #3] [MERGED] fix: Initialize repo caches in CLI start & include local providers in demo mode #7

Closed
opened 2026-02-27 20:20:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ownpilot/OwnPilot/pull/3
Author: @silexi
Created: 2/23/2026
Status: Merged
Merged: 2/23/2026
Merged by: @ersinkoc

Base: mainHead: fix/cli-start-missing-repo-init


📝 Commits (3)

  • 8391396 fix: Initialize repository caches in CLI start command
  • 40cf0d9 fix: Include local providers in demo mode detection
  • 6cbdf10 refactor: Move repo initialization to CLI entry point

📊 Changes

4 files changed (+47 additions, -4 deletions)

View changed files

📝 packages/cli/src/index.ts (+26 -2)
📝 packages/gateway/src/index.ts (+5 -0)
📝 packages/gateway/src/routes/agent-service.ts (+9 -1)
📝 packages/gateway/src/routes/settings.ts (+7 -1)

📄 Description

Summary

Two related bugs that break local AI provider support (Ollama, LM Studio, etc.) when running via Docker:

  1. Missing repository initialization in CLI start command — The startAll() function (used by Docker's CMD) skipped all repository cache initialization calls, causing local provider CRUD operations to fail with 404 errors
  2. Demo mode ignores local providersisDemoMode() only checked for cloud provider API keys, so users with only Ollama configured got demo responses instead of real AI

Changes

Commit 1: Initialize repository caches in CLI start command

  • Export initializeSettingsRepo, initializeConfigServicesRepo, initializeLocalProvidersRepo, initializePluginsRepo, and seedConfigServices from @ownpilot/gateway
  • Call them in startAll() after DB adapter init, matching what server.ts does

Commit 2: Include local providers in demo mode detection

  • isDemoMode() in agent-service.ts now checks localProvidersRepo.listProviders() for enabled providers
  • isDemoModeFromSettings() in settings.ts does the same

Reproduction

  1. docker compose --profile postgres up -d
  2. Add Ollama as a local provider via Settings > AI Models
  3. Before fix: "Failed to discover models" + "Failed to delete provider" + demo mode responses
  4. After fix: Models discovered, provider manageable, real AI responses

Test plan

  • docker compose --profile postgres up -d — no "Cache not initialized" warnings after repo init
  • Add Ollama local provider — model discovery succeeds
  • Delete a local provider — succeeds
  • Chat with only Ollama configured — real AI response, no demo mode
  • Chat with only cloud provider configured — still works as before
  • No providers configured — demo mode still activates correctly

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ownpilot/OwnPilot/pull/3 **Author:** [@silexi](https://github.com/silexi) **Created:** 2/23/2026 **Status:** ✅ Merged **Merged:** 2/23/2026 **Merged by:** [@ersinkoc](https://github.com/ersinkoc) **Base:** `main` ← **Head:** `fix/cli-start-missing-repo-init` --- ### 📝 Commits (3) - [`8391396`](https://github.com/ownpilot/OwnPilot/commit/83913967528cd218cb8e6052613cc332f0974309) fix: Initialize repository caches in CLI start command - [`40cf0d9`](https://github.com/ownpilot/OwnPilot/commit/40cf0d925550ee04a848527966847ea8e8637978) fix: Include local providers in demo mode detection - [`6cbdf10`](https://github.com/ownpilot/OwnPilot/commit/6cbdf1074fd26d26cbf9a878cc94980abd37a3d4) refactor: Move repo initialization to CLI entry point ### 📊 Changes **4 files changed** (+47 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/src/index.ts` (+26 -2) 📝 `packages/gateway/src/index.ts` (+5 -0) 📝 `packages/gateway/src/routes/agent-service.ts` (+9 -1) 📝 `packages/gateway/src/routes/settings.ts` (+7 -1) </details> ### 📄 Description ## Summary Two related bugs that break local AI provider support (Ollama, LM Studio, etc.) when running via Docker: 1. **Missing repository initialization in CLI `start` command** — The `startAll()` function (used by Docker's `CMD`) skipped all repository cache initialization calls, causing local provider CRUD operations to fail with 404 errors 2. **Demo mode ignores local providers** — `isDemoMode()` only checked for cloud provider API keys, so users with only Ollama configured got demo responses instead of real AI ## Changes ### Commit 1: Initialize repository caches in CLI start command - Export `initializeSettingsRepo`, `initializeConfigServicesRepo`, `initializeLocalProvidersRepo`, `initializePluginsRepo`, and `seedConfigServices` from `@ownpilot/gateway` - Call them in `startAll()` after DB adapter init, matching what `server.ts` does ### Commit 2: Include local providers in demo mode detection - `isDemoMode()` in `agent-service.ts` now checks `localProvidersRepo.listProviders()` for enabled providers - `isDemoModeFromSettings()` in `settings.ts` does the same ## Reproduction 1. `docker compose --profile postgres up -d` 2. Add Ollama as a local provider via Settings > AI Models 3. **Before fix:** "Failed to discover models" + "Failed to delete provider" + demo mode responses 4. **After fix:** Models discovered, provider manageable, real AI responses ## Test plan - [ ] `docker compose --profile postgres up -d` — no "Cache not initialized" warnings after repo init - [ ] Add Ollama local provider — model discovery succeeds - [ ] Delete a local provider — succeeds - [ ] Chat with only Ollama configured — real AI response, no demo mode - [ ] Chat with only cloud provider configured — still works as before - [ ] No providers configured — demo mode still activates correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:20:07 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OwnPilot#7
No description provided.