From 9925079729f194dceb5a75afc6c28f5bdec1154a Mon Sep 17 00:00:00 2001 From: Jaakko Vanhala Date: Thu, 9 Apr 2026 19:37:28 +0300 Subject: [PATCH] Korjattu laskenta: poistettu warmup (aiheutti busy-konfliktin) + parempi solmun odotus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ongelma: warmup-prompt käynnisti inferenssin heti yhdistymisen jälkeen, jolloin oikea kpnRun-prompt tuli solmulle kun se oli vielä busy. Solmu lähetti llm_error mutta UI:ssa ei ollut käsittelijää → ikuinen odotus. Korjaukset: 1. Poistettu warmup ensureCoderNode:sta — ei tarvita koska kpnRun käynnistää solmun automaattisesti 2. kpnRun odottaa coderWsReady-lippua max 15s (pollaus 500ms välein) kiinteän 1s viiveen sijaan 3. Selkeä virheilmoitus jos solmu ei käynnisty Co-Authored-By: Claude Opus 4.6 (1M context) --- network-poc/frontend/src/pages/index.astro | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/network-poc/frontend/src/pages/index.astro b/network-poc/frontend/src/pages/index.astro index dfe3717..e087ecc 100644 --- a/network-poc/frontend/src/pages/index.astro +++ b/network-poc/frontend/src/pages/index.astro @@ -1522,8 +1522,14 @@ IMPORTANT: Include get_db() dependency for FastAPI` }, if (!coderWsReady && typeof ensureCoderNode === 'function') { statusDiv.innerHTML = ` → Käynnistetään laskentasolmua...`; await ensureCoderNode(); - // Odotetaan hetki jotta solmu ehtii rekisteröityä hubiin - await new Promise(r => setTimeout(r, 1000)); + // Odotetaan kunnes solmu on varmasti rekisteröitynyt hubiin + for (let i = 0; i < 30 && !coderWsReady; i++) { + await new Promise(r => setTimeout(r, 500)); + } + if (!coderWsReady) { + statusDiv.innerHTML = ` ✗ Laskentasolmun käynnistys epäonnistui`; + return null; + } statusDiv.innerHTML = ` ${model} käsittelee...`; } @@ -3733,15 +3739,6 @@ ${filesHtml} // Odotetaan kunnes Worker on yhdistänyt hubiin await workerStarted; - // Warmup — nyt WS on varmasti auki - if (uiSocket && uiSocket.readyState === 1) { - uiSocket.send(JSON.stringify({ - type: 'user_text', - text: '{"prompt":"warmup","max_tokens":1}', - task_type: 'qwen-coder' - })); - } - if (pendingCodePrompt) { setTimeout(() => { sendCodeToHub(pendingCodePrompt);