yunfengzhou-hub commented on code in PR #1114:
URL: https://github.com/apache/flink-agents/pull/1114#discussion_r4037114121


##########
plan/src/main/java/org/apache/flink/agents/plan/actions/ToolCallAction.java:
##########
@@ -344,6 +387,151 @@ private static void recordInlineResponse(
         }
     }
 
+    private static void dispatchAgentExecution(
+            ToolCallExecution execution,
+            RunnerContext ctx,
+            Map<String, Boolean> success,
+            Map<String, String> error,
+            Map<String, ToolResponse> responses)
+            throws InterruptedException {
+        try {
+            // submit() and await() already run through durable execution 
inside the setup, so
+            // wrapping the call again here would nest durable cursors.
+            SubagentResult result = execution.agent.submit(ctx, 
execution.agentArguments).await();
+            recordAgentResult(execution, result, ctx, success, error, 
responses);
+        } catch (InterruptedException e) {
+            // A cancellation, not a sub-agent failure: propagate it exactly 
like the tool paths do
+            // (#1111) so the caller skips sendEvent instead of folding the 
cancellation into a
+            // tool-error response and driving a further chat call off it.
+            Thread.currentThread().interrupt();
+            throw e;
+        } catch (Exception e) {

Review Comment:
   I've added both guarantees. One the one hand, 
`ToolResultUtils.requireJsonCompatible` checks for pontential loops and fail 
early in that case. On the other hand, `catch StackOverflowError` is also added 
to invoker's try-catch blocked.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to