Skip to content

feat(subagents): add config option to suppress announce messages (#8299) - #8393

Closed
Glucksberg wants to merge 2 commits into
openclaw:mainfrom
Glucksberg:fix/8299-suppress-subagent-announce
Closed

Glucksberg wants to merge 2 commits into
openclaw:mainfrom
Glucksberg:fix/8299-suppress-subagent-announce

Conversation

@Glucksberg

@Glucksberg Glucksberg commented Feb 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #8299

Sub-agent completion announcements can be noisy for internal background tasks.

Changes:

  • Added agents.defaults.subagents.suppressAnnounce boolean config option (default: false)
  • Added silent parameter to sessions_spawn tool for per-spawn override
  • Per-spawn silent takes precedence over global config
  • shouldSuppressAnnounce() helper checks both levels
  • Threaded silent through SubagentRunRecord and all 3 call sites of runSubagentAnnounceFlow
  • Cleanup (label patching, session deletion) still runs even when suppressed

Usage:

  • Global: agents.defaults.subagents.suppressAnnounce: true
  • Per-spawn: sessions_spawn({ task: '...', silent: true })

Greptile Overview

Greptile Summary

This PR adds a global config (agents.defaults.subagents.suppressAnnounce) and a per-spawn override (silent on sessions_spawn) to suppress sub-agent completion announcements. The silent flag is threaded through sessions_spawn → registerSubagentRun → runSubagentAnnounceFlow, where announcements are skipped early while still attempting label patching and session deletion in finally. Schema/types were updated to validate the new config option.

One issue to watch: the cleanup bookkeeping in subagent-registry currently treats didAnnounce=false as a failure worth retrying. Since suppression also returns false, suppressed runs can get stuck in a retry loop and never mark cleanup complete when cleanup: "keep".

Confidence Score: 3/5

  • This PR is mostly safe to merge, but there is a functional cleanup-state issue when announcements are suppressed.
  • The changes are localized (config/schema + a new flag threaded through) and the suppression logic is straightforward. However, didAnnounce=false is now overloaded to mean both “suppressed” and “failed”, which interacts badly with retry bookkeeping and can cause suppressed runs to be retried indefinitely when cleanup is keep. That’s a real behavioral regression worth fixing before merge.
  • src/agents/subagent-registry.ts (cleanup bookkeeping) and the call/return contract around runSubagentAnnounceFlow in src/agents/subagent-announce.ts

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps

greptile-apps Bot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor
Additional Comments (1)

src/agents/subagent-registry.ts
runSubagentAnnounceFlow() now returns false both when the announce fails and when it’s intentionally suppressed (via silent / config). In finalizeSubagentCleanup(), !didAnnounce triggers cleanupHandled=false to allow retries, which will cause suppressed runs (especially cleanup:"keep") to be retried on every wake/restart and never reach cleanupCompletedAt.

This is observable when silent: true or agents.defaults.subagents.suppressAnnounce: true and cleanup is keep.

A simple fix is to distinguish “suppressed” from “failed” (e.g., return a tri-state, or pass a separate suppressed flag) so suppression is treated as success for cleanup bookkeeping.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/subagent-registry.ts
Line: 259:262

Comment:
`runSubagentAnnounceFlow()` now returns `false` both when the announce *fails* and when it’s intentionally *suppressed* (via `silent` / config). In `finalizeSubagentCleanup()`, `!didAnnounce` triggers `cleanupHandled=false` to allow retries, which will cause suppressed runs (especially `cleanup:"keep"`) to be retried on every wake/restart and never reach `cleanupCompletedAt`.

This is observable when `silent: true` or `agents.defaults.subagents.suppressAnnounce: true` and `cleanup` is `keep`.

A simple fix is to distinguish “suppressed” from “failed” (e.g., return a tri-state, or pass a separate `suppressed` flag) so suppression is treated as success for cleanup bookkeeping.

How can I resolve this? If you propose a fix, please make it concise.

@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Feb 4, 2026
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from f5e0985 to c620518 Compare February 4, 2026 05:11
@Glucksberg

Copy link
Copy Markdown
Contributor Author

Fixed in 994087c9d — runSubagentAnnounceFlow() now returns true when the announcement is suppressed (via silent or global config), so finalizeSubagentCleanup() treats suppression as success. Previously it returned false, which caused cleanup:"keep" runs to be retried on every wake/restart since they never reached cleanupCompletedAt.

@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch 5 times, most recently from bfcabea to 30a8f08 Compare February 7, 2026 13:48
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from 30a8f08 to 86d057e Compare February 8, 2026 01:30
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch 4 times, most recently from 7f1d25f to 4c53c16 Compare February 9, 2026 13:31
@ivalsaraj

Copy link
Copy Markdown

Nice work on this — the silent param + global config approach is clean and covers the suppression case well.

One thing we've been dealing with on our end: we don't just want to suppress announces, we want to route them back to the parent agent so it can act as an orchestrator. Think: parent spawns 5 sub-agents, reviews all their results, then sends one curated summary to the user instead of 5 separate announces flooding the chat.

We opened #12730 proposing extending this to an announce: "user" | "parent" | "skip" param — where your silent: true maps to "skip", current default is "user", and "parent" injects the announce as a system event into the spawning session.

Would be great if the API shape could accommodate this from the start rather than shipping silent now and refactoring to an enum later. Happy to help with the implementation if there's interest.

@Glucksberg

Copy link
Copy Markdown
Contributor Author

Thanks for the thoughtful feedback and for opening #12730 — I think the orchestrator pattern is a natural evolution of this.

You're right that shipping silent: boolean now and refactoring to an enum later creates unnecessary migration friction. I'm open to evolving the API shape in this PR before merge.

Here's how I see the implementation mapping to your proposal:

API change:

// sessions_spawn tool schema
announce?: "user" | "parent" | "skip"  // default: "user"

// Global config
agents.defaults.subagents.announce: "user" | "parent" | "skip"  // default: "user"

Per-spawn announce overrides the global config, same precedence model as current silent.

What each mode does in runSubagentAnnounceFlow:

  • "user" — Current behavior. Resolve announce target, call agent method with deliver: true, message goes to requester chat channel. No changes needed.
  • "skip" — Return true early (already implemented as silent: true). Cleanup still runs.
  • "parent" — This is the new path. Instead of resolving a channel target and calling agent with deliver: true, we'd inject a system event into the parent (requester) session via enqueueSystemEvent(). The parent agent wakes up on its next turn and sees the result as context.

System event payload for "parent" mode:

[Sub-agent completed] "task-label"
Status: completed successfully | timed out | failed: ...
Session: <childSessionKey>

Findings:
<sub-agent output>

Stats: 42.3k tokens · $0.12 · 1m 23s

Nuances worth discussing:

  1. Parent session wakeup — enqueueSystemEvent() queues the event in memory, but it only gets consumed on the parent's next turn. If the parent is idle (no incoming messages, no heartbeat), the event sits there until something triggers the session. We'd probably want to pair this with a lightweight wake/ping to the parent session via callGateway({ method: "agent", params: { sessionKey, message: systemEventText } }) so the parent actually processes it promptly. Otherwise the user would have to send a message first to "wake" the parent.

  2. Multiple sub-agents finishing concurrently — The announce queue (subagent-announce-queue.ts) currently batches and debounces announces headed to the same channel. For "parent" mode, we'd need similar batching logic — or we could rely on the parent agent being smart enough to handle multiple system events arriving in quick succession. The existing queue could be adapted to batch parent-directed events too.

  3. Announce queue interaction — Currently maybeQueueSubagentAnnounce() handles the "steered"/"queued" path for user-facing announces. The "parent" path should probably bypass this queue entirely (or have its own) since it's injecting into a session, not posting to a channel.

  4. Cleanup behavior — "parent" should behave like "user" for cleanup purposes: didAnnounce = true once the event is injected, label patching and session deletion still run in finally. With cleanup: "keep", the parent can follow up with sessions_history on the child session if it needs more detail.

  5. Backward compat — I'd keep silent: boolean working as an alias (silent: true → announce: "skip") for one release cycle, with a deprecation note. The global config suppressAnnounce: boolean would similarly map to announce: "skip".

Estimated scope: ~5 files, mostly the same ones already touched in this PR. The "parent" path in runSubagentAnnounceFlow is roughly 20-30 lines — it's the same announce flow but targeting the parent session instead of a channel.

Happy to refactor this PR to use the enum approach. Would you want to co-author the "parent" path, or should I take a first pass and you can review?

@ivalsaraj

Copy link
Copy Markdown

Hey @Glucksberg — we went ahead and built the enum approach based on your proposed architecture. PR is up: #13303

Key decisions:

  • Dropped silent: boolean and suppressAnnounce entirely (no backward compat needed since this PR hasn't merged yet)
  • Clean API: announce: "user" | "parent" | "skip" — both per-spawn and global config
  • "parent" mode injects a system event into the spawning session + wakes the parent via a non-delivered agent turn
  • Cleanup semantics preserved across all three modes

Your base commits are included (with co-author credit). The "parent" path follows the architecture you outlined — enqueueSystemEvent() for injection, same announce format with status/summary/stats.

One thing we didn't integration test: the actual parent wake behavior on a live gateway. Would be great if you (or the maintainers) could validate that path end-to-end.

Happy to iterate on any feedback.

@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from ef25263 to 714f836 Compare February 10, 2026 13:31
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from 714f836 to 52db824 Compare February 11, 2026 01:34
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from 2a16f67 to 92c77ca Compare February 13, 2026 13:57
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from 92c77ca to d7b4b28 Compare February 13, 2026 22:15
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from a2f3121 to a5bb992 Compare February 14, 2026 03:48
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch 2 times, most recently from 7391148 to 568ad90 Compare February 14, 2026 22:33
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from 568ad90 to f97886f Compare February 15, 2026 01:44
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from f97886f to 0d6c0ae Compare February 15, 2026 10:36
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from 0d6c0ae to 5e7cc74 Compare February 15, 2026 22:33
…sages (openclaw#8299)

Add agents.defaults.subagents.suppressAnnounce (boolean, default false) to
globally suppress sub-agent completion announcements to the parent session.

Also add a per-spawn 'silent' parameter to sessions_spawn tool, allowing
individual spawns to override the global setting. The per-spawn flag takes
precedence over the global config.

When suppressed, the announce message is skipped but cleanup (label patching,
session deletion) still runs normally via the finally block.

Config example:
  agents:
    defaults:
      subagents:
        suppressAnnounce: true

Per-spawn example:
  sessions_spawn({ task: '...', silent: true })

Closes openclaw#8299
@Glucksberg
Glucksberg force-pushed the fix/8299-suppress-subagent-announce branch from 5e7cc74 to 3d0feaf Compare February 16, 2026 10:38
@Glucksberg

Copy link
Copy Markdown
Contributor Author

Closing in favor of #13303, which evolved from the discussion here.

@ivalsaraj took the silent: boolean approach from this PR and extended it into the full announce: "user" | "parent" | "skip" enum — which is a cleaner API shape that avoids a future migration. The base commits from this PR are included in #13303 with co-author credit.

Thanks to everyone who contributed to the design discussion here.

@Glucksberg Glucksberg closed this Feb 16, 2026
@Glucksberg
Glucksberg deleted the fix/8299-suppress-subagent-announce branch February 27, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: config option to suppress sub-agent announce

2 participants