fix(agents): correct completion announce retry backoff schedule

This commit is contained in:
Peter Steinberger
2026-02-18 03:07:47 +00:00
parent a420fa0417
commit 8984f31876

View File

@@ -60,7 +60,10 @@ const ANNOUNCE_EXPIRY_MS = 5 * 60_000; // 5 minutes
function resolveAnnounceRetryDelayMs(retryCount: number) {
const boundedRetryCount = Math.max(0, Math.min(retryCount, 10));
const baseDelay = MIN_ANNOUNCE_RETRY_DELAY_MS * 2 ** boundedRetryCount;
// retryCount tracks completed failed attempts. The next retry delay should
// start at 1s for retry #1, then 2s, 4s, ...
const exponent = Math.max(0, boundedRetryCount - 1);
const baseDelay = MIN_ANNOUNCE_RETRY_DELAY_MS * 2 ** exponent;
return Math.min(baseDelay, MAX_ANNOUNCE_RETRY_DELAY_MS);
}