Fix notification burst delivery and add context metadata#124
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 1 hour, 42 minutes, and 52 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR enriches the notification and alert system with project/worktree/category/reason metadata and a new ChangesEnriched notification metadata, interaction_request alerts, and realtime delivery
Sequence Diagram(s)sequenceDiagram
participant Agent as Agent / CLI
participant publishAlert as publishAlert
participant upsertNotification as upsertNotification
participant notifyAlert as notifyAlert
participant MobilePush as forwardAlertToMobilePush
participant Heartbeat as startHeartbeat (app)
participant Layout as _layout useEffect
participant evaluateAlertEvent as evaluateAlertEvent
participant Browser as Browser Notification API
Agent->>publishAlert: AlertPublishInput + interaction + labels
publishAlert->>upsertNotification: enriched metadata (projectName/worktree/category/interaction)
upsertNotification-->>publishAlert: notification.id
publishAlert->>notifyAlert: AlertEvent (notificationId + labels + interaction)
notifyAlert->>MobilePush: payload with notificationId + labels
publishAlert-->>Heartbeat: SSE alert event emitted
Heartbeat-->>Layout: alert event received
Layout->>evaluateAlertEvent: event + notificationSettings
evaluateAlertEvent-->>Layout: ClientNotificationEvent | null
Layout->>Browser: showNotification (if enabled + visible)
Layout->>upsertNotification: kickNotificationFeedRefresh
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/app/`(main)/_layout.tsx:
- Around line 311-317: The onError callback in the heartbeat setup (at line 311)
currently only logs the error without attempting to recover. When the heartbeat
encounters permanent failures like 401 (token expiry), it stops retrying and
notifications remain disconnected until dependencies change. Modify the onError
handler to not only log the error but also trigger a reconnection attempt of the
heartbeat. This ensures that when permanent SSE failures occur (such as token
expiry), the system actively re-establishes the connection rather than passively
waiting for external triggers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d219dc15-1b50-4eec-9cba-c9aee19c3efa
📒 Files selected for processing (21)
app/app/(main)/_layout.tsxapp/lib/api.tsapp/lib/events.tsapp/lib/for-you-feed.test.tsapp/lib/for-you-feed.tsapp/lib/notification-policy.test.tsapp/lib/notification-policy.tssrc/alert-display.test.tssrc/alert-display.tssrc/main.tssrc/metadata-server.interaction.test.tssrc/metadata-server.test.tssrc/mobile-push-bridge.tssrc/multiplexer/runtime-state.test.tssrc/multiplexer/runtime-state.tssrc/notifications.test.tssrc/notifications.tssrc/notify.test.tssrc/notify.tssrc/project-events.tssrc/relay-client.ts
Summary
Verification
Summary by CodeRabbit
Release Notes