Fix subagent startup lifecycle signals#76356
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded. A newer same-author PR now carries the same startup lifecycle change plus follow-up fixes for the terminal-ordering and gateway wait gaps found here; current main still lacks the feature, so remaining review should happen on the successor branch. So I’m closing this here and keeping the remaining discussion on the canonical linked item. Review detailsBest possible solution: Use #77415 as the canonical branch and land it only after the remaining review and real behavior proof are resolved there. Do we have a high-confidence way to reproduce the issue? Yes, at source level. Current main accepts only start/end/error in the affected consumers and maps aborted end events to timeout, while this PR's added startup-failed path can still be followed by a later end event. Is this the best way to solve the issue? No for this branch. The additive lifecycle direction is right, but the newer successor PR is the narrower review target because it includes this change plus fixes for the late end and gateway wait gaps. Security review: Security review cleared: No concrete security or supply-chain issue found; the diff changes in-repo lifecycle logic, tests, docs, and changelog only. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 983064f5f819. |
a00d14c to
2969df1
Compare
Summary
Fixes #58776 by making embedded subagent startup state explicit instead of letting silent aborted runs look like hangs.
first-progresslifecycle signal on the first visible assistant text or tool callstartup-failedwhen an embedded run aborts before first progressstartup-failedas a terminal startup failureValidation
git diff --checkpnpm check:docspnpm check:test-typespnpm test src/agents/pi-embedded-subscribe.handlers.lifecycle.test.ts src/agents/pi-embedded-subscribe.handlers.tools.test.ts src/agents/openclaw-owned-tool-runtime-contract.test.ts src/agents/openclaw-tools.subagents.sessions-spawn.lifecycle.test.ts src/agents/subagent-registry.lifecycle-retry-grace.e2e.test.ts src/gateway/server-methods/server-methods.test.ts src/gateway/session-lifecycle-state.test.ts packages/sdk/src/index.test.ts src/agents/subagent-registry.test.tspnpm lint src/agents/pi-embedded-subscribe.handlers.lifecycle.ts src/agents/pi-embedded-subscribe.handlers.lifecycle.test.ts src/agents/pi-embedded-subscribe.handlers.messages.ts src/agents/pi-embedded-subscribe.handlers.tools.ts src/agents/pi-embedded-subscribe.handlers.tools.test.ts src/agents/pi-embedded-subscribe.handlers.types.ts src/agents/pi-embedded-subscribe.ts src/agents/pi-tool-handler-state.test-helpers.ts src/agents/subagent-registry.ts src/agents/subagent-registry.test.ts src/gateway/server-methods/agent-job.ts src/gateway/session-lifecycle-state.ts src/gateway/session-lifecycle-state.test.ts src/agents/openclaw-owned-tool-runtime-contract.test.ts