Skip to content

[codex] Preserve APNs delivery failure context#3475

Merged
juliusmarminge merged 3 commits into
mainfrom
codex/structure-apns-delivery-failures
Jun 21, 2026
Merged

[codex] Preserve APNs delivery failure context#3475
juliusmarminge merged 3 commits into
mainfrom
codex/structure-apns-delivery-failures

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 21, 2026

Copy link
Copy Markdown
Member

Summary

  • retain APNs client failures as structured delivery errors with device, delivery kind, job, and request-stage context
  • log exact cause chains behind a redacted annotation while exposing only safe queryable fields
  • preserve existing status-0 results, retry/claim behavior, and delivery-attempt persistence

Verification

  • vp test infra/relay/src/agentActivity/ApnsDeliveries.test.ts (21 tests)
  • vp check
  • vp run typecheck

Note

Low Risk
Scoped to known Apns error tags with unchanged delivery outcomes and attempt persistence; only observability and error shape change on the relay push path.

Overview
APNs transport failures (JWT encoding/signing and HTTP request errors) are now wrapped in ApnsDeliveryTransportError with device, delivery kind, job id, APNs error tag, and HTTP stage, while the original client error stays on cause.

recoverApnsDeliveryTransportError logs via Effect.logError with structured fields and a redacted error annotation holding the full object; callers still get the same ok: false, status-0 delivery result and existing claim/retry/attempt recording paths.

Live Activity and push notification sends switch from a broad Effect.catch to Effect.catchTags for the three Apns error types. Tests assert the redacted log payload for a JWT signing failure during signed job processing.

Reviewed by Cursor Bugbot for commit 17a510a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Preserve APNs delivery failure context with structured ApnsDeliveryTransportError logging

  • Introduces ApnsDeliveryTransportError, a schema-tagged error class in ApnsDeliveries.ts that captures deviceId, kind, sourceJobId, apnsErrorTag, requestStage, and cause for APNs transport/auth failures.
  • Adds recoverApnsDeliveryTransportError, a helper that logs the error with structured, redacted annotations and maps it to a standardized ApnsDeliveryResult with ok=false.
  • Replaces broad Effect.catch handlers in sendLiveActivity and sendPushNotification with Effect.catchTags scoped to ApnsJwtEncodingError, ApnsJwtSigningError, and ApnsHttpRequestError.
  • Risk: other unexpected errors in the APNs send path now propagate instead of being coerced into a delivery failure result.

Macroscope summarized 17a510a.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b7ea9129-b04f-4fa0-89de-3862cb80ecb7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/structure-apns-delivery-failures

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 21, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 21, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds structured error logging for APNs delivery failures without changing the actual failure handling behavior. The errors are still caught and converted to the same failure result - only the logging context is enriched for better observability.

You can customize Macroscope's approvability policy. Learn more.

Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 21, 2026 03:06

Dismissing prior approval to re-evaluate 80348b8

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jun 21, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Jun 21, 2026
@juliusmarminge
juliusmarminge merged commit e3970e7 into main Jun 21, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/structure-apns-delivery-failures branch June 21, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant