Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([tolerant-fetch-json-additional-clients]): fail playground run on non-JSON body instead of recording empty success

[._.]/ Adam Eivy93b3e3741202
diff --git a/server/services/localLlmPlayground.js b/server/services/localLlmPlayground.js
index 337f69c17f..83f47e046c 100644
--- a/server/services/localLlmPlayground.js
+++ b/server/services/localLlmPlayground.js
@@ -112,7 +112,14 @@ async function streamChatCompletion({ provider, backend, modelId, prompt, system
}
if (!response.body?.getReader) {
- const data = await readResponseJson(response);
+ // Sentinel fallback: a non-JSON/blank 200 body must throw (caught by
+ // runLocalLlmTest → finalizeRunRecord success:false), not return '' — which
+ // line 205 would persist as a successful empty run. Mirrors the pre-helper
+ // response.json() throw; a valid body with empty content is unchanged.
+ const data = await readResponseJson(response, { fallback: null, emptyValue: null });
+ if (!data) {
+ throw new Error(`Provider returned a non-JSON response (${response.status})`);
+ }
const text = data.choices?.[0]?.message?.content || '';
if (text) onChunk(text);
return text;