-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Feature]: announceTarget option for sub-agent completion announce routing #27445
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestNew feature or requestimpact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestNew feature or requestimpact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
Allow sub-agent completion announces to route to the parent session as a user-message trigger instead of directly to the channel, enabling the main agent to orchestrate multi-step workflows.
Problem to solve
When a sub-agent spawned via
sessions_spawncompletes, the completion announce is dispatched directly to the channel as a delivery-mirror assistant message. The parent (main) agent session does not receive this announce as a triggering event and cannot react to it.This means the main agent cannot orchestrate multi-step workflows where it needs to:
The main agent spawns a sub-agent and then goes blind — it never learns the sub-agent finished. The user must manually prompt "what happened?" after every step, defeating the purpose of having an orchestrator.
The current workaround is giving each sub-agent explicit
sessions_sendcallback instructions to message the parent session with a structured payload. This works but requires: boilerplate in every spawn task (parent session key, JSON format, announce suppression via NO_REPLY),sessions_sendin the sub-agent tool allowlist, and previously also required manualsubagents kill+ TERMINATED state instructions to prevent ghost replies.Proposed solution
Add an
announceTargetoption at two levels:1. Config-level default:
2. Per-spawn override (parameter on
sessions_spawn):Behavior when announceTarget is "parent":
Why user-role? The current delivery-mirror (assistant role, 0 tokens) does not trigger an agent turn. For orchestration, the parent must wake up and process the result. User-role injection (same as sessions_send today) is the minimal change.
Token cost: The announce text is just the sub-agent's final output — a short summary, not the full transcript. Equivalent cost to the sessions_send workaround users already employ.
Alternatives considered
sessions_send callback pattern (current workaround): Sub-agent manually sends structured JSON to parent session. Works, but requires boilerplate in every spawn task, extra tools in allowlist, NO_REPLY to suppress duplicate announces, and historically required kill + TERMINATED instructions to prevent ghost replies. Fragile and verbose.
Static workflow tools (Lobster): Deterministic YAML pipelines work well for predefined linear flows (e.g., SEO audit: scrape URL, analyze, report). But each workflow is purpose-built — 10 different workflow types need 10 separate flows. Cannot replace dynamic orchestration where the main agent adapts the plan based on intermediate results, chooses which sub-agent to spawn next, or handles unexpected edge cases. CI pipeline vs engineering lead.
File-based handoff: Sub-agent writes result to a file, main agent reads it later. Requires a separate wake-up mechanism and polling — overengineered compared to native announce routing.
Webhook/hook triggers: Custom hooks on sub-agent completion events. Adds infrastructure complexity without clear benefit over simply routing the existing announce to the parent session.
Impact
Affected: Any user running multi-agent orchestration (main agent + specialized sub-agents)
Severity: Blocks workflow — main agent cannot function as an orchestrator without workarounds
Frequency: Every sub-agent completion in orchestrated workflows (multiple times per task)
Consequence: Without this, users must either (a) manually prompt the main agent after each sub-agent step, or (b) maintain verbose callback boilerplate in every spawn task. Both defeat the purpose of autonomous orchestration and add friction/failure points to every multi-step workflow.
Evidence/examples
Example orchestration flow (currently broken without workaround):
With announceTarget "parent":
Workaround comparison — without this feature, every spawn task requires ~15 lines of callback boilerplate: parent session key, JSON callback format, sessions_send call, NO_REPLY for announce suppression. With this feature, the spawn task is just the task itself, zero boilerplate.
Environment: OpenClaw 2026.2.25, arm64, Discord channel, Opus main + sub-agents (Sonnet, Gemini, MiniMax, Codex)
Additional information