Repository navigation
fix(reporting): report unsettled notification retries and abandonment as typed errors - #3774
Conversation
… as typed errors A claim whose recipient is still outstanding threw a plain Error that hosts could not tell apart from a storage failure, so every expected retry was logged at error level. Raise ReportingNotificationUnsettledError with transitionId, unsettled, attempt, maxAttempts and the outstanding recipients (identifiers, reason, final HTTP status; never URLs or credentials), and report ReportingNotificationAbandonedError when a claim reaches maxAttempts and is abandoned. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — additive error-typing on the experimental @adcp/reporting-storage notification recovery path with no blocking findings.
What I checked:
- New
ReportingNotificationUnsettledError/ReportingNotificationAbandonedErrorare carried ononErroronly; retry/lease/abandon semantics and durable state are unchanged (notification-activity.ts:1203-1222 throw path, classifyDelivery:2063-2070). - Witness hygiene is correct: recipient payloads carry scope/subscriberId/destinationGeneration + reason + optional
final_status(a real emitter field, webhook-emitter.ts:492), never the URL or credentials. Three new pg tests assert non-leakage. - Changeset present (
.changeset/reporting-notification-unsettled-error.md);patchtype is consistent with this package's experimental semver posture and the additive, non-breaking change. - No wire-shape fabrication, no re-shaping at a seam, no minor-release pathway obligation (error typing, not a wire-field change).
Non-blocking observation (advisory only): the delivery_runtime_error reason at the delivery.failure !== undefined || !delivery.result branch is documented as "emitter threw," which strictly holds only for the !delivery.result sub-case; a non-terminal structured failure block would also be labeled that way. No correctness impact.
No critical/high/medium findings. gated_paths is false; review_decision is REVIEW_REQUIRED but the gate only applies when gated_paths is true. No team gate, no high-risk flag. Falls through to row 9.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — test-only delta since prior clean approve, no blocking or medium findings.
What I checked:
- Delta since the prior
approveis confined to one test file (packages/reporting-storage/test/reporting-notification-activity-pg.test.js): a comment clarified to "fetch override by URL" and thefetchHook(url, body)call dropped its unusedbodyarg to match the single-argrequestUrl => ...hooks for the new unsettled/abandonment tests. Test-only, no production or wire surface touched. - No no-auto-approve team match;
gated_paths: false;high_risk: false. review_decisionisREVIEW_REQUIRED, but no gate (path-based or prose) applies, so this does not force escalate.- No critical/high/medium findings in this run; prior pass was clean.
Decision table: rows 1–8 do not fire (no findings, no gates, no team match) → row 9 approve.
Problem
The production training agent posts a "System error" to Slack about every 6 minutes:
This is an expected retry. One
reporting.*webhook subscriber is not accepting deliveries. A claim whose emission returns with a recipient still outstanding (a 5xx, a 429, a transport error, a timeout or an emitter failure) is released and retried.recoverOnce({ onError })received a plainError, so hosts could not tell this retry from a storage failure, and they logged every retry at error level. (The 6-minute cadence comes from the host's 5-minute Slack throttle. The retry itself runs about every 30-45 s:retryAfterMsdefaults to 30 s and the scheduler interval is 15 s.)The production service also calls its scheduler
onError(error)without the claim, so the host had no way to find which subscriber was failing.Change
ReportingNotificationUnsettledError(exported from@adcp/reporting-storage/notifications) replaces the plainError.transitionId,unsettled,attempt,maxAttemptsand up to tenrecipients.subscriberId,destinationGeneration, areason(delivery_failed/delivery_runtime_error/retryable_suppression) andfinalStatuswhen the last attempt got an HTTP response. The URL and any credential are never included.attempt N of M, not retrying.ReportingNotificationRetryableSuppressionError.ReportingNotificationAbandonedErroris reported to the sameonErrorafter a claim reachesmaxAttemptsand the abandonment succeeds. Itscauseis the final attempt's error.docs/guides/REPORTING-LEDGER.mdnow logs the unsettled error atwarn. That section now documents both errors.onErrorget one extra call per abandoned claim. Patch changeset for@adcp/reporting-storage, which is@experimentaland pre-1.0.Are retries bounded?
Yes, per activity:
maxAttempts(default 100).deliveryRetryHorizonSeconds), which settles the recipient as terminal.They are not bounded across activities. A subscriber that stays dead is addressed again by every new activity on that account, and each activity runs its own bounded cycle. A subscription-level circuit breaker (deactivate after N consecutive failures) would touch protocol-visible subscription state, so this PR does not add one. It is proposed as a follow-up.
Tests
packages/reporting-storage/test/reporting-notification-activity-pg.test.js(57/57 locally against PostgreSQL 16):finalStatus: 503, and no URL.maxAttempts: 3reports attempts 1 and 2 as retrying. Attempt 3 saysattempt 3 of 3, not retryingand is followed by exactly one abandoned error whosecauseis that same object. A further pass is silent.delivery_failedwith nofinalStatus.causeis not an unsettled error.Not covered by a test:
delivery_runtime_error, which needs the emitter itself to throw and cannot be reached without stubbing runtime internals. A cap test with more than 10 recipients was skipped because the setup is heavy.The host-side change (warn instead of error, with subscriber identifiers) is in adcontextprotocol/adcp, on branch
fix/training-reporting-retry-noise.🤖 Generated with Claude Code