[Migrate local backend from LM Studio to Ollama]#522
Merged
Conversation
…tests green) - Swap local LLM provider to Ollama: base_url 127.0.0.1:11434/v1, model qwen2.5:7b, service label lm_studio -> ollama across client, health, graph, gate, schemas, personality, agentic deepagent + harness proposer - guardrails/config.py fallback defaults migrated (11434 / qwen2.5:7b) - Tests updated to Ollama expectations (conftest, health, client, due-diligence invariants, agentic config) - suite: 1258 pass / 0 fail - New OLLAMA_SETUP.md: install, model pull, OLLAMA_CONTEXT_LENGTH stall guidance (4096 default < 8500 no-stall floor), troubleshooting - New SECURITY.md: security model + accepted dep risks with review dates (chromadb PYSEC-2026-311 embedded-only, nltk PYSEC-2026-597) - closes dangling requirements.txt reference - docs/screenshots/: 5 live terminal.html verification captures (vault hit via Ollama API, triple-gate confirm dialog, offline best-effort deny path, soul console, agentic console 4-gate checklist) Verification: full pinned env (py3.12, torch 2.12.1+cpu, chromadb 1.5.9, langgraph 1.2.6) - 1271 tests: 1258 passed, 0 failed, 13 skipped (live-Postgres). Live gateway smoke-tested against mock Ollama (/v1/models health probe, /v1/chat/completions RAG round trip, triple gate Grok/Claude request shapes, 401/422/429 fail-closed, security headers). pip-audit: no new advisories. bandit: no new findings vs main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates CyClaw's local LLM backend from LM Studio to Ollama. Zero adapter code —
LocalLLMClientkeeps speaking raw OpenAI-compatible HTTP; only endpoints, model tags, service labels, and docs change. Includes full independent verification (test suite + live gateway smoke tests + swarm-sandbox emulation) and closes three review findings.Changes
Ollama migration
config.yaml:provider: ollama,base_url: http://127.0.0.1:11434/v1,model: qwen2.5:7b; stall-math comments updated tonum_ctxsemanticsllm/client.py,utils/health.py,graph.py,gate.py,schemas/api.py,utils/personality.py:lm_studio→ollamaservice labels, error strings, health probe (GET /v1/models)agentic/config.py: deepagent default providerollama@ 11434 (lmstudiostill valid for back-compat)agentic/harness_optimizer/model_adapter.py: proposer provider label →ollamaguardrails/config.py: fallback defaults migrated to 11434 /qwen2.5:7b(was inconsistently left at 1234)Tests (10 stale failures → 0)
conftest.py,test_health.py,test_client.py,test_due_diligence_invariants.py,test_agentic_config.pyupdated to Ollama expectationsDocs
OLLAMA_SETUP.md— install, model pull, andOLLAMA_CONTEXT_LENGTHguidance (Ollama's 4096 default is below the 8,500-token no-stall floor; correct/set parameter num_ctxform, no fake--num_ctxflag)SECURITY.md— security model + accepted dependency risks with review dates (chromadb PYSEC-2026-311, embeddedPersistentClientonly; nltk PYSEC-2026-597). Closes the dangling reference inrequirements.txtdocs/screenshots/— 5 live terminal.html captures from verification (vault hit answered via Ollama API, triple-gate confirm dialog with Send-to-Grok/Claude buttons, deny → offline-best-effort, soul console, agentic console 4-gate checklist)Verification
/v1/models,/v1/chat/completions)/healthok (serviceollama),/queryfull RAG round trip,model_used: localBearer,/chat/completions) / Claude (x-api-key+anthropic-version,/messages) / deny →offline-best-effort/ unavailable →offline-best-effortNotes for review
agentic/harness_optimizer/mcp/tools.pyis untouched vs main — the holdout_hidden symlink guard and its 3 tests are intact (an earlier working zip had dropped them; restored before this PR)"LM Studio down"mock strings intest_graph.py/test_runtime_errors.pyare test-authored fixtures, pass fine, and were deliberately left aloneOLLAMA_CONTEXT_LENGTH>=10000(or per-modelnum_ctx) — see OLLAMA_SETUP.md