[codex] Structure relay delivery attempt errors#3312
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This change enriches error objects with additional context fields (operation, IDs, kind) for debugging purposes. The error handling flow remains unchanged - errors are thrown in the same situations with the same effects, just with more diagnostic information attached. You can customize Macroscope's approvability policy. Learn more. |
Summary
Validation
vp check(passes with 20 pre-existing warnings)vp run typecheck/Users/julius/.codex/worktrees/d5fa/codething-mvp/node_modules/.bin/vp test infra/relay/src/agentActivity/DeliveryAttempts.test.ts --no-cache(7 tests)Overlap audit
feat(relay): enforce resource limits); that unrelated overlap is reported here for visibilityNote
Low Risk
Observability-only error shaping on audit persistence; no change to claim/record/completion behavior or public method signatures beyond richer error payloads.
Overview
DeliveryAttemptRecordPersistenceErrornow carries which operation failed (record,claim-source-job,complete-source-job) plus correlation fields (sourceJobId, user/env/thread/device,kind) while still wrapping the underlying DB/cryptocause. Messages are derived from the operation (e.g. during claim-source-job).Persistence mapping is applied per boundary in
DeliveryAttemptsinstead of a single genericmapError, so success paths and tracing are unchanged but failures are easier to log and debug. A new test asserts all three operations preserve context and the original cause.Reviewed by Cursor Bugbot for commit a83db42. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure
DeliveryAttemptRecordPersistenceErrorwith operation context and input identifiersoperation(one ofrecord,claim-source-job,complete-source-job), contextual IDs (sourceJobId,userId,environmentId,threadId,deviceId,kind), andcausefields toDeliveryAttemptRecordPersistenceErrorin DeliveryAttempts.ts.Effect.mapErrorscoped only to the persistence block, so span annotation failures before the db call are no longer wrapped inDeliveryAttemptRecordPersistenceError.'Failed to persist APNs delivery attempt during ${operation}.'for easier triage.RelayDbthat forces insert/update failures.Macroscope summarized a83db42.