Fixed a misleading tool calling error after a stopped or interrupted answer (#1202)

Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
j-erlerandThorsten Sommer authored and GitHub committed 2026-11-20 14:46:27 +01:00
1 parent fb8f51dec4
commit ca7413d84c
18 files changed
+272 -76

No files matched your search

@@ -109,11 +109,17 @@ public sealed class ToolCallingLoop(ILogger<ToolCallingLoop> logger) : IToolCall
}
//
// No outcome means the round failed: the request errored out, or the stream ended
// mid-sentence. Either way the adapter has already reported it. The answer keeps what
// was written so far, and with it what the tools of the earlier rounds contributed:
// No outcome means the round failed: its request errored out, or a stop, a timeout, or
// a broken connection cut off its stream. The user has been told about an error
// already, and a stop is none. The answer keeps what was written so far, and with it
// what the tools of the earlier rounds contributed.
//
if (round is null)
// A stop may also come after the provider closed the stream, before the round is acted
// on. It ends the answer the same way: a round without text and without calls is then
// no invalid answer of the provider, and a call of this round must not run after the
// user said stop.
//
if (round is null || token.IsCancellationRequested)
{
await context.ResetToolRuntimeStatusAsync();
if (toolSources.Count > 0 || toolPassages.Count > 0)