Handle settings logs agent failures
PR and Push Build/Test / build-and-test (push) Successful in 9m8s

This commit is contained in:
2026-06-09 17:10:06 +02:00
parent 8af89a622d
commit ecdd23bde7
8 changed files with 147 additions and 15 deletions
@@ -21,6 +21,7 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
private readonly TimeSpan reconnectionDelay;
private readonly LiteLlmResponsesCompactionOptions? compactionOptions;
private readonly ILogger? logger;
private readonly Action? retrying;
private int responsesRequestCount;
public LiteLlmResponsesChatClient(
@@ -33,7 +34,8 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
TimeSpan reconnectionDelay,
LiteLlmResponsesCompactionOptions? compactionOptions = null,
ILogger? logger = null,
bool firstRequestIsUser = true)
bool firstRequestIsUser = true,
Action? retrying = null)
: this(
new HttpClient { BaseAddress = NormalizeEndpoint(endpoint) },
apiKey,
@@ -44,7 +46,8 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
reconnectionDelay,
compactionOptions,
logger,
firstRequestIsUser)
firstRequestIsUser,
retrying)
{
}
@@ -58,7 +61,8 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
TimeSpan reconnectionDelay,
LiteLlmResponsesCompactionOptions? compactionOptions = null,
ILogger? logger = null,
bool firstRequestIsUser = true)
bool firstRequestIsUser = true,
Action? retrying = null)
{
this.httpClient = httpClient;
this.httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
@@ -69,6 +73,7 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
this.reconnectionDelay = reconnectionDelay > TimeSpan.Zero ? reconnectionDelay : TimeSpan.Zero;
this.compactionOptions = compactionOptions;
this.logger = logger;
this.retrying = retrying;
responsesRequestCount = firstRequestIsUser ? 0 : 1;
}
@@ -377,6 +382,7 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
lastException = exception;
}
retrying?.Invoke();
await DelayBeforeRetryAsync(cancellationToken).ConfigureAwait(false);
}