#17028: fix(subagent): retry announce on timeout
agents
stale
size: S
Cluster:
Subagent Enhancements and Features
Fixes #17000
## Problem
Sub-agent task results are silently lost when announcement delivery exceeds the 60-second gateway timeout. No retry, no error shown to user.
## Solution
- Add retry logic with exponential backoff (up to 3 attempts)
- Delay between retries: 5s, 10s, 20s (capped at 30s)
- Log retries and final failures for debugging
## Impact
- Subagent results are more reliably delivered to parent session
- Timeout failures are now logged instead of silently dropped
- Backoff prevents overwhelming busy gateway
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds retry logic with exponential backoff (up to 3 attempts, 5s/10s/20s delays) to `sendAnnounce` in `src/agents/subagent-announce.ts` to handle gateway timeout failures when delivering subagent task results.
- The retry mechanism correctly catches timeout errors and applies capped exponential backoff before retrying
- **Issue**: A new `idempotencyKey` is generated on each retry attempt. Since the gateway deduplicates `agent` method calls by idempotency key, retries bypass dedup and can cause duplicate message delivery if the original request succeeded but its response timed out
- The previously-flagged `log` variable issue (undefined/not imported) still needs to be resolved before merging
<h3>Confidence Score: 2/5</h3>
- This PR has a runtime crash bug (undefined `log`) and a duplicate delivery risk from regenerating idempotency keys on retries.
- Score of 2 reflects two issues: the `log` ReferenceError (already flagged, not yet fixed) will crash the retry/error paths at runtime, and the new idempotencyKey per retry bypasses gateway deduplication, risking duplicate subagent announcements to the parent session.
- `src/agents/subagent-announce.ts` — both the `log` import and idempotencyKey reuse need to be addressed
<sub>Last reviewed commit: 59e87d9</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#17001: fix: retry sub-agent announcements with backoff instead of silently...
by luisecab · 2026-02-15
88.3%
#20328: fix(agents): Add retry with exponential backoff for subagent announ...
by tiny-ship-it · 2026-02-18
86.1%
#18205: fix (agents): add periodic retry timer for failed subagent announces
by MegaPhoenix92 · 2026-02-16
83.6%
#16944: fix: retry transient WebSocket 1006 closures in callGateway + annou...
by sudobot99 · 2026-02-15
83.3%
#22719: fix(agents): make subagent announce timeout configurable (restore 6...
by Valadon · 2026-02-21
80.1%
#17721: fix: abort child run on subagent timeout + retry with backoff + sta...
by IrriVisionTechnologies · 2026-02-16
79.7%
#13105: fix: debounce subagent lifecycle events to prevent premature announ...
by mcaxtr · 2026-02-10
79.3%
#19243: fix(announce-queue): cap per-item send retries to prevent infinite ...
by taw0002 · 2026-02-17
78.4%
#18468: fix(agents): prevent infinite retry loops in sub-agent completion a...
by BinHPdev · 2026-02-16
77.6%
#8893: fix: enhance subagent error reporting with diagnostic context
by joetomasone · 2026-02-04
75.3%