Bug Description
ACP sessions spawned via sessions_spawn({ runtime: "acp", mode: "run" }) never trigger the auto-announce flow to the parent session.
Root Cause (traced in source)
The announce system depends on lifecycle events with phase: "end":
- Standard subagent runs go through
runEmbeddedPiAgent → emits { stream: "lifecycle", phase: "end" } when done
- The subagent registry listener (
ensureListener in reply-*.js) picks up that event → calls completeSubagentRun → triggers runSubagentAnnounceFlow → announces to parent
ACP sessions take a different code path:
- ACP turns dispatch via
tryDispatchAcpReply → acpManager.runTurn()
- When the ACP turn completes, it calls
recordProcessed("completed") and markIdle("message_completed")
- It never emits the
lifecycle event with phase: "end"
- So the subagent registry listener never fires → no announce
Expected Behavior
ACP sessions spawned with mode: "run" should auto-announce their completion to the parent session, just like standard subagent runs.
Reproduction
sessions_spawn({
task: "echo hello",
runtime: "acp",
agentId: "claude",
mode: "run",
thread: true
})
The session completes but no announce message appears in the parent session or Discord channel.
Environment
- OpenClaw: v2026.3.7
- acpx: v0.1.15
- Node: 22.19.0
- OS: macOS (arm64)
Suggested Fix
In tryDispatchAcpReply (src/auto-reply/reply/dispatch-acp.ts), after acpManager.runTurn() completes successfully, emit:
emitAgentEvent({
runId,
stream: "lifecycle",
data: {
phase: "end",
endedAt: Date.now()
}
});
This would connect the ACP completion to the existing announce pipeline.
Workaround
Parent agent manually announces via message(action=send) after detecting ACP completion through streamTo: "parent" system events.
Bug Description
ACP sessions spawned via
sessions_spawn({ runtime: "acp", mode: "run" })never trigger the auto-announce flow to the parent session.Root Cause (traced in source)
The announce system depends on
lifecycleevents withphase: "end":runEmbeddedPiAgent→ emits{ stream: "lifecycle", phase: "end" }when doneensureListenerinreply-*.js) picks up that event → callscompleteSubagentRun→ triggersrunSubagentAnnounceFlow→ announces to parentACP sessions take a different code path:
tryDispatchAcpReply→acpManager.runTurn()recordProcessed("completed")andmarkIdle("message_completed")lifecycleevent withphase: "end"Expected Behavior
ACP sessions spawned with
mode: "run"should auto-announce their completion to the parent session, just like standard subagent runs.Reproduction
The session completes but no announce message appears in the parent session or Discord channel.
Environment
Suggested Fix
In
tryDispatchAcpReply(src/auto-reply/reply/dispatch-acp.ts), afteracpManager.runTurn()completes successfully, emit:This would connect the ACP completion to the existing announce pipeline.
Workaround
Parent agent manually announces via
message(action=send)after detecting ACP completion throughstreamTo: "parent"system events.