fix(executor): harden cancel flow and adopt typed stream part routing#81
Merged
liujuanjuan1984 merged 9 commits intomainfrom Feb 15, 2026
Merged
fix(executor): harden cancel flow and adopt typed stream part routing#81liujuanjuan1984 merged 9 commits intomainfrom
liujuanjuan1984 merged 9 commits intomainfrom
Conversation
Collaborator
Author
|
基于本轮审查,已修复并补测以下关键风险:
验证结果:
对应 commit: |
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.
变更背景
本 PR 已从早期的“取消链路 + 内嵌标记解析”演进为:
part.type + part_id的强类型流路由与乱序修复(Issue [bug] 流式事件强类型路由与 part_id 状态机修复(reasoning/text/tool 误路由与乱序丢块) #85)目标是让流式输出在单 artifact 下保持类型稳定、顺序稳定,并消除 reasoning/text/tool 误路由与重复/丢块问题。
模块一:任务取消链路(Executor / Cancel)
主要改动
cancel()不再强制关闭外部event_queue,避免取消路径阻塞。cancel()能命中并中断正在执行的execute();execute()在finally清理注册状态。相关文件
src/opencode_a2a_serve/agent.pytests/test_cancellation.pytests/test_agent_errors.py模块二:流式输出模型重构(Single Artifact + BlockType)
主要改动
{task_id}:stream)。opencode.block_type(text/reasoning/tool_call)。opencode.sequence保持跨块时序。content_type冗余字段。相关文件
src/opencode_a2a_serve/agent.pytests/test_streaming_output_contract.py模块三:强类型 part 状态机与乱序恢复(Schema-first)
主要改动
part.type + part_id为主路由,建立part_id状态机(buffer / role / message_id / block_type)。message.part.delta与message.part.updated乱序:delta先到时缓存,updated到达后回放。toolpart 输出(tool/call_id/status/...)。相关文件
src/opencode_a2a_serve/agent.pytests/test_streaming_output_contract.py模块四:文档同步
主要改动
block_type、sequence、最终快照策略。delta乱序回放,不再以内嵌 marker parser 作为主路径。相关文件
docs/guide.mddocs/deployment.md回归验证
uv run pre-commit run --all-files✅uv run pytest✅(当前 59 passed)风险与边界
part.updated缺失part_id时使用回退键归并,仅用于兼容异常事件形态。关联关系