← Back to PRs

#17028: fix(subagent): retry announce on timeout

by Limitless2023 open 2026-02-15 10:06 View on GitHub →
agents stale size: S
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