Track ACP sessions_spawn runs and emit ACP lifecycle events#40885
Conversation
Greptile SummaryThis PR closes two gaps in the ACP lifecycle completion path: non-
Confidence Score: 4/5
Last reviewed commit: a836cd4 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b60881f5ab
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Re-checked against current This is currently my leading candidate for the lifecycle side of the ACP relay family. |
1 similar comment
|
Re-checked against current This is currently my leading candidate for the lifecycle side of the ACP relay family. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 230247d74d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Follow-up review note after re-checking current main: codex-connector |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 219aa92af0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| cleanup: trackedCleanup, | ||
| label: label || undefined, | ||
| runTimeoutSeconds, | ||
| expectsCompletionMessage: true, |
There was a problem hiding this comment.
Suppress completion announces for inline ACP deliveries
When an ACP run-mode spawn originates from a non-subagent session with a usable delivery target, spawnAcpDirect already sends the child result inline to the user (deliver: true via its bootstrap delivery plan). This new registration always sets expectsCompletionMessage: true, which causes the subagent cleanup pipeline to run an additional completion announce and produce a second user-facing message for the same run. In normal channel sessions this creates deterministic duplicate replies; this should be gated so completion announces are only enabled for ACP spawns that were not already delivered inline.
Useful? React with 👍 / 👎.
…#40885) * Fix ACP sessions_spawn lifecycle tracking * fix(tests): resolve leftover merge markers in sessions spawn lifecycle test * fix(agents): clarify acp spawn cleanup semantics --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…#40885) * Fix ACP sessions_spawn lifecycle tracking * fix(tests): resolve leftover merge markers in sessions spawn lifecycle test * fix(agents): clarify acp spawn cleanup semantics --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…#40885) * Fix ACP sessions_spawn lifecycle tracking * fix(tests): resolve leftover merge markers in sessions spawn lifecycle test * fix(agents): clarify acp spawn cleanup semantics --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
|
We really hope this PR is merged soon because OpenClaw is currently unusable with sub-agents. In the latest version (2026.03.31), the inability to use sub-agents causes significant operational delays and makes the system much slower for multi-task workflows. |
|
This PR is what got sub-agents working again for me. Thanks @xaeon2026 for the thorough fix and @vincentkoc for pushing it through to merge. The detailed breakdown in the description made it easy to follow what was going wrong. Much appreciated. |
…#40885) * Fix ACP sessions_spawn lifecycle tracking * fix(tests): resolve leftover merge markers in sessions spawn lifecycle test * fix(agents): clarify acp spawn cleanup semantics --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…#40885) * Fix ACP sessions_spawn lifecycle tracking * fix(tests): resolve leftover merge markers in sessions spawn lifecycle test * fix(agents): clarify acp spawn cleanup semantics --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…#40885) * Fix ACP sessions_spawn lifecycle tracking * fix(tests): resolve leftover merge markers in sessions spawn lifecycle test * fix(agents): clarify acp spawn cleanup semantics --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…#40885) * Fix ACP sessions_spawn lifecycle tracking * fix(tests): resolve leftover merge markers in sessions spawn lifecycle test * fix(agents): clarify acp spawn cleanup semantics --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…#40885) * Fix ACP sessions_spawn lifecycle tracking * fix(tests): resolve leftover merge markers in sessions spawn lifecycle test * fix(agents): clarify acp spawn cleanup semantics --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Fixes #40693
Summary
This fixes the missing completion path for ACP
sessions_spawnruns in two places:sessions_spawn(runtime="acp")now registers accepted non-streamTo="parent"child runs with the existing subagent registry soagent.wait/announce cleanup can runlifecycleend/errorevents using the active run id, so listeners such as the parent stream relay can observe completion consistentlyWhy both changes are needed
The original issue points at missing ACP lifecycle completion events, which is real, but ACP
sessions_spawnalso was not feeding accepted child runs into the registry path that powers auto-announce cleanup.Without registry tracking, one-shot ACP child runs had nothing waiting on
agent.waitor triggering the announce flow.Without ACP lifecycle
end/error, listeners that subscribe directly to agent events still missed completion.This patch keeps the fix narrow:
streamTo="parent"ACP spawns keep relying on the dedicated parent relay instead of double-announcing through both pathsTests
Added regression coverage for:
sessions_spawnrun-mode spawns are tracked for auto-announce cleanup viaagent.waitstreamTo="parent"spawns do not also register through the auto-announce pathendevents with the active run iderrorevents with the active run idVerification