Skip to content

fix(harness): add reply IDs to subagent lifecycle events - #2680

Merged
jujn merged 8 commits into
agentscope-ai:mainfrom
mikemikimike:codex/2498-subagent-reply-id
Aug 26, 2026
Merged

fix(harness): add reply IDs to subagent lifecycle events#2680
jujn merged 8 commits into
agentscope-ai:mainfrom
mikemikimike:codex/2498-subagent-reply-id

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

Fixes #2498

Summary:

  • Generate one replyId for the local synchronous subagent lifecycle wrapper.
  • Reuse it for AGENT_START and AGENT_END.
  • Assert non-null matching IDs on normal completion and cancellation.

Validation:

  • mvn -pl agentscope-harness -am spotless:check
  • mvn -pl agentscope-harness -am -Dtest=AgentSpawnToolCancelEndEventTest -Dsurefire.failIfNoSpecifiedTests=false test
  • mvn -pl agentscope-harness -am verify

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

@AgentScopeJavaBot AgentScopeJavaBot added bug Something isn't working area/harness agentscope-harness (test/runtime support) labels Aug 15, 2026
@mikemikimike
mikemikimike force-pushed the codex/2498-subagent-reply-id branch from 74ad371 to d432b94 Compare August 17, 2026 08:45
@guslegend0510

Copy link
Copy Markdown
Contributor

整体思路没问题,AGENT_START 和 AGENT_END 使用同一个非空 replyId,正常完成和取消场景的测试也通过了。
不过还有两个地方需要补一下:
默认 AG-UI 会把子 Agent 生命周期转换成 subagent.lifecycle,目前 payload 只包含 source/type/name,没有透传新增的 replyId。通过 AG-UI 的客户端仍然拿不到这个字段。建议 Start/End 都增加 replyId,并补充配对断言。
OtelTracingMiddleware 会读取事件流中所有非空的 AgentStartEvent.replyId。现在子 Agent 的 Start 也有 ID 后,会覆盖父 invoke_agent span 的 agentscope.agent.reply_id;多个子 Agent 并发时结果还可能不稳定。建议只处理 source == null 的顶层 Start 事件,并增加父子事件回归测试。
我本地跑过 mvn -q -pl agentscope-harness -am verify,现有测试可以通过。上面两个问题也分别用最小测试复现了。修完这两点后我认为就可以合并了。

@guslegend0510

Copy link
Copy Markdown
Contributor

LGTM

@jujn
jujn merged commit c1c6660 into agentscope-ai:main Aug 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/harness agentscope-harness (test/runtime support) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:子agent的 AGENT_START/AGENT_END 事件没有replyId

4 participants