Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

tech(KF-32, KF-33, KF-28): der Desktop dekodiert doppelt kodierte Argumente jetzt wie der Mobile-Client, die verwaiste Bildroute ist weg, und ein Kommentar verspricht nicht mehr, was der Rumpf nicht tut

David89ecb1c0762e
diff --git a/mobile-client/client.js b/mobile-client/client.js
index 2a5b1ea3..28b7c863 100644
--- a/mobile-client/client.js
+++ b/mobile-client/client.js
@@ -112,7 +112,7 @@ import {
//
// Warum <use> und kein <img src="/LU-monogram.svg">: der Remote-Server
// liefert keine Dateien aus mobile-client/ aus. Er baut EINE Seite
- // (src-tauri/src/mobile_page.rs) und haelt daneben genau eine Bildroute,
+ // (src-tauri/src/mobile_page.rs) und hielt daneben bis KF-33 genau eine Bildroute (jetzt keine),
// `/LU-monogram-white.png`. Ein SVG-Pfad waere ein 404 gewesen. Inline
// gebraucht die Seite gar keine Route mehr.
//
diff --git a/mobile-client/index.html b/mobile-client/index.html
index bbd1ff6f..ea3d14f4 100644
--- a/mobile-client/index.html
+++ b/mobile-client/index.html
@@ -24,7 +24,8 @@
PNG ueber /LU-monogram-white.png; die Desktop-App war da laengst auf
public/LU-monogram.svg umgestellt (0b9c0f66). Inline statt <img src>,
weil der Remote-Server keine Dateien aus mobile-client/ ausliefert: er
- baut EINE Seite und haelt genau eine Bildroute. Die Pfaddaten sind
+ baut EINE Seite und haelt keine Bildroute mehr — die eine, die es gab,
+ fiel mit KF-33, weil sie nach diesem Sprite keinen Aufrufer hatte. Die Pfaddaten sind
Byte fuer Byte die aus public/LU-monogram.svg — festgehalten von
src/api/__tests__/mobile-hauszeichen-ist-vektor.test.ts. -->
<svg class="svg-sprite" aria-hidden="true" focusable="false"><symbol id="lu-monogram" viewBox="0 0 1024.000000 1024.000000" preserveAspectRatio="xMidYMid meet"><g transform="translate(0.000000,1024.000000) scale(0.100000,-0.100000)" fill="#ffffff" stroke="none"> <path d="M6400 8490 c0 -7 -560 -10 -1660 -10 -1100 0 -1660 -3 -1660 -10 0 -5 -22 -10 -50 -10 -27 0 -50 -4 -50 -10 0 -5 -18 -10 -40 -10 -22 0 -40 -4 -40 -10 0 -5 -13 -10 -30 -10 -16 0 -30 -4 -30 -10 0 -5 -13 -10 -30 -10 -16 0 -30 -4 -30 -10 0 -5 -13 -10 -30 -10 -16 0 -30 -4 -30 -10 0 -5 -9 -10 -20 -10 -11 0 -20 -4 -20 -10 0 -5 -9 -10 -20 -10 -11 0 -20 -4 -20 -10 0 -5 -9 -10 -20 -10 -11 0 -20 -4 -20 -10 0 -5 -8 -10 -18 -10 -10 0 -24 -9 -32 -20 -8 -11 -22 -20 -32 -20 -10 0 -18 -4 -18 -10 0 -5 -8 -10 -18 -10 -10 0 -24 -9 -32 -20 -8 -11 -21 -20 -28 -20 -7 0 -31 -18 -52 -40 -21 -22 -43 -40 -49 -40 -15 0 -201 -186 -201 -201 0 -6 -18 -28 -40 -49 -22 -21 -40 -45 -40 -52 0 -7 -9 -20 -20 -28 -11 -8 -20 -22 -20 -32 0 -10 -4 -18 -10 -18 -5 0 -10 -8 -10 -18 0 -10 -9 -24 -20 -32 -11 -8 -20 -22 -20 -32 0 -10 -4 -18 -10 -18 -5 0 -10 -9 -10 -20 0 -11 -4 -20 -10 -20 -5 0 -10 -9 -10 -20 0 -11 -4 -20 -10 -20 -5 0 -10 -9 -10 -20 0 -11 -4 -20 -10 -20 -5 0 -10 -13 -10 -30 0 -16 -4 -30 -10 -30 -5 0 -10 -13 -10 -30 0 -16 -4 -30 -10 -30 -5 0 -10 -13 -10 -30 0 -16 -4 -30 -10 -30 -5 0 -10 -18 -10 -40 0 -22 -4 -40 -10 -40 -5 0 -10 -22 -10 -50 0 -27 -4 -50 -10 -50 -7 0 -10 -633 -10 -1880 0 -1247 -3 -1880 -10 -1880 -5 0 -10 -18 -10 -40 0 -22 5 -40 10 -40 6 0 10 -43 10 -110 0 -67 4 -110 10 -110 6 0 10 -27 10 -60 0 -33 4 -60 10 -60 6 0 10 -13 10 -30 0 -16 5 -30 10 -30 6 0 10 -18 10 -40 0 -22 5 -40 10 -40 6 0 10 -13 10 -30 0 -16 5 -30 10 -30 6 0 10 -9 10 -20 0 -11 5 -20 10 -20 6 0 10 -13 10 -30 0 -16 5 -30 10 -30 6 0 10 -9 10 -20 0 -11 5 -20 10 -20 6 0 10 -9 10 -20 0 -11 5 -20 10 -20 6 0 10 -8 10 -18 0 -10 9 -24 20 -32 11 -8 20 -22 20 -32 0 -10 5 -18 10 -18 6 0 10 -8 10 -18 0 -10 9 -24 20 -32 11 -8 20 -21 20 -28 0 -7 18 -31 40 -52 22 -21 40 -43 40 -49 0 -15 166 -181 181 -181 5 0 32 -22 59 -50 27 -27 55 -50 62 -50 8 0 20 -9 28 -20 8 -11 22 -20 32 -20 10 0 18 -4 18 -10 0 -5 8 -10 18 -10 10 0 24 -9 32 -20 8 -11 22 -20 32 -20 10 0 18 -4 18 -10 0 -5 9 -10 20 -10 11 0 20 -4 20 -10 0 -5 9 -10 20 -10 11 0 20 -4 20 -10 0 -5 14 -10 30 -10 17 0 30 -4 30 -10 0 -5 9 -10 20 -10 11 0 20 -4 20 -10 0 -5 14 -10 30 -10 17 0 30 -4 30 -10 0 -5 14 -10 30 -10 17 0 30 -4 30 -10 0 -5 18 -10 40 -10 22 0 40 -4 40 -10 0 -6 27 -10 60 -10 33 0 60 -4 60 -10 0 -7 680 -10 2020 -10 1340 0 2020 3 2020 10 0 6 27 10 60 10 33 0 60 4 60 10 0 6 18 10 40 10 22 0 40 5 40 10 0 6 14 10 30 10 17 0 30 5 30 10 0 6 14 10 30 10 17 0 30 5 30 10 0 6 9 10 20 10 11 0 20 5 20 10 0 6 14 10 30 10 17 0 30 5 30 10 0 6 9 10 20 10 11 0 20 5 20 10 0 6 9 10 20 10 11 0 20 5 20 10 0 6 8 10 18 10 10 0 24 9 32 20 8 11 22 20 32 20 10 0 18 5 18 10 0 6 7 10 16 10 9 0 29 14 44 30 15 17 33 30 40 30 7 0 25 14 40 30 15 17 33 30 39 30 15 0 201 186 201 201 0 6 14 24 30 39 17 15 30 33 30 40 0 7 14 25 30 40 17 15 30 35 30 44 0 9 5 16 10 16 6 0 10 8 10 18 0 10 9 24 20 32 11 8 20 22 20 32 0 10 5 18 10 18 6 0 10 9 10 20 0 11 5 20 10 20 6 0 10 9 10 20 0 11 5 20 10 20 6 0 10 14 10 30 0 17 5 30 10 30 6 0 10 9 10 20 0 11 5 20 10 20 6 0 10 14 10 30 0 17 5 30 10 30 6 0 10 14 10 30 0 17 5 30 10 30 6 0 10 18 10 40 0 22 5 40 10 40 6 0 10 27 10 60 0 33 4 60 10 60 7 0 10 683 10 2030 0 1347 -3 2030 -10 2030 -5 0 -10 23 -10 50 0 28 -4 50 -10 50 -5 0 -10 18 -10 40 0 22 -4 40 -10 40 -5 0 -10 14 -10 30 0 17 -4 30 -10 30 -5 0 -10 14 -10 30 0 17 -4 30 -10 30 -5 0 -10 14 -10 30 0 17 -4 30 -10 30 -5 0 -10 9 -10 20 0 11 -4 20 -10 20 -5 0 -10 9 -10 20 0 11 -4 20 -10 20 -5 0 -10 9 -10 20 0 11 -4 20 -10 20 -5 0 -10 8 -10 18 0 10 -9 24 -20 32 -11 8 -20 22 -20 32 0 10 -4 18 -10 18 -5 0 -10 8 -10 18 0 10 -9 24 -20 32 -11 8 -20 21 -20 28 0 8 -13 27 -30 42 -16 15 -30 33 -30 39 0 15 -226 241 -241 241 -6 0 -24 14 -39 30 -15 17 -34 30 -42 30 -7 0 -20 9 -28 20 -8 11 -21 20 -30 20 -9 0 -22 9 -30 20 -8 11 -22 20 -32 20 -10 0 -18 5 -18 10 0 6 -9 10 -20 10 -11 0 -20 5 -20 10 0 6 -9 10 -20 10 -11 0 -20 5 -20 10 0 6 -9 10 -20 10 -11 0 -20 5 -20 10 0 6 -9 10 -20 10 -11 0 -20 5 -20 10 0 6 -13 10 -30 10 -16 0 -30 5 -30 10 0 6 -13 10 -30 10 -16 0 -30 5 -30 10 0 6 -13 10 -30 10 -16 0 -30 5 -30 10 0 6 -18 10 -40 10 -22 0 -40 5 -40 10 0 6 -22 10 -50 10 -27 0 -50 5 -50 10 0 6 -43 10 -110 10 -67 0 -110 4 -110 10 0 16 -337 13 -343 -2 -4 -10 -8 -9 -17 2 -9 11 -13 12 -17 3 -6 -15 -63 -18 -63 -3 0 6 -9 10 -20 10 -11 0 -20 -4 -20 -10 0 -5 -9 -10 -20 -10 -11 0 -20 5 -20 10 0 6 -4 10 -10 10 -5 0 -10 -4 -10 -10z m700 -360 c0 -5 23 -10 50 -10 28 0 50 -4 50 -10 0 -5 18 -10 40 -10 22 0 40 -4 40 -10 0 -5 14 -10 30 -10 17 0 30 -4 30 -10 0 -5 9 -10 20 -10 11 0 20 -4 20 -10 0 -5 14 -10 30 -10 17 0 30 -4 30 -10 0 -5 8 -10 18 -10 10 0 24 -9 32 -20 8 -11 22 -20 32 -20 10 0 18 -4 18 -10 0 -5 8 -10 18 -10 10 0 24 -9 32 -20 8 -11 21 -20 28 -20 7 0 31 -18 52 -40 21 -22 43 -40 49 -40 15 0 121 -106 121 -121 0 -6 18 -28 40 -49 22 -21 40 -45 40 -52 0 -7 9 -20 20 -28 11 -8 20 -22 20 -32 0 -10 5 -18 10 -18 6 0 10 -8 10 -18 0 -10 9 -24 20 -32 12 -8 20 -26 20 -42 0 -15 5 -28 10 -28 6 0 10 -9 10 -20 0 -11 5 -20 10 -20 6 0 10 -13 10 -30 0 -16 5 -30 10 -30 6 0 10 -13 10 -30 0 -16 5 -30 10 -30 6 0 10 -13 10 -30 0 -16 5 -30 10 -30 6 0 10 -27 10 -60 0 -33 4 -60 10 -60 7 0 10 -663 10 -1970 0 -1307 -3 -1970 -10 -1970 -5 0 -10 -22 -10 -50 0 -27 -4 -50 -10 -50 -5 0 -10 -18 -10 -40 0 -22 -4 -40 -10 -40 -5 0 -10 -13 -10 -30 0 -16 -4 -30 -10 -30 -5 0 -10 -9 -10 -20 0 -11 -4 -20 -10 -20 -5 0 -10 -13 -10 -30 0 -16 -4 -30 -10 -30 -5 0 -10 -8 -10 -18 0 -10 -9 -24 -20 -32 -11 -8 -20 -22 -20 -32 0 -10 -4 -18 -10 -18 -5 0 -10 -8 -10 -18 0 -10 -9 -24 -20 -32 -11 -8 -20 -21 -20 -28 0 -7 -18 -31 -40 -52 -22 -21 -40 -43 -40 -49 0 -15 -106 -121 -121 -121 -6 0 -28 -18 -49 -40 -21 -22 -45 -40 -52 -40 -7 0 -20 -9 -28 -20 -8 -11 -21 -20 -30 -20 -9 0 -22 -9 -30 -20 -8 -11 -22 -20 -32 -20 -10 0 -18 -4 -18 -10 0 -5 -9 -10 -20 -10 -11 0 -20 -4 -20 -10 0 -5 -13 -10 -30 -10 -16 0 -30 -4 -30 -10 0 -5 -9 -10 -20 -10 -11 0 -20 -4 -20 -10 0 -5 -13 -10 -30 -10 -16 0 -30 -4 -30 -10 0 -5 -18 -10 -40 -10 -22 0 -40 -4 -40 -10 0 -5 -22 -10 -50 -10 -27 0 -50 -4 -50 -10 0 -7 -667 -10 -1980 -10 -1313 0 -1980 3 -1980 10 0 6 -22 10 -50 10 -27 0 -50 5 -50 10 0 6 -18 10 -40 10 -22 0 -40 5 -40 10 0 6 -9 10 -20 10 -11 0 -20 5 -20 10 0 6 -13 10 -30 10 -16 0 -30 5 -30 10 0 6 -9 10 -20 10 -11 0 -20 5 -20 10 0 6 -9 10 -20 10 -11 0 -20 5 -20 10 0 6 -9 10 -20 10 -11 0 -20 5 -20 10 0 6 -8 10 -18 10 -10 0 -24 9 -32 20 -8 11 -21 20 -30 20 -9 0 -22 9 -30 20 -8 11 -20 20 -28 20 -7 0 -35 23 -62 50 -27 28 -54 50 -60 50 -14 0 -60 46 -60 60 0 7 -18 29 -40 50 -22 21 -40 45 -40 52 0 7 -9 20 -20 28 -11 8 -20 21 -20 30 0 9 -9 22 -20 30 -11 8 -20 22 -20 32 0 10 -4 18 -10 18 -5 0 -10 9 -10 20 0 11 -4 20 -10 20 -5 0 -10 9 -10 20 0 11 -4 20 -10 20 -5 0 -10 9 -10 20 0 11 -4 20 -10 20 -5 0 -10 14 -10 30 0 17 -4 30 -10 30 -5 0 -10 14 -10 30 0 17 -4 30 -10 30 -5 0 -10 14 -10 30 0 17 -4 30 -10 30 -5 0 -10 23 -10 50 0 28 -4 50 -10 50 -7 0 -10 667 -10 1980 0 1313 3 1980 10 1980 6 0 10 23 10 50 0 28 5 50 10 50 6 0 10 18 10 40 0 22 5 40 10 40 6 0 10 14 10 30 0 17 5 30 10 30 6 0 10 9 10 20 0 11 5 20 10 20 6 0 10 9 10 20 0 11 5 20 10 20 6 0 10 13 10 28 0 16 8 34 20 42 11 8 20 22 20 32 0 10 5 18 10 18 6 0 10 7 10 16 0 9 14 29 30 44 17 15 30 33 30 40 0 7 14 25 30 40 17 15 30 33 30 39 0 15 106 121 121 121 6 0 28 18 49 40 21 22 45 40 52 40 7 0 20 9 28 20 8 11 21 20 30 20 9 0 22 9 30 20 8 11 22 20 32 20 10 0 18 5 18 10 0 6 9 10 20 10 11 0 20 5 20 10 0 6 14 10 30 10 17 0 30 5 30 10 0 6 9 10 20 10 11 0 20 5 20 10 0 6 14 10 30 10 17 0 30 5 30 10 0 6 18 10 40 10 22 0 40 5 40 10 0 6 18 10 40 10 22 0 40 5 40 10 0 7 670 10 1990 10 1320 0 1990 -3 1990 -10z"/> <path d="M3033 6805 c-10 -11 -13 -363 -13 -1690 l0 -1675 900 0 c593 0 900 -3 900 -10 0 -15 57 -12 64 3 5 10 7 10 12 0 7 -16 41 -17 46 -2 3 8 10 8 25 -2 12 -7 25 -10 29 -7 8 9 -21 38 -38 38 -8 0 -20 9 -28 20 -8 11 -21 20 -30 20 -9 0 -22 9 -30 20 -8 11 -21 20 -28 20 -8 0 -27 14 -42 30 -15 17 -33 30 -39 30 -15 0 -241 226 -241 241 0 6 -14 24 -30 39 -16 15 -30 34 -30 42 0 7 -9 20 -20 28 -11 8 -20 22 -20 32 0 10 -4 18 -10 18 -5 0 -10 8 -10 18 0 10 -9 24 -20 32 -11 8 -20 22 -20 32 0 17 -19 18 -290 18 l-290 0 0 1346 c0 1153 -2 1347 -14 1360 -21 21 -715 20 -733 -1z"/> <path d="M4340 5750 c0 -707 3 -1070 10 -1070 6 0 10 -27 10 -60 0 -33 4 -60 10 -60 6 0 10 -22 10 -50 0 -27 5 -50 10 -50 6 0 10 -13 10 -30 0 -16 5 -30 10 -30 6 0 10 -13 10 -30 0 -16 5 -30 10 -30 6 0 10 -9 10 -20 0 -11 5 -20 10 -20 6 0 10 -13 10 -30 0 -16 5 -30 10 -30 6 0 10 -9 10 -20 0 -11 5 -20 10 -20 6 0 10 -9 10 -20 0 -11 5 -20 10 -20 6 0 10 -8 10 -18 0 -10 9 -24 20 -32 11 -8 20 -22 20 -32 0 -10 5 -18 10 -18 6 0 10 -7 10 -16 0 -9 14 -29 30 -44 16 -15 30 -33 30 -39 0 -15 226 -241 241 -241 6 0 24 -13 39 -30 15 -16 34 -30 42 -30 7 0 20 -9 28 -20 8 -11 22 -20 32 -20 10 0 18 -4 18 -10 0 -5 9 -10 20 -10 11 0 20 -4 20 -10 0 -5 9 -10 20 -10 11 0 20 -4 20 -10 0 -5 9 -10 20 -10 11 0 20 -4 20 -10 0 -5 14 -10 30 -10 17 0 30 -4 30 -10 0 -5 9 -10 20 -10 11 0 20 -4 20 -10 0 -5 14 -10 30 -10 17 0 30 -4 30 -10 0 -5 18 -10 40 -10 22 0 40 -4 40 -10 0 -5 23 -10 50 -10 28 0 50 -4 50 -10 0 -6 37 -10 90 -10 53 0 90 -4 90 -10 0 -6 43 -10 110 -10 67 0 110 4 110 10 0 6 33 10 80 10 47 0 80 4 80 10 0 6 27 10 60 10 33 0 60 4 60 10 0 6 14 10 30 10 17 0 30 5 30 10 0 6 14 10 30 10 17 0 30 5 30 10 0 6 14 10 30 10 17 0 30 5 30 10 0 6 9 10 20 10 11 0 20 5 20 10 0 6 14 10 30 10 17 0 30 5 30 10 0 6 8 10 18 10 10 0 24 9 32 20 8 11 22 20 32 20 10 0 18 5 18 10 0 6 8 10 18 10 10 0 24 9 32 20 8 11 21 20 28 20 8 0 27 14 42 30 15 17 33 30 39 30 15 0 161 146 161 161 0 6 14 24 30 39 17 15 30 34 30 42 0 7 9 20 20 28 11 8 20 21 20 30 0 9 9 22 20 30 11 8 20 22 20 32 0 10 5 18 10 18 6 0 10 9 10 20 0 11 5 20 10 20 6 0 10 9 10 20 0 11 5 20 10 20 6 0 10 9 10 20 0 11 5 20 10 20 6 0 10 9 10 20 0 11 5 20 10 20 6 0 10 14 10 30 0 17 5 30 10 30 6 0 10 18 10 40 0 22 5 40 10 40 6 0 10 14 10 30 0 17 5 30 10 30 6 0 10 23 10 50 0 28 5 50 10 50 6 0 10 33 10 80 0 47 4 80 10 80 7 0 10 349 10 1026 0 875 -2 1028 -14 1040 -22 21 -710 21 -732 0 -12 -12 -14 -169 -14 -1070 0 -697 -3 -1056 -10 -1056 -5 0 -10 -18 -10 -40 0 -22 -4 -40 -10 -40 -5 0 -10 -13 -10 -30 0 -16 -4 -30 -10 -30 -5 0 -10 -13 -10 -30 0 -16 -4 -30 -10 -30 -5 0 -10 -9 -10 -20 0 -11 -4 -20 -10 -20 -5 0 -10 -8 -10 -18 0 -10 -9 -24 -20 -32 -11 -8 -20 -20 -20 -27 0 -19 -146 -163 -165 -163 -8 0 -15 -4 -15 -10 0 -5 -9 -10 -20 -10 -11 0 -20 -4 -20 -10 0 -5 -9 -10 -20 -10 -11 0 -20 -4 -20 -10 0 -5 -13 -10 -30 -10 -16 0 -30 -4 -30 -10 0 -5 -18 -10 -40 -10 -22 0 -40 -4 -40 -10 0 -6 -53 -10 -140 -10 -87 0 -140 4 -140 10 0 6 -18 10 -40 10 -22 0 -40 5 -40 10 0 6 -13 10 -30 10 -16 0 -30 5 -30 10 0 6 -9 10 -20 10 -11 0 -20 5 -20 10 0 6 -8 10 -18 10 -10 0 -24 9 -32 20 -8 11 -20 20 -27 20 -17 0 -143 126 -143 143 0 7 -9 19 -20 27 -11 8 -20 22 -20 32 0 10 -4 18 -10 18 -5 0 -10 9 -10 20 0 11 -4 20 -10 20 -5 0 -10 14 -10 30 0 17 -4 30 -10 30 -5 0 -10 14 -10 30 0 17 -4 30 -10 30 -5 0 -10 18 -10 40 0 22 -4 40 -10 40 -6 0 -10 27 -10 60 0 33 -4 60 -10 60 -7 0 -10 343 -10 1010 l0 1010 -370 0 -370 0 0 -1070z"/> </g></symbol></svg>
diff --git a/public/LU-monogram-white.png b/public/LU-monogram-white.png
deleted file mode 100644
index 850522b3..00000000
Binary files a/public/LU-monogram-white.png and /dev/null differ
diff --git a/src-tauri/src/commands/install/comfy_install.rs b/src-tauri/src/commands/install/comfy_install.rs
index 2520a15f..6aec89ea 100644
--- a/src-tauri/src/commands/install/comfy_install.rs
+++ b/src-tauri/src/commands/install/comfy_install.rs
@@ -39,12 +39,41 @@ use super::git::{windows_git_install_hint, windows_git_probe, WindowsGitState};
use super::CREATE_NO_WINDOW;
// ── Disk-pressure pre-flight (Bug #1 — techx69 100%-busy-drive hang) ────────
-
-/// Return a human-readable warning when the target install drive is short
-/// on free space (<5 GB — ComfyUI + PyTorch wheels need ~5 GB) or its
-/// pending I/O queue suggests sustained 100% utilisation. Best-effort —
-/// returns None if sysinfo can't get reliable data, so we never block a
-/// well-meaning install over a probing flake.
+//
+// FREE SPACE IS THE ONLY THING MEASURED HERE, and that is deliberate. The doc
+// comment below used to promise a second check as well — "or its pending I/O
+// queue suggests sustained 100% utilisation" — which no version of this
+// function ever performed (KF-28, read at HEAD 01.09.2026). Three reasons it
+// stays that way rather than being built:
+//
+// * Nothing consumes such a verdict. The one caller (`install_comfyui`)
+// pushes whatever string comes back into the install log and starts the
+// install regardless — it does not gate, retry or choose a drive. A
+// queue reading would produce a second sentence and change nothing.
+// * The busy-drive case in Bug #1 is answered somewhere else entirely, and
+// was already when this comment was written: the install became
+// CANCELLABLE (`state.comfyui_install_cancel`, polled between steps and
+// inside the pip retry loop, killing the live git/pip child). That is
+// what turned the 45-minute hang into something a user can leave. A
+// pre-flight guess about the drive is no substitute for a stop button.
+// * There is no reading to take. `sysinfo` 0.33 exposes `Disk::usage()` →
+// `DiskUsage`, which is four byte counters (read/written, total and
+// since-last-refresh). No queue depth, no utilisation percentage, on any
+// platform. Deriving "100% busy" from two byte deltas would be a guess
+// wearing a number.
+//
+// `disk_pressure_doc_matches_body` at the bottom of this file holds the two
+// halves together, in both directions: promise without probe is red, and so
+// is probe without promise. The "why not" lives up here, in a plain comment,
+// so that the doc comment below can say only what the function does.
+
+/// Return a human-readable warning when the target install drive is short on
+/// free space — under 5 GB, since ComfyUI plus the PyTorch wheels need about
+/// that much. That is the whole check; a drive with room comes back `None`.
+///
+/// Best-effort in the other direction too: `None` when `sysinfo` lists no
+/// mount point that is a prefix of `target_dir`, so a probing flake never
+/// blocks a well-meaning install.
fn check_install_disk_pressure(target_dir: &Path) -> Option<String> {
use sysinfo::Disks;
let disks = Disks::new_with_refreshed_list();
@@ -627,3 +656,107 @@ mod tests {
}
}
+
+/// KF-28: der Doc-Kommentar über `check_install_disk_pressure` darf nur
+/// versprechen, was der Rumpf auch tut.
+///
+/// Er versprach zwei Prüfungen — „<5 GB frei" UND „or its pending I/O queue
+/// suggests sustained 100% utilisation". Die zweite gab es nie; der Rumpf
+/// prüft `available_space()` und gibt danach `None` zurück. Die Überschrift
+/// des Blocks nennt sogar den Anlass (Bug #1, 100%-busy-drive), also genau
+/// den Fall, den die erfundene Hälfte abzufangen schien.
+///
+/// Diese Wache liest den Quelltext und vergleicht die beiden Hälften
+/// miteinander, in BEIDE Richtungen: ein Versprechen ohne Prüfung ist rot,
+/// eine Prüfung ohne Versprechen ebenso. Wer die Queue-Prüfung eines Tages
+/// wirklich baut, wird hier daran erinnert, den Kommentar mitzunehmen —
+/// und wer nur den Kommentar aufhübscht, kommt nicht durch.
+#[cfg(test)]
+mod disk_pressure_doc_matches_body {
+ /// Die eigene Quelle. `include_str!` statt eines Laufzeit-Pfades, damit
+ /// der Test nicht davon abhängt, aus welchem Verzeichnis `cargo test`
+ /// gestartet wurde.
+ const SOURCE: &str = include_str!("comfy_install.rs");
+
+ const SIGNATURE: &str = "fn check_install_disk_pressure";
+
+ /// Die `///`-Zeilen unmittelbar über der Signatur.
+ fn doc_comment() -> String {
+ let lines: Vec<&str> = SOURCE.lines().collect();
+ let at = lines
+ .iter()
+ .position(|l| l.contains(SIGNATURE) && !l.trim_start().starts_with("//"))
+ .expect("check_install_disk_pressure steht noch in dieser Datei");
+ let mut doc: Vec<&str> = Vec::new();
+ for line in lines[..at].iter().rev() {
+ let t = line.trim_start();
+ if !t.starts_with("///") {
+ break;
+ }
+ doc.push(t.trim_start_matches("///").trim());
+ }
+ doc.reverse();
+ doc.join(" ").to_lowercase()
+ }
+
+ /// Der Rumpf: ab der Signatur bis zur schließenden Klammer in Spalte 0.
+ fn body() -> String {
+ let lines: Vec<&str> = SOURCE.lines().collect();
+ let at = lines
+ .iter()
+ .position(|l| l.contains(SIGNATURE) && !l.trim_start().starts_with("//"))
+ .expect("check_install_disk_pressure steht noch in dieser Datei");
+ let end = lines[at..]
+ .iter()
+ .position(|l| *l == "}")
+ .expect("die Funktion wird in Spalte 0 geschlossen");
+ lines[at..=at + end].join("\n")
+ }
+
+ /// Sagt der Kommentar eine Warteschlangen- oder Auslastungsprüfung zu?
+ fn doc_promises_queue(doc: &str) -> bool {
+ ["i/o queue", "queue", "utilisation", "utilization", "busy"]
+ .iter()
+ .any(|w| doc.contains(w))
+ }
+
+ /// Steht im Rumpf irgendetwas, das eine solche Prüfung sein könnte?
+ /// `sysinfo`-0.33 kennt dafür nur `Disk::usage()` → `DiskUsage`, und das
+ /// sind Byte-Zähler seit dem letzten Refresh, keine Warteschlangenlänge.
+ fn body_probes_queue(body: &str) -> bool {
+ ["usage()", "DiskUsage", "read_bytes", "written_bytes"]
+ .iter()
+ .any(|w| body.contains(w))
+ }
+
+ #[test]
+ fn the_comment_promises_exactly_what_the_body_checks() {
+ let doc = doc_comment();
+ let body = body();
+
+ // Der Teil, der wahr ist und wahr bleiben soll.
+ assert!(
+ body.contains("available_space()"),
+ "der Rumpf prüft den freien Platz nicht mehr — dann stimmt auch \
+ der erste Satz des Kommentars nicht mehr"
+ );
+ assert!(
+ doc.contains("free space") || doc.contains("5 gb"),
+ "der Kommentar sagt den freien Platz nicht mehr an, den der Rumpf prüft"
+ );
+
+ // Und die eigentliche Aussage.
+ assert_eq!(
+ doc_promises_queue(&doc),
+ body_probes_queue(&body),
+ "Kommentar und Rumpf sind auseinander: der Kommentar {} von einer \
+ Warteschlangen-/Auslastungsprüfung, der Rumpf {}. Beide Hälften \
+ gehören zusammen geändert — und das „warum nicht\" steht im \
+ Blockkommentar über der Funktion, nicht im Doc-Kommentar, damit \
+ eine Absage nicht wie eine Zusage aussieht.\n\n\
+ Kommentar:\n{doc}\n",
+ if doc_promises_queue(&doc) { "spricht" } else { "spricht NICHT" },
+ if body_probes_queue(&body) { "enthält eine" } else { "enthält KEINE" },
+ );
+ }
+}
diff --git a/src-tauri/src/commands/remote.rs b/src-tauri/src/commands/remote.rs
index 853e79a0..a5e8e89c 100644
--- a/src-tauri/src/commands/remote.rs
+++ b/src-tauri/src/commands/remote.rs
@@ -284,7 +284,6 @@ async fn auth_middleware(
// Public routes:
// • /mobile — the self-contained landing page
- // • /LU-monogram-white.png — the single branding asset
// • /remote-api/auth — where the client trades a passcode for a JWT
// • /remote-api/status — minimal liveness ping {status:"ok"}
// • / — 302 redirect to /mobile
@@ -3248,12 +3247,19 @@ fn build_router(state: RemoteState) -> Router {
// React SPA — `mobile_landing` is self-contained, and serving the full
// desktop bundle over the tunnel would leak source code (Bug #14).
// Root `/` and any unknown path redirect to `/mobile`.
+ //
+ // There is no image route. There used to be exactly one, serving a
+ // 512x512 brand raster out of `public/`, and the mobile page pulled it in
+ // four times. Both callers went away — `0b9c0f66` moved the desktop to
+ // `public/LU-monogram.svg`, `b133160b` moved the phone to an inline
+ // <symbol>/<use> carrying the same path data — so the route, its handler
+ // and the file went with them. The page needs no binary asset at all now;
+ // that is why serving one page is enough.
let app = Router::new()
.merge(api_routes)
.merge(proxy_routes)
.merge(mobile)
.route("/", get(redirect_to_mobile))
- .route("/LU-monogram-white.png", get(mobile_monogram))
.fallback(redirect_to_mobile);
app.layer(middleware::from_fn_with_state(state.clone(), auth_middleware))
@@ -3269,19 +3275,6 @@ async fn redirect_to_mobile() -> Response {
.unwrap_or_else(|_| StatusCode::FOUND.into_response())
}
-/// Serve the LU monogram PNG embedded in the desktop public/ dir.
-/// This is the only binary asset the mobile page needs — bundle it
-/// at compile time so we never depend on `dist/` being present.
-async fn mobile_monogram() -> Response {
- const MONOGRAM: &[u8] = include_bytes!("../../../public/LU-monogram-white.png");
- Response::builder()
- .status(StatusCode::OK)
- .header(header::CONTENT_TYPE, "image/png")
- .header(header::CACHE_CONTROL, "public, max-age=86400")
- .body(Body::from(MONOGRAM))
- .unwrap_or_else(|_| StatusCode::INTERNAL_SERVER_ERROR.into_response())
-}
-
#[cfg(test)]
mod jwt_refresh_tests {
use super::{
diff --git a/src/api/__tests__/keine-bildroute-ohne-aufrufer.test.ts b/src/api/__tests__/keine-bildroute-ohne-aufrufer.test.ts
new file mode 100644
index 00000000..935ce399
--- /dev/null
+++ b/src/api/__tests__/keine-bildroute-ohne-aufrufer.test.ts
@@ -0,0 +1,93 @@
+/**
+ * Die Wache fuer KF-33 — die Bildroute des Remote-Servers und ihre Datei.
+ *
+ * ## Was da war
+ *
+ * `public/LU-monogram-white.png` (3.219 B, 512x512, byteidentisch mit
+ * `LU-monogram-bw.png`) wurde ueber genau einen Weg ausgeliefert:
+ *
+ * remote.rs:3256 .route("/LU-monogram-white.png", get(mobile_monogram))
+ * remote.rs:3276 const MONOGRAM: &[u8] = include_bytes!("../../../public/LU-monogram-white.png");
+ * remote.rs:287 // • /LU-monogram-white.png — the single branding asset
+ *
+ * Beide Aufrufer sind vor dieser Wache weggefallen: `0b9c0f66` hat die
+ * Desktop-App auf `public/LU-monogram.svg` umgestellt, `b133160b` den
+ * Mobile-Client auf ein <symbol>/<use> mit denselben Pfaddaten. Danach
+ * blieben eine ausgelieferte Datei und ein HTTP-Endpunkt, die nichts mehr
+ * bedienen — kein Fehler, aber Ballast, den niemand mehr anfassen wird.
+ *
+ * ## Was diese Datei prueft
+ *
+ * Nicht, dass die Zeilen weg sind (das waere ein Pin auf Bytes), sondern dass
+ * der Remote-Server keine Raster-Marke mehr AUSLIEFERT: keine Bildroute im
+ * Router, kein `include_bytes!` aus `public/`, und die Datei selbst nicht
+ * mehr im Baum. Kommentare zaehlen nicht mit — ueber die Geschichte darf
+ * geschrieben werden, ausgeliefert werden soll sie nicht.
+ *
+ * Die Gegenprobe steht mit dabei: der Vektor, von dem die Seite ihr Zeichen
+ * nimmt, muss weiter da sein. Sonst waere „nichts mehr da" auch dadurch zu
+ * erfuellen, dass man die Marke ganz entfernt.
+ *
+ * Lauf: npx vitest run src/api/__tests__/keine-bildroute-ohne-aufrufer.test.ts
+ */
+import { describe, it, expect } from 'vitest'
+import { existsSync, readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+
+const ROOT = resolve(__dirname, '..', '..', '..')
+const REMOTE_RS = resolve(ROOT, 'src-tauri', 'src', 'commands', 'remote.rs')
+
+/**
+ * Rust-Quelltext ohne Zeilenkommentare. Blockkommentare kommen in dieser
+ * Datei nicht vor; `//` mitten in einer Zeichenkette (etwa `"http://…"`)
+ * wuerde hier zu viel wegschneiden, deshalb wird nur ab einem `//` gekuerzt,
+ * vor dem in derselben Zeile kein Anfuehrungszeichen steht.
+ */
+function codeOnly(rust: string): string {
+ return rust
+ .split('\n')
+ .map((zeile) => {
+ const idx = zeile.indexOf('//')
+ if (idx < 0) return zeile
+ if (zeile.slice(0, idx).includes('"')) return zeile
+ return zeile.slice(0, idx)
+ })
+ .join('\n')
+}
+
+const REMOTE_CODE = codeOnly(readFileSync(REMOTE_RS, 'utf8'))
+
+/** Dieselbe Musterform wie in der Desktop-Wache: Name egal, Endung zaehlt. */
+const RASTER_MARKE = /[\w@-]*(?:monogram|logo|brand|wordmark)[\w@-]*\.(?:png|jpe?g|webp|gif|bmp|ico|avif)/i
+
+describe('der Remote-Server liefert keine Raster-Marke mehr aus', () => {
+ it('die Datei ist aus public/ verschwunden', () => {
+ expect(existsSync(resolve(ROOT, 'public', 'LU-monogram-white.png'))).toBe(false)
+ })
+
+ it('remote.rs bettet keine Datei aus public/ mehr ein', () => {
+ expect(REMOTE_CODE).not.toMatch(/include_bytes!\s*\(\s*"[^"]*public\//)
+ })
+
+ it('im Router steht keine Bildroute mehr — auch nicht unter anderem Namen', () => {
+ const bildrouten = REMOTE_CODE.match(/\.route\(\s*"[^"]*\.(?:png|jpe?g|webp|gif|bmp|ico|avif|svg)"/gi)
+ expect(bildrouten ?? []).toEqual([])
+ })
+
+ it('und der Name des Handlers ist mit ihr gegangen', () => {
+ expect(REMOTE_CODE).not.toContain('mobile_monogram')
+ })
+
+ it('ueberhaupt kein Raster-Markenpfad mehr im Code', () => {
+ const treffer = REMOTE_CODE.match(new RegExp(RASTER_MARKE, 'gi'))
+ expect(treffer ?? []).toEqual([])
+ })
+})
+
+describe('die Gegenprobe: das Zeichen selbst ist nicht verschwunden', () => {
+ it('der Vektor, aus dem beide Seiten ihre Marke nehmen, liegt weiter in public/', () => {
+ const svg = resolve(ROOT, 'public', 'LU-monogram.svg')
+ expect(existsSync(svg)).toBe(true)
+ expect(readFileSync(svg, 'utf8')).toContain('<path')
+ })
+})
diff --git a/src/api/__tests__/mobile-doppelt-kodierte-werkzeugargumente.test.ts b/src/api/__tests__/mobile-doppelt-kodierte-werkzeugargumente.test.ts
index 0c9ac3a0..15c46fb9 100644
--- a/src/api/__tests__/mobile-doppelt-kodierte-werkzeugargumente.test.ts
+++ b/src/api/__tests__/mobile-doppelt-kodierte-werkzeugargumente.test.ts
@@ -26,15 +26,24 @@
* einmal auf dem Weg, auf dem der Client sie wirklich bekommt (der gezaeunte
* ```json-Block, den kleine Modelle statt `tool_calls` schicken).
*
- * ## Gemessener Unterschied zum Desktop (kein Fehler DIESER Datei)
+ * ## Der Desktop hat nachgezogen (KF-32)
*
- * `src/lib/tool-call-repair.ts` hat denselben Defekt und behaelt ihn: gemessen
- * am 01.09.2026 gibt `repairToolCallArgs(JSON.stringify('{"path":"a.txt"}'))`
- * dort `{}` zurueck, weil `repairJson` eine geparste Skalar-Zeichenkette ueber
- * `asRepairedJson` zu `null` macht und nie ein zweites Mal parst. Mobile ist
- * damit an dieser Stelle jetzt BESSER als Desktop. Das steht hier als
- * Messwert und nicht als Zusicherung — ein `expect(desktop(...)).toEqual({})`
- * waere wieder ein Pin auf einen Fehler.
+ * Hier stand bis dahin dieser Messwert:
+ *
+ * „`src/lib/tool-call-repair.ts` hat denselben Defekt und behaelt ihn:
+ * gemessen am 01.09.2026 gibt `repairToolCallArgs(JSON.stringify(
+ * '{"path":"a.txt"}'))` dort `{}` zurueck, weil `repairJson` eine geparste
+ * Skalar-Zeichenkette ueber `asRepairedJson` zu `null` macht und nie ein
+ * zweites Mal parst. Mobile ist damit an dieser Stelle jetzt BESSER als
+ * Desktop."
+ *
+ * Das gilt nicht mehr. Der Desktop traegt die Lagen jetzt in derselben
+ * Schleife ab, mit demselben Deckel von vier Dekodierschritten, und hat dafuer
+ * eine eigene Wache mit denselben Faellen:
+ * `src/lib/__tests__/desktop-doppelt-kodierte-werkzeugargumente.test.ts`.
+ * Wer den Deckel auf einer Seite verstellt, macht die beiden Wachen zu
+ * Nachbarn, die verschiedene Dinge behaupten — der Deckel gehoert auf beiden
+ * Seiten geaendert oder auf keiner.
*
* Lauf: npx vitest run src/api/__tests__/mobile-doppelt-kodierte-werkzeugargumente.test.ts
*/
diff --git a/src/api/__tests__/mobile-hauszeichen-ist-vektor.test.ts b/src/api/__tests__/mobile-hauszeichen-ist-vektor.test.ts
index 8e69fcaa..16bac656 100644
--- a/src/api/__tests__/mobile-hauszeichen-ist-vektor.test.ts
+++ b/src/api/__tests__/mobile-hauszeichen-ist-vektor.test.ts
@@ -17,12 +17,16 @@
*
* Gemessen, nicht vermutet: der Remote-Server liefert KEINE Datei aus
* `mobile-client/` aus. `src-tauri/src/mobile_page.rs` baut aus den sechs
- * Quelldateien EINE HTML-Seite, `build.rs` bettet sie ein, und der Router in
- * `src-tauri/src/commands/remote.rs` kennt genau eine Bildroute
- * (`/LU-monogram-white.png` → `include_bytes!("../../../public/…")`). Es gibt
+ * Quelldateien EINE HTML-Seite und `build.rs` bettet sie ein. Als das hier
+ * geschrieben wurde, kannte der Router in `src-tauri/src/commands/remote.rs`
+ * genau EINE Bildroute (`/LU-monogram-white.png` →
+ * `include_bytes!("../../../public/…")`); seit KF-33 kennt er KEINE mehr —
+ * mit dem Vektor im Dokument hatte sie keinen Aufrufer mehr und ist samt
+ * Datei gegangen (Wache: `keine-bildroute-ohne-aufrufer.test.ts`). Es gibt
* kein `ServeDir`, keinen statischen Zweig, und der Fallback ist ein 302 auf
* `/mobile`. Ein `<img src="/LU-monogram.svg">` haette also nichts geladen,
- * sondern die Anmeldeseite als Bild angefordert.
+ * sondern die Anmeldeseite als Bild angefordert — und wuerde es heute erst
+ * recht nicht.
*
* Der Vektor liegt deshalb IM Dokument. Das kostet die Seite die Pfaddaten
* einmal und spart ihr dafuer eine HTTP-Anfrage; die vier Anzeigestellen
diff --git a/src/api/__tests__/mobile-html-content.test.ts b/src/api/__tests__/mobile-html-content.test.ts
index 82ecd7d2..a0fe60f0 100644
--- a/src/api/__tests__/mobile-html-content.test.ts
+++ b/src/api/__tests__/mobile-html-content.test.ts
@@ -122,8 +122,9 @@ describe('mobile page › no third-party requests (Bug #5)', () => {
*
* Jetzt verlangt der Pin die Vektorfassung und VERBIETET das Raster. Der Weg
* dorthin ist ein <symbol> in index.html plus vier <use>: der Remote-Server
- * liefert keine Datei aus mobile-client/ aus (er baut eine Seite und haelt
- * genau eine Bildroute), ein <img src="/LU-monogram.svg"> waere also ein 404.
+ * liefert keine Datei aus mobile-client/ aus — er baut EINE Seite und hielt
+ * daneben genau eine Bildroute, die seit KF-33 auch weg ist, weil sie
+ * niemand mehr rief. Ein <img src="/LU-monogram.svg"> waere also ein 404.
*/
describe('mobile page › LU branding assets', () => {
// Kommentare raus — die Begruendungen NENNEN den alten Rasterpfad.
diff --git a/src/lib/__tests__/desktop-doppelt-kodierte-werkzeugargumente.test.ts b/src/lib/__tests__/desktop-doppelt-kodierte-werkzeugargumente.test.ts
new file mode 100644
index 00000000..571fc248
--- /dev/null
+++ b/src/lib/__tests__/desktop-doppelt-kodierte-werkzeugargumente.test.ts
@@ -0,0 +1,146 @@
+/**
+ * Die Wache fuer KF-32 — `repairToolCallArgs` im DESKTOP.
+ *
+ * ## Was kaputt war
+ *
+ * `src/lib/tool-call-repair.ts` hatte denselben Defekt, den der Mobile-Client
+ * am 01.09.2026 mit `b133160b` losgeworden ist, nur an einer anderen Stelle
+ * im Weg. `repairToolCallArgs` reichte eine Zeichenkette an `repairJson`
+ * weiter. Fuer ein DOPPELT kodiertes Argument — `'"{\"path\":\"a.txt\"}"'`,
+ * also eine JSON-Zeichenkette, die selbst JSON enthaelt — gelang das erste
+ * `JSON.parse` in `tryRepair` und lieferte wieder eine Zeichenkette;
+ * `asRepairedJson` gibt fuer alles, was weder Array noch Record ist, `null`
+ * zurueck, die uebrigen Kandidaten scheiterten an den Escapes, die
+ * Namens-Regex am Ende griff nicht — Rueckgabe `{}`.
+ *
+ * Gemessen am 01.09.2026 vor der Reparatur:
+ *
+ * repairToolCallArgs(JSON.stringify('{"path":"a.txt"}')) -> {}
+ * repairJson(JSON.stringify('{"path":"a.txt"}')) -> null
+ *
+ * Eine Lage tiefer stand derselbe Fehler: `argumentObject` unter
+ * `asRepairedJson` parste das `arguments`-Feld genau EINMAL, also fiel bei
+ *
+ * {"name":"file_write","arguments":"\"{\\\"path\\\":\\\"a.txt\\\"}\""}
+ *
+ * das ganze Argumentobjekt weg und uebrig blieb `{ name: 'file_write' }`.
+ *
+ * ## Was jetzt gilt
+ *
+ * Dieselbe Schleife wie im Mobile-Client: reparieren, und solange dabei eine
+ * Zeichenkette herauskommt, die naechste Lage abtragen — auf VIER
+ * Dekodierschritte gedeckelt. Der Deckel ist derselbe wie drueben, damit die
+ * beiden Seiten nicht bei fuenf Lagen auseinanderlaufen.
+ *
+ * ## Verhaeltnis zur Mobil-Wache
+ *
+ * `src/api/__tests__/mobile-doppelt-kodierte-werkzeugargumente.test.ts`
+ * prueft dieselben Faelle gegen `mobile-client/agent-core.js`. Diese Datei
+ * ist ihr Gegenstueck; die Faelle sind absichtlich dieselben, damit ein
+ * Auseinanderdriften der beiden Implementierungen hier auffaellt. Was der
+ * Desktop ZUSAETZLICH kann, steht unten in einem eigenen Block: `repairJson`
+ * flickt auch einfache Quotes und Schleppkommata, und diese Faehigkeit gilt
+ * jetzt auf jeder Lage, nicht nur auf der aeussersten.
+ *
+ * Lauf: npx vitest run src/lib/__tests__/desktop-doppelt-kodierte-werkzeugargumente.test.ts
+ */
+import { describe, it, expect } from 'vitest'
+import { repairToolCallArgs, repairJson } from '../tool-call-repair'
+
+/** Das Argumentobjekt, das am Ende jedes Mal herauskommen soll. */
+const ZIEL = { path: 'a.txt', content: 'hallo' }
+const EINFACH = JSON.stringify(ZIEL)
+const DOPPELT = JSON.stringify(EINFACH)
+const DREIFACH = JSON.stringify(DOPPELT)
+
+describe('repairToolCallArgs (Desktop) — die Lagen werden wirklich abgetragen', () => {
+ it('ein Objekt geht unveraendert durch (identisch, nicht nur gleich)', () => {
+ const o = { path: 'a.txt' }
+ expect(repairToolCallArgs(o)).toBe(o)
+ })
+
+ it('einfach kodiert: die Zeichenkette wird zum Objekt', () => {
+ expect(repairToolCallArgs(EINFACH)).toEqual(ZIEL)
+ })
+
+ it('DOPPELT kodiert: der Fall, der bis zum 01.09.2026 {} ergab', () => {
+ // Das war KF-32. Vor der Reparatur: {}.
+ expect(repairToolCallArgs(DOPPELT)).toEqual(ZIEL)
+ })
+
+ it('dreifach kodiert — die Schleife haelt nicht nach einer Lage an', () => {
+ expect(repairToolCallArgs(DREIFACH)).toEqual(ZIEL)
+ })
+
+ it('Leerraum um die aeussere Lage stoert nicht', () => {
+ expect(repairToolCallArgs(' ' + DOPPELT + '\n')).toEqual(ZIEL)
+ })
+
+ it('vier Dekodierschritte gehen noch, fuenf nicht mehr — derselbe Deckel wie mobil', () => {
+ const vier = JSON.stringify(DREIFACH)
+ expect(repairToolCallArgs(vier)).toEqual(ZIEL)
+ expect(repairToolCallArgs(JSON.stringify(vier))).toEqual({})
+ })
+
+ it('die Schleife ist gedeckelt: mehr Lagen als vier ergeben {}, nicht eine Endlosschleife', () => {
+ let tief: string = EINFACH
+ for (let i = 0; i < 6; i++) tief = JSON.stringify(tief)
+ expect(repairToolCallArgs(tief)).toEqual({})
+ })
+
+ it('kaputt bleibt kaputt — {} statt eines Wurfs', () => {
+ expect(repairToolCallArgs('not json')).toEqual({})
+ expect(repairToolCallArgs('{"path":')).toEqual({})
+ expect(repairToolCallArgs('"nur eine Zeichenkette"')).toEqual({})
+ expect(repairToolCallArgs('""')).toEqual({})
+ })
+
+ it('leer, null, undefined und Nicht-Zeichenketten ergeben {}', () => {
+ expect(repairToolCallArgs('')).toEqual({})
+ expect(repairToolCallArgs(' ')).toEqual({})
+ expect(repairToolCallArgs(null)).toEqual({})
+ expect(repairToolCallArgs(undefined)).toEqual({})
+ expect(repairToolCallArgs(7)).toEqual({})
+ expect(repairToolCallArgs(true)).toEqual({})
+ expect(repairToolCallArgs('null')).toEqual({})
+ })
+
+ it('ein JSON-Array bleibt ein Array — geerbtes Verhalten, hier nur festgehalten', () => {
+ // Kein Argumentobjekt, aber beide Seiten reichen es durch. Wer das
+ // aendert, aendert Desktop UND mobile-client/agent-core.js.
+ expect(repairToolCallArgs('[1,2]')).toEqual([1, 2])
+ // Auch eingepackt: die Lage wird abgetragen, das Array bleibt ein Array.
+ expect(repairToolCallArgs(JSON.stringify('[1,2]'))).toEqual([1, 2])
+ })
+})
+
+describe('was der Desktop ueber den Mobile-Client hinaus kann, gilt auf JEDER Lage', () => {
+ it('einfache Quotes werden auch in der zweiten Lage noch geflickt', () => {
+ // `repairJson` kann das seit jeher — vor der Reparatur aber nur, wenn der
+ // Schaden in der AEUSSERSTEN Lage sass.
+ expect(repairToolCallArgs(JSON.stringify("{'path': 'a.txt'}"))).toEqual({ path: 'a.txt' })
+ })
+
+ it('ein Schleppkomma in der zweiten Lage ebenso', () => {
+ expect(repairToolCallArgs(JSON.stringify('{"path": "a.txt",}'))).toEqual({ path: 'a.txt' })
+ })
+})
+
+describe('und eine Lage tiefer: das `arguments`-Feld eines geparsten Aufrufs', () => {
+ it('doppelt kodiertes `arguments` faellt nicht mehr weg', () => {
+ // Vor der Reparatur kam hier { name: 'file_write' } heraus — `arguments`
+ // war verschwunden, weil `argumentObject` genau einmal parste.
+ const roh = JSON.stringify({ name: 'file_write', arguments: DOPPELT })
+ expect(repairJson(roh)).toEqual({ name: 'file_write', arguments: ZIEL })
+ })
+
+ it('einfach kodiertes `arguments` verhaelt sich unveraendert', () => {
+ const roh = JSON.stringify({ name: 'file_write', arguments: EINFACH })
+ expect(repairJson(roh)).toEqual({ name: 'file_write', arguments: ZIEL })
+ })
+
+ it('und `parameters`, die andere Schreibweise, genauso', () => {
+ const roh = JSON.stringify({ name: 'file_write', parameters: DOPPELT })
+ expect(repairJson(roh)).toEqual({ name: 'file_write', parameters: ZIEL })
+ })
+})
diff --git a/src/lib/tool-call-repair.ts b/src/lib/tool-call-repair.ts
index 96172eb6..6d3eaad3 100644
--- a/src/lib/tool-call-repair.ts
+++ b/src/lib/tool-call-repair.ts
@@ -46,6 +46,37 @@ export interface RepairedJson {
[key: string]: unknown
}
+/**
+ * How many JSON decode steps an argument value is worth.
+ *
+ * Producers serialise the argument object into a JSON string, and some of
+ * them do it TWICE — the string gets encoded again on its way through a
+ * proxy. Each successful decode of a JSON string yields a strictly shorter
+ * string, so the peeling terminates on its own; the bound is belt and braces
+ * and stops adversarial input from buying more than four parses.
+ *
+ * The number is shared with the mobile client on purpose
+ * (`mobile-client/agent-core.js`, `for(var layer = 0; layer < 4; layer++)`):
+ * with a different cap the two sides would agree on one and two layers and
+ * disagree at five, which is the kind of split nobody notices until it bites.
+ */
+const MAX_ARG_ENCODING_LAYERS = 4
+
+/**
+ * Decode ONE JSON string wrapper: `'"{\"a\":1}"'` → `'{"a":1}'`.
+ *
+ * `undefined` means "this text is not a JSON string literal" — either it does
+ * not parse at all, or it parses to something that is not a string, in which
+ * case there is nothing left to peel and the caller is already done.
+ */
+function unwrapJsonStringLayer(text: string): string | undefined {
+ const trimmed = text.trim()
+ if (!trimmed) return undefined
+ let parsed: unknown
+ try { parsed = JSON.parse(trimmed) } catch { return undefined }
+ return typeof parsed === 'string' ? parsed : undefined
+}
+
/**
* An `arguments` / `parameters` value, reduced to an object or nothing.
*
@@ -53,12 +84,22 @@ export interface RepairedJson {
* argument object into a JSON STRING, and every consumer of this module reads
* `parsed.arguments.something` straight away. Resolving it here is the same
* normalisation `repairToolCallArgs` performs one level up.
+ *
+ * It is a LOOP for the same reason that one is (KF-32, measured 01.09.2026):
+ * a single `tryRepair` on a double-encoded value hands back a string, this
+ * function then returned `undefined`, and `asRepairedJson` deleted the field —
+ * so `{"name":"file_write","arguments":"\"{\\\"path\\\":\\\"a.txt\\\"}\""}`
+ * repaired to `{ name: 'file_write' }` with the arguments silently gone.
*/
function argumentObject(v: unknown): Record<string, unknown> | undefined {
if (isRecord(v)) return v
- if (typeof v === 'string') {
- const inner = tryRepair(v)
+ if (typeof v !== 'string') return undefined
+ let text = v
+ for (let layer = 0; layer < MAX_ARG_ENCODING_LAYERS; layer++) {
+ const inner = tryRepair(text)
if (isRecord(inner)) return inner
+ if (typeof inner !== 'string') return undefined
+ text = inner
}
return undefined
}
@@ -288,8 +329,30 @@ export function repairToolCallArgs(args: unknown): Record<string, unknown> {
// reads for the same reason spelled out on asRepairedJson.
if (Array.isArray(args)) return args as unknown as Record<string, unknown>
if (typeof args === 'string') {
- const parsed = repairJson(args)
- if (parsed) return parsed
+ // Peel the JSON wrappers one layer at a time.
+ //
+ // The ordinary shape is `'{"path":"a.txt"}'` and `repairJson` resolves it
+ // on the first pass. The other one models really send is that string
+ // ENCODED AGAIN — `'"{\"path\":\"a.txt\"}"'` — and until 01.09.2026 this
+ // function answered `{}` for it (KF-32). It looked like it could not
+ // happen: `repairJson` parses, so surely it parses a JSON string too. It
+ // does — and gets a STRING back. `asRepairedJson` turns everything that is
+ // neither array nor record into `null`, the remaining candidates choke on
+ // the escapes, the name regex finds nothing, and `{}` comes out. Feeding
+ // the decoded string back through the repair is the whole fix; the mobile
+ // client got the same one in `b133160b`.
+ //
+ // Order matters: repair FIRST, peel only when the repair came up empty.
+ // That keeps every input that already worked on exactly the path it took
+ // before, so this can only turn a `{}` into an object, never the reverse.
+ let text = args
+ for (let layer = 0; layer < MAX_ARG_ENCODING_LAYERS; layer++) {
+ const parsed = repairJson(text)
+ if (parsed) return parsed
+ const inner = unwrapJsonStringLayer(text)
+ if (inner === undefined) return {}
+ text = inner
+ }
}
return {}
}