LearnNewsExamplesServices
Frontmatter
id13867
titleSupervise native Ollama serve lifecycle in Orchestrator
stateClosed
labels
bugaiarchitecturemodel-experience
assigneesneo-gpt
createdAtJun 22, 2026, 3:19 PM
updatedAtJun 22, 2026, 10:38 PM
githubUrlhttps://github.com/neomjs/neo/issues/13867
authorneo-gpt
commentsCount0
parentIssue13852
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtJun 22, 2026, 10:38 PM

Supervise native Ollama serve lifecycle in Orchestrator

Closed v13.1.0/archive-v13-1-0-chunk-5 bugaiarchitecturemodel-experience
neo-gpt
neo-gpt commented on Jun 22, 2026, 3:19 PM

Context

Parent #13852 tracks the full native-Ollama lifecycle gap, including live heavy-session evidence. The current Orchestrator implementation slice is narrower: it wires an orchestrator-owned local-dev ollama serve task and reuses the already-delivered native Ollama readiness helper (#13865) for model residency/context convergence. This child exists so the PR can close the delivered L2 wiring without auto-closing #13852 while its live-evidence AC remains open.

Release classification: boardless (close-target split for an already implemented L2 wiring slice; not a release-blocking scope expansion).

Live latest-open sweep: checked latest 20 open issues on 2026-06-22; #13852 is the parent, #13865 is the readiness-only sibling, #13862 is compose-only, and no existing narrow ollama serve Orchestrator task leaf exists. A2A recency sweep: latest 30 messages checked; only @neo-gpt's own #13852/#13865/#13863 claims overlap this scope.

The Problem

lint-pr-body requires a truthful Resolves #N target. Closing #13852 from the L2 wiring PR would overstate delivery because #13852 still asks for live evidence: with provider set to native Ollama, a heavy session digests after orchestrator boot. The code slice is valuable and testable, but it should close a narrower leaf while #13852 remains the live-validation parent.

The Architectural Reality

  • ai/daemons/orchestrator/taskDefinitions.mjs owns pure child-process task descriptors. It must not read env vars or re-resolve AiConfig directly.
  • ai/daemons/orchestrator/Orchestrator.mjs is the entrypoint that reads AiConfig and forwards concrete values into buildTaskDefinitions().
  • ai/services/graph/providerReadinessHelper.mjs#buildOllamaReadinessConfig is the native-Ollama role-selector source of truth.
  • ai/services/graph/providerReadinessHelper.mjs#ensureOllamaModelsReady owns native Ollama warm-up and loaded-context verification. This ticket consumes that helper; it does not fork readiness logic.
  • ADR 0019 applies: AiConfig is read at the use-site entrypoint and passed as concrete values into pure helpers.

The Fix

Add the local-dev native Ollama lifecycle lane:

  1. Add orchestrator.ollama.enabled to the tracked Tier-1 config template.
  2. Have Orchestrator build native Ollama readiness config from AiConfig and forward concrete host, roles, keep-alive, and resident-model requirements into task definitions.
  3. Add an ollama continuous task that starts ollama serve only when roles select provider ollama.
  4. Derive OLLAMA_HOST, OLLAMA_KEEP_ALIVE, OLLAMA_CONTEXT_LENGTH, and OLLAMA_MAX_LOADED_MODELS for the spawned server from canonical config values.
  5. Use the existing ensureOllamaModelsReady() helper in liveness/preload paths so an already-running Ollama server converges residency/context without spawn churn.
  6. Cover config defaults, pure task construction, Orchestrator getters, and continuous-task scheduling with focused unit tests.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
orchestrator.ollama.enabled ai/config.template.mjs Enables orchestrator-owned native Ollama lifecycle only when provider roles target ollama Task omitted when no native Ollama roles exist JSDoc in config template config.template.spec.mjs
tasks.ollama taskDefinitions.mjs Starts ollama serve, defers duplicate listener reaping, and uses provider liveness instead of PID-only churn No task when disabled or no roles Task JSDoc + tests daemon.spec.mjs, Orchestrator.spec.mjs
Ollama preload/context convergence providerReadinessHelper.mjs Reuses ensureOllamaModelsReady() for num_ctx and residency checks Parent #13852 retains live heavy-session proof Helper JSDoc from #13865 daemon.spec.mjs, Orchestrator.invariants.spec.mjs

Decision Record impact

Aligned with ADR 0019 (AiConfig reactive Provider SSOT). No ADR amendment required.

Acceptance Criteria

  • Tier-1 config exposes orchestrator.ollama.enabled with env override.
  • Orchestrator forwards native Ollama readiness config into buildTaskDefinitions() without duplicating role-selection logic.
  • buildTaskDefinitions() creates no ollama task unless the lane is enabled and at least one role targets native Ollama.
  • tasks.ollama starts ollama serve with environment derived from canonical provider/local-model config.
  • Existing healthy Ollama endpoints are treated as shared infrastructure: no duplicate spawn churn, and readiness/preload still converges model residency/context.
  • Focused unit tests cover the config, task descriptor, getter, and scheduling contracts.

Out of Scope

  • Live heavy-session digestion evidence for the parent #13852.
  • Compose-local-model serving caps (#13862 / PR #13863).
  • Native Ollama loaded-context enforcement helper internals (#13865 / PR #13866).
  • Model-name / JSON-schema provider parity (#13853/#13854).

Related

Parent: #13852. Siblings: #13862, #13865, #13851. Epic/root context: #13624, #13750.

Handoff Retrieval Hints: search Memory Core/A2A for #13852 local-dev native Ollama serve lifecycle, buildOllamaReadinessConfig, ensureOllamaModelsReady, and commit d11cee1c7f.

tobiu referenced in commit c5c4055 - "fix(ai): supervise native Ollama serve lifecycle (#13867) (#13868) on Jun 22, 2026, 10:38 PM
tobiu closed this issue on Jun 22, 2026, 10:38 PM