fix: register ACP run-mode spawns in subagent registry for completion announce#40273
fix: register ACP run-mode spawns in subagent registry for completion announce#40273yaseenkadlemakki wants to merge 1 commit into
Conversation
Greptile SummaryThis PR fixes a missing completion notification for ACP Key changes:
Confidence Score: 4/5
Last reviewed commit: ce778bc |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce778bcf8d
ℹ️ 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".
… announce Closes openclaw#40272 When sessions_spawn is called with runtime="acp" and mode="run", the spawned session previously had no completion notification mechanism. The existing subagent announce pipeline (used by runtime="subagent") was never invoked, so the requester channel (Discord, WhatsApp, etc.) never received a push notification when the task finished. Root cause: spawnAcpDirect() did not register the run in the subagent registry. The registry's onAgentEvent listener monitors lifecycle:end events and calls runSubagentAnnounceFlow, which delivers the completion message back to the requester channel. Fix: After a successful ACP run-mode dispatch, call registerSubagentRun() with expectsCompletionMessage=true. The existing registry infrastructure then handles detection and delivery automatically. Scope: - Only applied to mode="run" (one-shot) ACP sessions. Session-mode (persistent thread-bound) sessions are long-lived with no natural completion event to announce. - Requires an explicit requester session key (ctx.agentSessionKey) to avoid affecting standalone / CLI-triggered ACP spawns. - registerSubagentRun() failure is caught and logged; the spawn still returns "accepted". Tests: 4 new cases in acp-spawn.test.ts
ce778bc to
eabc70e
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing this as implemented after Codex review. Close. Current What I checked:
So I’m closing this as already implemented rather than keeping a duplicate issue open. Review notes: reviewed against f00d65a30496; fix evidence: commit 724692bb8cf5. |
Problem
Closes #40272
When
sessions_spawnis called withruntime="acp"andmode="run", the spawned session had no completion notification mechanism. The requester channel (Discord, WhatsApp, etc.) never received a push notification when the task finished — users had to manually ask for status.Root Cause
spawnAcpDirect()did not register the run in the subagent registry. The registry'sonAgentEventlistener already monitorslifecycle:endevents and callsrunSubagentAnnounceFlowfor all registered runs — but ACP runs were never registered, so the pipeline was never invoked.Fix
A one-liner conceptually: after a successful ACP run-mode dispatch, call
registerSubagentRun()withexpectsCompletionMessage: true. The existing announce infrastructure does the rest.Scope
runtime="acp",mode="run"runtime="acp",mode="session"agentSessionKey(standalone/CLI)Safety
registerSubagentRun()failure is caught and logged — the spawn still returns"accepted"cleanup: "keep"— ACP sessions are not deleted by the registry on completionTests
4 new test cases in
src/agents/acp-spawn.test.ts:agentSessionKeyis not registered"accepted"resultAll 18 existing
acp-spawn.test.tstests continue to pass.