fix(notify,esg): classify dropped SMTP connections, OAuth2 token-endpoint outages and body-read connection loss as transient (NTF-2, ESG-1, WP4 task 4.6)

This commit is contained in:
Joseph Doherty
2026-12-03 09:58:10 -05:00
parent 5f7b850af2
commit 11992075e8
8 changed files with 210 additions and 14 deletions
@@ -107,6 +107,7 @@ Scripts choose between two call modes per invocation, mirroring the dual-mode da
- Each external system definition specifies a **timeout** (`TimeoutSeconds`) that applies to all method calls on that system. `0` means unset — the gateway's configured `DefaultHttpTimeout` applies instead. Editable via the Central UI External System form ("Timeout (seconds)", helper text "0 = use gateway default") and deployed to sites in the artifact alongside the rest of the definition.
- Error classification by HTTP response:
- **Transient failures** (connection refused, timeout, HTTP 408, 429, 5xx): Behavior depends on call mode — `CachedCall` buffers for retry; `Call` returns error to script.
- **A connection lost while reading the response body** (headers received, then a reset or truncation — `IOException`/`HttpIOException`/`HttpRequestException` from the body read) is **transient** when the status was a success or a transient code, exactly like a timeout at the same point (ESG-1, 2026-12; before, the raw `IOException` escaped into the script and `CachedCall` buffered nothing). With a permanent status the call stays permanent — losing the error body does not make it retryable.
- **Permanent failures** (HTTP 4xx except 408/429): Always returned to the calling script regardless of call mode. Logged to Site Event Logging. For `CachedCall`, the failure is additionally recorded as a terminal `Failed` tracking record — so even a never-buffered cached call has an authoritative status record.
- This classification ensures the S&F buffer is not polluted with requests that will never succeed.
- **Idempotency note**: `CachedCall` retries may result in duplicate delivery if the external system received the original request but the response was lost. Callers should use `CachedCall` only for operations that are idempotent or where duplicate delivery is acceptable.