@@ -26,15 +26,17 @@ const logger = createLogger('PiiMaskClient')
2626const CHUNK_CONCURRENCY = env . PII_MASK_CHUNK_CONCURRENCY ?? 64
2727
2828/**
29- * Attempts per chunk for transient failures (network errors, 408/429/5xx), the
30- * standard retry budget of the AWS and model-provider SDKs. A large payload fans
31- * out into many chunk requests, so one blip (a dropped connection, a Presidio
32- * worker restart) must not fail the whole redaction, but every retry re-runs the
33- * chunk's full NER pass: a chunk that timed out or failed on its own input fails
34- * the same way again, so more attempts only multiply the work and delay the
35- * fail-safe. With the default jittered backoff this covers about 1.5s of failures;
36- * a longer outage falls to the caller's fail-safe. Deterministic failures (4xx,
37- * shape mismatches) throw immediately.
29+ * Attempts per chunk for transient failures (network errors, timeouts, 408/429/5xx),
30+ * the 3-attempt default of the AWS SDK standard retry mode and the OpenAI and
31+ * Anthropic SDKs. A large payload fans out into many chunk requests, so one blip (a
32+ * dropped connection, a Presidio worker restart, a request queued behind a busy
33+ * fleet) must not fail the whole redaction. The budget stays small because every
34+ * retry re-runs the chunk's full NER pass, so a chunk that fails on its own input (a
35+ * 500 from a recognizer) only repeats that work before reaching the fail-safe.
36+ * Without a `Retry-After`, the jittered backoff spans about 1.5s; an outage
37+ * (502/503/504) that outlasts it falls to the caller's fail-safe, which with
38+ * {@link MaskPIIBatchOptions.failedChunkPlaceholder} also scrubs chunks not yet sent.
39+ * Other 4xx and shape mismatches throw immediately.
3840 */
3941const MAX_CHUNK_ATTEMPTS = 3
4042
0 commit comments