-
-
Notifications
You must be signed in to change notification settings - Fork 642
fix router response to user #1381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,11 @@ await HookEmitter.Emit<IRoutingHook>(_services, async hook => await hook.OnRouti | |
| } | ||
|
|
||
| message.FunctionArgs = JsonSerializer.Serialize(inst); | ||
| if (!string.IsNullOrEmpty(inst.FunctionArgs)) | ||
| { | ||
| message.FunctionArgs = inst.FunctionArgs; | ||
| } | ||
|
|
||
| if (!string.IsNullOrEmpty(message.FunctionName)) | ||
| { | ||
| var msg = RoleDialogModel.From(message, role: AgentRole.Function); | ||
|
|
@@ -56,7 +61,7 @@ await HookEmitter.Emit<IRoutingHook>(_services, async hook => await hook.OnRouti | |
| message = RoleDialogModel.From(message, role: AgentRole.Assistant, content: content); | ||
| dialogs.Add(message); | ||
| } | ||
| else | ||
| else if (!message.StopCompletion) | ||
| { | ||
| var state = _services.GetRequiredService<IConversationStateService>(); | ||
| var useStreamMsg = state.GetState("use_stream_message"); | ||
|
Comment on lines
+64
to
67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Stopcompletion not honored In InstructExecutor.Execute, the invoked routing function runs on a cloned RoleDialogModel (msg), but the new guard uses message.StopCompletion (which is not updated), so InvokeAgent can still run even when the function intended to stop completion (e.g., response_to_user). This can produce an unintended extra router/agent completion and wrong final output flow. Agent Prompt
|
||
|
|
@@ -71,6 +76,7 @@ await HookEmitter.Emit<IRoutingHook>(_services, async hook => await hook.OnRouti | |
| var response = dialogs.Last(); | ||
|
|
||
| response.Instruction = inst; | ||
| response.StopCompletion = message.StopCompletion; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3. Stopcompletion overwritten In InstructExecutor.Execute, response.StopCompletion = message.StopCompletion can clear a StopCompletion flag already set on the actual response (e.g., by the LLM provider for max-token truncation), preventing InstructLoop from breaking. This can cause extra routing loops and unintended additional LLM/function calls. Agent Prompt
|
||
|
|
||
| return response; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. functionargs used without validation
📘 Rule violation☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools