You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Project plan, task, PR, indexing, stalled, and system transitions into notifications #1719
A durable Inbox is useful only if lifecycle transitions are converted into notification events consistently. ProPR already publishes task, draft, and indexing updates for Socket.IO; those centralized publication paths are the safest integration points and avoid scattering notification logic through individual UI routes.
Requirements
Project DRAFT_UPDATE, TASK_UPDATE, and INDEXING_UPDATE payloads into durable notification events.
Generate plan-ready, task-failed, implementation-completed, review-completed, PR-attention, and indexing-failed events.
Maintain notification_activity whenever task or indexing state changes.
Add a periodic stalled-task detector with a configurable threshold.
Project unhealthy system snapshots into deduplicated system-failure events.
Notification projection must be best-effort and must never fail the underlying task or socket publication.
Use stable deduplication keys based on entity, state, and transition timestamp.
Avoid putting raw prompts, logs, secrets, or stack traces into notification bodies.
Acceptance Criteria
A plan entering review creates exactly one plan-ready event.
A completed review and completed implementation use different notification kinds.
A completed task with a PR creates a separate PR-attention event containing the PR URL.
Repeated publication of the same payload does not duplicate events.
Active work older than NOTIFICATION_STALLED_AFTER_MS creates one stalled notification for that unchanged transition.
Returning to a healthy system and failing again can create a new system-failure event.
Projection failures are logged and do not reject the original event publisher call.
Use the existing cross-process event publication boundary as the primary projector input. This was chosen over modifying every worker job because the centralized events already describe the state seen by the UI and naturally cover retries. A database activity checkpoint supports stalled detection without relying on long-lived timers for individual tasks. Notification projection remains asynchronous and isolated so an unavailable notification table cannot break core execution.
File: packages/core/src/services/notificationProjector.ts (new file)
Why this file: It translates shared lifecycle payloads into notification-domain records in one testable location.
Why this file: This is the centralized lifecycle publication point. Projection is deliberately fire-and-report so notifications cannot block socket delivery or worker progress.
--- a/packages/core/src/utils/eventPublisher.ts+++ b/packages/core/src/utils/eventPublisher.ts@@ -1,5 +1,6 @@+import { projectPublishedEvent } from '../services/notificationProjector.js';@@ -80,6 +81,13 @@
await this.redis.publish(channel, serializedPayload);
++ // Notification persistence is a secondary projection of an already accepted+ // lifecycle transition. Log failures, but never turn a successful task update+ // into a task failure because the optional Inbox projection is unavailable.+ void projectPublishedEvent(channel, payload).catch(error => {+ logger.warn({ error: (error as Error).message, channel }, 'Notification projection failed');+ });
File: packages/core/src/services/notificationMonitor.ts (new file)
Why this file: Stalled work is an absence of transitions, so it cannot be detected by an individual transition mapper. A bounded periodic query is more reliable than one timer per task.
import{db}from'../db/connection.js';importloggerfrom'../utils/logger.js';import{createNotificationEvent}from'./notificationService.js';constdefaultStalledAfterMs=45*60*1000;exportasyncfunctiondetectStalledNotifications(now=newDate()): Promise<number>{constconfigured=Number(process.env.NOTIFICATION_STALLED_AFTER_MS??defaultStalledAfterMs);conststalledAfterMs=Number.isFinite(configured)&&configured>0 ? configured : defaultStalledAfterMs;constcutoff=newDate(now.getTime()-stalledAfterMs).toISOString();constrows=awaitdb('notification_activity').where({entity_type: 'task',terminal: false}).whereIn('state',['queued','processing','claude_execution','post_processing']).andWhere('last_transition_at','<=',cutoff);for(constrowofrows){awaitcreateNotificationEvent({kind: 'task_stalled',category: 'tasks',title: 'Task may be stalled',body: `Task ${row.entity_id} has remained in ${row.state} without progress.`,targetType: 'task',targetId: row.entity_id,projectSlug: row.project_slug,deepLink: row.deep_link,actions: ['stop','follow_up','dismiss'],// A new transition changes this key and permits a future legitimate alert.dedupeKey: `task:${row.entity_id}:stalled:${row.last_transition_at}`,occurredAt: now.toISOString(),});}returnrows.length;}exportfunctionstartNotificationMonitor(): ()=>void{construn=()=>voiddetectStalledNotifications().catch(error=>{logger.warn({error: (errorasError).message},'Stalled notification scan failed');});run();consttimer=setInterval(run,60_000);timer.unref();return()=>clearInterval(timer);}
File: packages/api/server.ts
Why this file: The API is already a continuously running authenticated control-plane process. Starting one inexpensive monitor here avoids adding a new container for the focused PWA release.
--- a/packages/api/server.ts+++ b/packages/api/server.ts@@ -1,5 +1,6 @@+import { startNotificationMonitor } from '@propr/core';@@ -220,6 +221,10 @@+// The scan is database-backed and idempotent, so an API restart does not lose+// stall detection state or duplicate alerts.+const stopNotificationMonitor = startNotificationMonitor();@@ -260,6 +265,7 @@+ stopNotificationMonitor();
Reimplementation guidance after retiring oversized PR #1734:
Start clean from the branch selected by base-1716-epic-failed-to-3m8 and implement this issue narrowly. Reuse the notification schema, persistence service, preferences, subscription APIs, and existing lifecycle/event boundaries delivered by #1716-#1718.
Scope constraints:
Project the requested plan, task, PR-attention, indexing, stalled, and system transitions into durable notifications.
Add small adapters at existing publication/health boundaries; keep notification projection best-effort and idempotent.
Do not redesign authentication/session handling, Docker execution, worker-state persistence, indexing cancellation/state machines, BullMQ retention, or general queue infrastructure.
Do not modify already-applied migrations; add a forward migration only if this issue truly needs new state beyond the epic schema.
Preserve current authorization boundaries and never expose raw prompts, logs, errors, tokens, or arbitrary external URLs in notification payloads.
Keep the diff reviewable and directly attributable to #1719. If an existing subsystem cannot support a requested transition without a broad redesign, document the narrow limitation instead of absorbing that redesign into this PR. Run /ultrafix goal=8 max=10 on the resulting PR.
Activity
propr-dev commentedon Aug 2, 2026
Suggested Implementation:
Implementation Approach
Use the existing cross-process event publication boundary as the primary projector input. This was chosen over modifying every worker job because the centralized events already describe the state seen by the UI and naturally cover retries. A database activity checkpoint supports stalled detection without relying on long-lived timers for individual tasks. Notification projection remains asynchronous and isolated so an unavailable notification table cannot break core execution.
File:
packages/core/src/services/notificationProjector.ts(new file)Why this file: It translates shared lifecycle payloads into notification-domain records in one testable location.
File:
packages/core/src/utils/eventPublisher.tsWhy this file: This is the centralized lifecycle publication point. Projection is deliberately fire-and-report so notifications cannot block socket delivery or worker progress.
File:
packages/core/src/services/notificationMonitor.ts(new file)Why this file: Stalled work is an absence of transitions, so it cannot be detected by an individual transition mapper. A bounded periodic query is more reliable than one timer per task.
File:
packages/api/server.tsWhy this file: The API is already a continuously running authenticated control-plane process. Starting one inexpensive monitor here avoids adding a new container for the focused PWA release.
propr-dev commentedon Aug 2, 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-sol1719/gpt-5.6-sol-project-plan-task-pr-inde-20260802-1619-o9q1716-epic-failed-to-3m8issue-1719-20260802-1619-gpt-5.6-sol-o9q🔍 Track Task Execution
fix(ai): Resolve issue #1719 - Project plan, task, PR, indexing, stal…
integry commentedon Aug 24, 2026
Reimplementation guidance after retiring oversized PR #1734:
Start clean from the branch selected by
base-1716-epic-failed-to-3m8and implement this issue narrowly. Reuse the notification schema, persistence service, preferences, subscription APIs, and existing lifecycle/event boundaries delivered by #1716-#1718.Scope constraints:
Keep the diff reviewable and directly attributable to #1719. If an existing subsystem cannot support a requested transition without a broad redesign, document the narrow limitation instead of absorbing that redesign into this PR. Run
/ultrafix goal=8 max=10on the resulting PR.propr-dev commentedon Aug 24, 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-sol1719/gpt-5.6-sol-project-plan-task-pr-inde-20260824-0029-qxz1716-epic-failed-to-3m8issue-1719-20260824-0029-gpt-5.6-sol-qxz🔍 Track Task Execution
fix(ai): Resolve issue #1719 - Project plan, task, PR, indexing, stal…
fix(ai): Resolve issue #1719 - Project plan, task, PR, indexing, stal…
[Epic] PWA & Web push (#1731)