Repository navigation
fix(agui): use unique message IDs for discontinuous text segments - #3010
Merged
Merged
Conversation
Collaborator
|
不只是 text,reasoning 也有同样的问题哈 |
Contributor
Author
收到老师,那我按相同思路为连续 reasoning 段生成独立的 blockId,并补充回归测试,预计改动量不大,感谢您审阅和提醒 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
Author
|
@jujn 老师,我补齐 reasoning 场景并增加了相关回归测试了,等您有空能麻烦再帮忙看一下吗 |
dargoner
added a commit
to dargoner/agentscope-java
that referenced
this pull request
Sep 12, 2026
上游 agentscope-ai#3010 之后文本消息 ID 为 replyId-blockId(如 reply-1-text-1),本分支的 AguiStreamContext 仍把传入值当 replyId 再拼 :text:N,导致处置事件 messageIds 与流式消息 ID 不一致。 改为直接复用官方 messageId,并从段 ID 反推所属 replyId 维持处置分组;同步更新预留段 ID 判定、AG-UI 测试期望与 README 说明。
dargoner
added a commit
to dargoner/agentscope-java
that referenced
this pull request
Sep 12, 2026
上游 agentscope-ai#3010 之后文本消息 ID 为 replyId-blockId(如 reply-1-text-1),本分支的 AguiStreamContext 仍把传入值当 replyId 再拼 :text:N,导致处置事件 messageIds 与流式消息 ID 不一致。 改为直接复用官方 messageId,并从段 ID 反推所属 replyId 维持处置分组;保留按本轮实际生成段判定快照排除的语义,同步更新测试期望与 README 说明。
dargoner
added a commit
to dargoner/agentscope-java
that referenced
this pull request
Sep 12, 2026
上游 agentscope-ai#3010 之后文本消息 ID 为 replyId-blockId(如 reply-1-text-1),本分支的 AguiStreamContext 仍把传入值当 replyId 再拼 :text:N,导致处置事件 messageIds 与流式消息 ID 不一致。 改为直接复用官方 messageId,并从段 ID 反推所属 replyId 维持处置分组;保留按本轮实际生成段判定快照排除的语义,同步更新测试期望与 README 说明。 (cherry picked from commit 42ad838)
dargoner
added a commit
to dargoner/agentscope-java
that referenced
this pull request
Sep 12, 2026
把本地流式文本处置分支与 PR 分支对齐,避免两条线各自漂移: - AG-UI:最终快照排除的文本段改为按本轮实际启动的文本消息集合(startedTextMessages)判定,不再用消息 ID 正则反推,并同步适配器测试; - harness:子代理结束前补发权威 AGENT_RESULT 事件,并补充事件顺序断言; - core:补回上游 agentscope-ai#3010、agentscope-ai#2757 覆盖的不连续文本段唯一块 ID 与摘要失败终止状态用例(此前本地合并时遗漏)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope-Java Version
2.0.3-SNAPSHOT
Description
Fixes #2988.
当单次模型调用先输出文本、后输出工具调用、接着再输出文本(或推理内容)时,核心层之前对所有片段重用了相同的块 ID (
"text"/"thinking")。AG-UI 适配器随后也重用了相同的消息 ID,导致在对应的TEXT_MESSAGE_END之后发出了第二个TEXT_MESSAGE_CONTENT/REASONING_MESSAGE_CONTENT,且缺少匹配的TEXT_MESSAGE_START/REASONING_MESSAGE_START,从而引发了客户端错误:"No active text message found with ID"。此更改:
ModelCallBlockLifecycle内部为每个连续的文本或推理片段分配一个不同的块 ID ("text","text-2", ... /"thinking","thinking-2", ...)。通过AtomicLong计数器跟踪的片段序列在每次startText/startThinking时(在之前的flushText/flushThinking关闭当前片段后)都会递增;replyId + "-" + blockId—— 一个没有特殊情况或后缀的纯函数。第一段文本片段变为replyId-text,第一段推理片段变为replyId-thinking,后续片段变为replyId-text-2/replyId-thinking-2等;REASONING_MESSAGE_ID_SUFFIX("-reasoning") 常量和withReasoningSuffix方法。文本和推理消息天然具有不同的 ID,因为它们的块 ID 不同 ("text"与"thinking"),这使得后缀变得多余;text → tool call → text和thinking → tool call → thinking序列添加了核心和 AG-UI 回归测试,并更新了现有的 AG-UI 测试以符合新的消息 ID 方案。测试
ReActAgentNewLoopReplyTest: 14 通过,0 失败。Checklist