Skip to content

[codex] Structure relay Live Activity errors - #3314

Merged
juliusmarminge merged 3 commits into
mainfrom
codex/relay-live-activity-errors
Jun 20, 2026
Merged

[codex] Structure relay Live Activity errors#3314
juliusmarminge merged 3 commits into
mainfrom
codex/relay-live-activity-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • attach user/device correlation fields to Live Activity registration and target-list persistence failures
  • add a structured operation and delivery kind to the shared Live Activity state persistence error
  • preserve the original database or schema cause at every persistence boundary
  • construct errors directly at each boundary and derive messages from their structured context
  • add focused coverage for every service operation failure mapping

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/LiveActivities.test.ts --no-cache (3 tests)

Overlap audit

  • no overlap with another active error-audit/service-refactor PR
  • these paths also appear in broad draft feat(relay): enforce resource limits #2925 (feat(relay): enforce resource limits); that unrelated overlap is reported here for visibility

Note

Low Risk
Observability and error-shape changes only; persistence behavior is unchanged and covered by new failure-mapping tests.

Overview
Relay Live Activity persistence failures now carry structured correlation data instead of only a wrapped cause.

The three tagged errors gain fields such as userId, deviceId, operation, and optional kind, with human-readable message strings derived from that context. Each service method (register, listTargets, markDelivery, markStartQueued, clearStartQueued, invalidateDeliveryToken) maps DB failures at the boundary via Effect.mapError, including wrapping invalidateDeliveryToken in an inner Effect.gen so all branches share the same error shape.

A new test drives a failing fake RelayDb through every operation and asserts userId, deviceId, operation/kind, cause, and messages.

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

Note

Add correlation context fields to Live Activity persistence errors in relay

Enriches the three persistence error classes in LiveActivities.ts with structured context fields so failures are easier to trace.

  • LiveActivityRegistrationPersistenceError now includes userId and deviceId; LiveActivityTargetListPersistenceError includes userId; LiveActivityDeliveryMarkPersistenceError includes operation, userId, deviceId, and kind.
  • Each error's message getter is updated to embed the relevant identifiers and operation name.
  • All LiveActivities service handlers (register, listTargets, markDelivery, markStartQueued, clearStartQueued, invalidateDeliveryToken) now map DB failures to the appropriate enriched error type.
  • Tests in LiveActivities.test.ts verify that simulated DB failures produce errors with the expected correlation fields and messages.

Macroscope summarized cdef70f.

@coderabbitai

coderabbitai Bot commented Jun 20, 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: 1027e367-6370-4e47-a54a-3eac0389f9f4

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/relay-live-activity-errors

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 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds contextual fields (userId, deviceId, operation) to Live Activity error classes for better debugging. No runtime behavior changes - only error message content is enhanced, with corresponding tests added.

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

@juliusmarminge
juliusmarminge force-pushed the codex/relay-live-activity-errors branch from 3e13a7e to 90f0210 Compare June 20, 2026 12:02
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge
juliusmarminge force-pushed the codex/relay-live-activity-errors branch from 90f0210 to e4885fa Compare June 20, 2026 12:13
juliusmarminge and others added 2 commits June 20, 2026 05:19
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 12:21

Dismissing prior approval to re-evaluate cdef70f

@juliusmarminge
juliusmarminge merged commit e06c33c into main Jun 20, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/relay-live-activity-errors branch June 20, 2026 19:05
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