From 9eef93607321d9aaa5c4e9ea48d4ac5368af13a1 Mon Sep 17 00:00:00 2001 From: kami Date: Sun, 21 Jun 2026 08:36:11 +0000 Subject: [PATCH] =?UTF-8?q?fix(health):=20llama=20probe=20also=20covers=20?= =?UTF-8?q?the=20managed=20[[models]]=20path=20(A=C2=A74)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 64a90e7 gated the probe on a static [[providers]] llamacpp url, missing the primary managed path (sample-config.toml's [[models]], where correx spawns llama-server at [models].host:port and registers no provider entry). Fall back to that host:port when [[models]] is configured so the LLAMA_SERVER subject is monitored on the common setup. Surfaced while drafting the A§4 live-QA plan. Compile green. Co-Authored-By: Claude Opus 4.8 --- .../src/main/kotlin/com/correx/apps/server/Main.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 } }