-
Notifications
You must be signed in to change notification settings - Fork 56
summary: fix session events not in user->assistant order after summary #759
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: main
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 |
|---|---|---|
|
|
@@ -316,7 +316,13 @@ func (r *runner) handleEventPersistence( | |
| return | ||
| } | ||
|
|
||
| // Trigger summarization immediately after appending a qualifying event. | ||
| // Trigger summarization only after final assistant responses. | ||
| // Skip user messages, tool calls, and tool results to ensure summary | ||
|
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. 这里应该还有遗漏, !event.IsValidContent() 的也需要排除掉。有一种情况是event中仅带deltaState
Contributor
Author
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. 诶,这里前面的shouldPersistEvent 判定应该能挡住
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.
仅带deltaState时 !event.IsValidContent() == true, 拦不住 |
||
| // always contains complete Q&A pairs (including tool call round-trips). | ||
| if agentEvent.IsUserMessage() || agentEvent.IsToolCallResponse() || agentEvent.IsToolResultResponse() { | ||
| return | ||
| } | ||
|
|
||
| // Use EnqueueSummaryJob for true asynchronous processing. | ||
| // Prefer filter-specific summarization to avoid scanning all filters. | ||
| if err := r.sessionService.EnqueueSummaryJob( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
这里可能会有问题。假如第一个agent 执行完后 触发了summary,第二个agent 执行时是不是大概率就都拿不到增量消息了,包括第二个agent在本轮迭代中自己生成的tool相关的消息
Uh oh!
There was an error while loading. Please reload this page.
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.
感觉这里不应该是截断,而是在没有userMessage时 强制将 invocation.Message插入进来
Uh oh!
There was an error while loading. Please reload this page.
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.
欸,没太理解,现在summary应该是绑定的runner,runner执行执行结束的时候触发吧,应该不会在第一个agent执行之后触发?你说的是graph的场景吗
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.
并不是runner结束时触发哦, 执行过程中也可以触发的。 只是你这一版改成了单个agent执行结束后才触发。 multiagent模式下,就会出现上面提到的这个问题。
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.
"假如第一个agent 执行完后 触发了summary,第二个agent 执行时拿不到增量消息",我理解还是能拿到的吧,如果是顺序执行的话,updatetime绑定的是用于summary的最后一个event,增量event理论上没啥影响
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.
第一个agent触发summary后, 第二个agent拿到的增量里是不是就不会包含userMessage了,在经过trimLeadingNonUserMessages处理,返回的就是nil了。