Repository navigation
Description
Context
The Inbox is currently accumulating repeated notifications for the same actionable state. Examples include multiple Pull request needs attention cards for the same PR and repeated claudeAuth is not reporting a healthy status cards. It also leaves stale cards visible after the underlying condition is no longer actionable, such as PR-related Inbox items after the PR has been merged.
This happens because notification events are immutable audit records, but the Inbox view needs a lifecycle on top of those records. The current projection creates new events for repeated PR attention and stores system-health failure state only in API process memory, so restarts or multiple API instances can create duplicate system failure cards.
Requirements
- Automatically dismiss PR-related Inbox notifications when a PR is merged.
- Keep only one active
pull_requestattention card per repository and PR, while still allowing newer work to replace an older card. - Deduplicate system failure notifications across repeated
/api/statussnapshots, process restarts, and multiple API instances. - Automatically dismiss system failure cards once the component reports healthy again.
- Preserve notification audit rows; only update per-recipient Inbox state through
notification_user_states.dismissed_at. - Add regression tests for PR notification closure, PR attention replacement, and cross-instance system failure deduplication.
Implementation Specification
Modify the backend notification lifecycle, not just frontend rendering. Add service-level helpers in NotificationService to dismiss matching notification receipts, persist system failure projection state in a new migration, update NotificationProjectionService to use the persistent state table, and close PR-related notifications from the PR webhook tracking path.
Acceptance Criteria
- A merged PR no longer appears in Inbox
Needs attentionor completed PR-related cards after the merge webhook is processed. - Repeated task completions for the same PR leave only one active
Pull request needs attentionInbox card. - Repeated unhealthy
claudeAuthstatus snapshots create one active system failure card, even across twoNotificationProjectionServiceinstances. - A recovered system component dismisses its previous system failure card.
- Existing read/dismiss behavior remains idempotent per user.
- The notification and projection test suites pass.
Created by ProPR AI Planner
Activity
propr-dev commentedon Aug 29, 2026
Suggested Implementation:
Implementation Approach
This implementation adds lifecycle reconciliation at the notification persistence/projection layer because stale and duplicate Inbox cards are backend state problems, not only presentation problems. Frontend-only filtering was rejected because it would leave unread counts, push delivery, and other clients inconsistent. Changing notification event immutability was also rejected because event rows are audit records; the correct mutable state is the per-recipient
notification_user_statesrow.The key trade-off is that automatic closure is modeled as a system dismissal. This keeps the schema simple, preserves historical events, and makes the existing list API hide irrelevant notifications without introducing a new user-visible
resolved_atconcept.File:
packages/core/src/db/migrations/20260829000000_add_notification_projection_state.js(new file)Why this file: System health deduplication cannot rely on in-memory maps because
/api/statuscan be served by multiple API processes or after a restart. This migration gives projections a small durable state table that records the currently open system failure period.File:
packages/core/src/services/notificationService.tsWhy this file:
NotificationServiceowns Inbox state transitions. Adding reusable dismissal helpers here keeps automatic closure consistent with manual dismissal and avoids duplicating JSON-target parsing in projection or webhook code.File:
packages/api/services/notificationProjectionService.tsWhy this file: This service creates the duplicated PR attention and system failure cards. It must create replacement PR attention events safely and use durable projection state for system failures.
File:
packages/core/src/webhook/planIssueTracking.tsWhy this file: PR merge relevance is known in the webhook tracking path for every intake mode. Closing PR notifications here makes the behavior work for routing websocket, polling, and direct webhook deployments.
File:
packages/api/test/notificationProjectionService.test.tsWhy this file: The projection service is where duplicate PR attention and duplicate system health notifications are created. These tests protect the new lifecycle behavior directly.
File:
packages/core/test/notificationService.test.tsWhy this file: The service-level auto-dismiss helpers are shared by PR merge handling and projection replacement. Unit coverage here verifies the mutable receipt behavior independent of projection logic.
Verification
Run these focused checks after implementation:
propr-dev commentedon Aug 29, 2026
🤖 AI processing has started for this issue using codex agent with gpt-5.6-sol model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
codexgpt-5.6-sol1984/gpt-5.6-sol-deduplicate-inbox-notific-20260829-2104-y8tmainissue-1984-20260829-2104-gpt-5.6-sol-y8t🔍 Track Task Execution
fix(ai): Resolve issue #1984 - Deduplicate Inbox notifications and au…