You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ad57379
Browse filesBrowse the repository at this point in the historyBrowse files
Jacob Alber
committed
Fix handoff orchestration not passing user message to handoff target agent (#3161)
Filter out internal handoff function call and tool result messages before
passing conversation history to the target agent's LLM. These messages
confused the model into ignoring the original user question.
(stringupdateText,List<ChatMessage>?result)=awaitRunWorkflowAsync(workflow,[newChatMessage(ChatRole.User,"What is the derivative of x^2?")]);
308
+
309
+
Assert.NotNull(capturedNextAgentMessages);
310
+
311
+
// The target agent should see the original user message
312
+
Assert.Contains(capturedNextAgentMessages, m =>m.Role==ChatRole.User&&m.Text=="What is the derivative of x^2?");
313
+
314
+
// The target agent should NOT see the handoff function call or tool result from the source agent
315
+
Assert.DoesNotContain(capturedNextAgentMessages, m =>m.Contents.Any(c =>cisFunctionCallContentfcc&&fcc.Name.StartsWith("handoff_to_",StringComparison.Ordinal)));
316
+
Assert.DoesNotContain(capturedNextAgentMessages, m =>m.Role==ChatRole.Tool&&m.Contents.Any(c =>cisFunctionResultContentfrc&&frc.Result?.ToString()=="Transferred."));
// Second agent should see the original user message only (no handoff messages from initialAgent)
366
+
Assert.NotNull(capturedSecondAgentMessages);
367
+
Assert.Contains(capturedSecondAgentMessages, m =>m.Role==ChatRole.User&&m.Text=="abc");
368
+
Assert.DoesNotContain(capturedSecondAgentMessages, m =>m.Contents.Any(c =>cisFunctionCallContentfcc&&fcc.Name.StartsWith("handoff_to_",StringComparison.Ordinal)));
369
+
Assert.DoesNotContain(capturedSecondAgentMessages, m =>m.Role==ChatRole.Tool&&m.Contents.Any(c =>cisFunctionResultContent));
370
+
371
+
// Third agent should see the original user message only (no handoff messages from initialAgent or secondAgent)
372
+
Assert.NotNull(capturedThirdAgentMessages);
373
+
Assert.Contains(capturedThirdAgentMessages, m =>m.Role==ChatRole.User&&m.Text=="abc");
374
+
Assert.DoesNotContain(capturedThirdAgentMessages, m =>m.Contents.Any(c =>cisFunctionCallContentfcc&&fcc.Name.StartsWith("handoff_to_",StringComparison.Ordinal)));
375
+
Assert.DoesNotContain(capturedThirdAgentMessages, m =>m.Role==ChatRole.Tool&&m.Contents.Any(c =>cisFunctionResultContent));
0 commit comments