diff --git a/apps/server/src/main/kotlin/com/correx/apps/server/Main.kt b/apps/server/src/main/kotlin/com/correx/apps/server/Main.kt index 97ba6a80..e65e3b87 100644 --- a/apps/server/src/main/kotlin/com/correx/apps/server/Main.kt +++ b/apps/server/src/main/kotlin/com/correx/apps/server/Main.kt @@ -441,10 +441,15 @@ fun main() { val seeded = DefaultEventReplayer(eventStore, com.correx.apps.server.health.HealthProjection()) .rebuild(com.correx.apps.server.health.SYSTEM_SESSION) .subjects.mapValues { it.value.status } - // Monitor the llama server only when a llamacpp provider URL is configured — otherwise the - // LLAMA_SERVER subject would report a spurious DEGRADED on a box that runs no local model. + // Monitor the llama server only when one is configured — otherwise the LLAMA_SERVER subject + // would report a spurious DEGRADED on a box that runs no local model. Covers BOTH paths: an + // explicit static [[providers]] url, or the managed [[models]] server at [models].host:port. // A dedicated short-timeout client keeps a hung server from stalling the probe loop. - val llamaProbe = correxConfig.providers.firstOrNull { it.type == "llamacpp" }?.url?.let { url -> + val llamaUrl = correxConfig.providers.firstOrNull { it.type == "llamacpp" }?.url + ?: correxConfig.models.firstOrNull()?.let { + "http://${correxConfig.modelsSettings.host}:${correxConfig.modelsSettings.port}" + } + val llamaProbe = llamaUrl?.let { url -> val healthHttpClient = io.ktor.client.HttpClient(io.ktor.client.engine.cio.CIO) { engine { requestTimeout = LLAMA_HEALTH_TIMEOUT_MS } }