{
  "commit_message": "Retry settlement fetches on transient upstream errors",
  "diff": "+def fetch_settlement(batch_id: str, *, attempts: int = 3) -> Settlement:\n+    # Upstream returns 503 during their nightly window; a short retry\n+    # avoids failing the whole batch for a blip we know is transient.\n+    for attempt in range(attempts):\n+        try:\n+            return _client.get_settlement(batch_id)\n+        except UpstreamUnavailable as exc:\n+            if attempt == attempts - 1:\n+                raise SettlementFetchFailed(batch_id, attempts) from exc\n+            time.sleep(2**attempt)\n\n+def test_fetch_settlement_retries_then_raises(monkeypatch):\n+    ...\n+def test_fetch_settlement_returns_on_second_attempt(monkeypatch):\n+    ...\n"
}
