From 9012381ea52078aadb8b81b0c50e471f4a03346c Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 22 Sep 2026 21:26:25 +0200 Subject: [PATCH] Decide by the answer, not by the error message, whether a request failed --- app/MindWork AI Studio/Provider/BaseProvider.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/MindWork AI Studio/Provider/BaseProvider.cs b/app/MindWork AI Studio/Provider/BaseProvider.cs index 94693221..7e777ff5 100644 --- a/app/MindWork AI Studio/Provider/BaseProvider.cs +++ b/app/MindWork AI Studio/Provider/BaseProvider.cs @@ -872,7 +872,15 @@ public abstract class BaseProvider : IProvider, ISecretId await Task.Delay(TimeSpan.FromSeconds(timeSeconds), effectiveCancellationToken); } - if(retry >= MAX_RETRIES || !string.IsNullOrWhiteSpace(errorMessage)) + // + // Whether this request got an answer at all. The response is set in the success branch and + // nowhere else, so its absence is what "we have nothing to hand on" means. Going by the + // error message instead was wrong in both directions: a provider which sends no reason + // phrase left that message empty, and this method then reported success without a response + // for the caller to read; and an attempt which succeeded as the last one the loop allows + // was reported as a failure although its answer was right there. + // + if(response is null) { if (lastProviderRequestFailure is not ProviderRequestFailureReason.NONE) {