From 66701c56acb06c9cb56601f5deb65235f5178071 Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Tue, 11 Aug 2026 22:04:42 +0900 Subject: Preserve planned tool parameters and bound failures --- src/Agent.Core/Runtime/AgentRuntime.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Agent.Core/Runtime/AgentRuntime.cs') diff --git a/src/Agent.Core/Runtime/AgentRuntime.cs b/src/Agent.Core/Runtime/AgentRuntime.cs index f1c7186..3722ff3 100644 --- a/src/Agent.Core/Runtime/AgentRuntime.cs +++ b/src/Agent.Core/Runtime/AgentRuntime.cs @@ -302,6 +302,10 @@ public sealed class AgentRuntime(TaskRegistry registry, IOllamaClient ollama, Ag if (unresolvedToolFailures.Count > 0) { + string unresolvedFingerprint = string.Join(";", unresolvedToolFailures.OrderBy(static item => item.Key, StringComparer.Ordinal) + .Select(static item => $"{item.Key}={item.Value}")); + ToolUseGuardResult unresolvedGuard = guard.Evaluate(true, false, false, unresolvedFingerprint); + if (unresolvedGuard.Decision == ToolUseGuardDecision.Fail) throw new InvalidOperationException(unresolvedGuard.Observation); messages.Add(new OllamaMessage("system", "Completion is not allowed while tool failures remain unresolved. Retry or correct: " + string.Join("; ", unresolvedToolFailures.Select(static item => $"{item.Key}={item.Value}")))); continue; -- cgit v1.2.3