#23048: feat(session): add `announceDeliver` option to suppress auto-delivery of subagent results
agents
size: XS
Cluster:
Subagent Enhancements and Features
## Summary
Add `session.announceDeliver` (boolean, default `true`) to let users opt out of automatic delivery of subagent announce replies to the chat channel.
## Motivation
When agents use structured message formats — Feishu interactive cards, Slack Block Kit, Telegram InlineKeyboard, etc. — instead of plain text, the current hardcoded `deliver: true` in the announce flow causes raw text to leak into the chat channel *before* the agent can send a properly formatted message via its own tools.
Today the only workaround is patching `deliver` in the compiled dist files, which breaks on every update. A first-class config option lets users cleanly control this behavior.
Related: #13267
## Changes
**`src/config/types.base.ts`**
- Add `announceDeliver?: boolean` to `SessionConfig` with JSDoc
**`src/config/zod-schema.session.ts`**
- Add `announceDeliver: z.boolean().optional()` to `SessionSchema`
**`src/agents/subagent-announce.ts`**
- `sendAnnounce()` (queue drain path): read `cfg.session.announceDeliver` and pass it to the `deliver` param
- `sendSubagentAnnounceDirectly()` (direct path): same change
- `buildAnnounceReplyInstruction()`: when `announceDeliver === false`, instruct the agent to use its own tools for delivery and reply `NO_REPLY`
- `runSubagentAnnounceFlow()`: thread the config value into `buildAnnounceReplyInstruction()`
## Behavior
| `announceDeliver` | Trigger injected? | LLM reply auto-delivered? | Reply instruction |
|---|---|---|---|
| `true` (default) | ✅ | ✅ | "Convert and send user-facing update now" |
| `false` | ✅ | ❌ | "Use your own tools to deliver; reply NO_REPLY" |
## Usage
```json
{
"session": {
"announceDeliver": false
}
}
```
## Backward compatibility
Fully backward-compatible. The option defaults to `true` when omitted — existing behavior is unchanged.
## Test plan
- [ ] Verify default behavior (no config / `true`): subagent results auto-delivered as before
- [ ] Verify `announceDeliver: false`: trigger injected into session, agent processes result, but LLM reply is NOT auto-sent to channel
- [ ] Verify agent can still deliver via its own tools (e.g. card API) when `announceDeliver: false`
- [ ] Verify nested subagent announces (requesterIsSubagent) are unaffected by this option
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added `session.announceDeliver` config option (boolean, defaults to `true`) to control whether subagent completion results are automatically delivered to the chat channel. When disabled, the announce trigger is still injected but the LLM's reply is not auto-sent, allowing agents to deliver via structured message tools (Feishu cards, Slack blocks, etc.) instead of leaking raw text.
- Config plumbing: added field to `SessionConfig` type with JSDoc, added to Zod schema validation
- Modified three announce delivery paths (`sendAnnounce`, `sendSubagentAnnounceDirectly`, `runSubagentAnnounceFlow`) to read config and conditionally set `deliver` parameter
- Updated `buildAnnounceReplyInstruction` to provide different instructions when auto-delivery is disabled (instructs agent to use own tools and reply with `NO_REPLY`)
The implementation correctly defaults to `true` (maintaining backward compatibility) and handles the three code paths that control delivery.
<h3>Confidence Score: 4/5</h3>
- Safe to merge with minor style inconsistency
- The implementation is logically correct and backward-compatible. Config schema, type definitions, and all three delivery paths are properly updated. The inconsistency in default value handling (line 1122 passes raw value vs normalized `!== false` in other locations) works correctly but creates maintenance risk if the check in `buildAnnounceReplyInstruction` changes.
- No files require special attention
<sub>Last reviewed commit: 94598c5</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#13303: feat(subagents): replace silent boolean with announce enum ('user'|...
by ivalsaraj · 2026-02-10
80.8%
#22982: fix: prevent stale threadId from routing subagent announces to wron...
by unboxed-ai · 2026-02-21
78.1%
#7584: Tests: align subagent announce wait expectations
by justinhuangcode · 2026-02-03
77.4%
#21547: feat: add compaction.announce config to notify users of compaction ...
by jlwestsr · 2026-02-20
76.7%
#23229: fix(subagent-announce): gate queued delivery on channel deliverabil...
by mcinteerj · 2026-02-22
76.2%
#18699: feat(hooks): add deliver: "auto" mode for webhook mappings
by larrylobster9735 · 2026-02-17
75.1%
#20078: feat(session): Add channelGroups config(optional config) for shared...
by demarlik01 · 2026-02-18
75.0%
#23166: fix(agents): restore subagent announce chain from #22223
by tyler6204 · 2026-02-22
74.9%
#16798: feat(session): add configurable greetingPrompt for /new and /reset
by rustyorb · 2026-02-15
74.7%
#15864: feat: add deliverOnlyToolMessages config for clean messaging channe...
by gandalf-the-engineer · 2026-02-14
74.5%