From 1cad2bbde19d3419f8127692a1a71736e7de1306 Mon Sep 17 00:00:00 2001 From: kami Date: Fri, 29 May 2026 20:59:16 +0400 Subject: [PATCH] fix: set default capabilities on LlamaCpp provider to unblock router MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LlamaCppInferenceProvider was created with empty capabilities, causing NoEligibleProviderException when the router requested ModelCapability.General. FirstAvailableRoutingStrategy requires declared capabilities to cover all requested ones — empty set satisfied nothing. Add a DEFAULT_LLAMA_CAPABILITIES constant with General, Coding, Reasoning, Summarization, and ToolCalling scores, and pass it through createLlamaCppProvider() to ModelDescriptor. Existing callers get sensible defaults automatically. This is the root cause of the 'router not connected — epic 14' placeholder: the server-side error (capability mismatch) sent a ProtocolError instead of a RouterResponseMessage, so the TUI never set routerConnected=true. --- .../correx/infrastructure/InfrastructureModule.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/infrastructure/src/main/kotlin/com/correx/infrastructure/InfrastructureModule.kt b/infrastructure/src/main/kotlin/com/correx/infrastructure/InfrastructureModule.kt index e71f0507..382e9ba2 100644 --- a/infrastructure/src/main/kotlin/com/correx/infrastructure/InfrastructureModule.kt +++ b/infrastructure/src/main/kotlin/com/correx/infrastructure/InfrastructureModule.kt @@ -8,8 +8,10 @@ import com.correx.core.artifacts.repository.ArtifactRepository import com.correx.core.artifactstore.ArtifactStore import com.correx.core.events.EventDispatcher import com.correx.core.events.stores.EventStore +import com.correx.core.inference.CapabilityScore import com.correx.core.inference.InferenceProvider import com.correx.core.inference.InferenceRouter +import com.correx.core.inference.ModelCapability import com.correx.core.inference.Tokenizer import com.correx.core.router.DefaultRouterContextBuilder import com.correx.core.router.DefaultRouterFacade @@ -53,6 +55,14 @@ object InfrastructureModule { private val defaultArtifactsRoot: String = "${System.getProperty("user.home")}/.config/correx/artifacts" + private val DEFAULT_LLAMA_CAPABILITIES: Set = setOf( + CapabilityScore(ModelCapability.General, 1.0), + CapabilityScore(ModelCapability.Coding, 0.7), + CapabilityScore(ModelCapability.Reasoning, 0.6), + CapabilityScore(ModelCapability.Summarization, 0.8), + CapabilityScore(ModelCapability.ToolCalling, 0.5), + ) + fun createEventStore(artifactStore: ArtifactStore, dbPath: String = defaultDbPath): EventStore { val dir = java.io.File(dbPath).parentFile if (!dir.exists()) dir.mkdirs() @@ -76,11 +86,13 @@ object InfrastructureModule { modelPath: String, baseUrl: String = "http://127.0.0.1:10000", residencyMode: ResidencyMode = ResidencyMode.PERSISTENT, + capabilities: Set = DEFAULT_LLAMA_CAPABILITIES, ): LlamaCppInferenceProvider = LlamaCppInferenceProvider( descriptor = ModelDescriptor( modelId = modelId, modelPath = modelPath, residencyMode = residencyMode, + capabilities = capabilities, ), baseUrl = baseUrl, )