-
Notifications
You must be signed in to change notification settings - Fork 5
Add SSE-based notification center for background job events (#1496) - #2057
Draft
manzke wants to merge 1 commit into
Draft
Add SSE-based notification center for background job events (#1496) #2057manzke wants to merge 1 commit into
manzke wants to merge 1 commit into
Conversation
Adds a preview-gated per-user notification bell: background jobs (Tools
Service, e.g. AI OCR) now persist and push a notification on completion,
error, or cancellation, so users don't lose the result just because they
navigated away from the tab that started the job.
- server/services/notifications/{NotificationService,NotificationStore}.js:
in-process event bus + per-user JSON-file persistence (v1 scope — not
the PostgreSQL-backed store from #1490/#1499, which don't exist yet).
- server/routes/notifications.js: SSE stream (multi-tab per user) + list/
mark-read REST endpoints, gated behind a new 'notifications' feature
flag (default off).
- jobStore.js now emits a notification on terminal job states only
(not per-progress-tick, to avoid flooding the notification list).
- client/src/features/notifications/: useNotifications hook + bell/panel
UI, wired into the header for authenticated users when the flag is on.
Deliberately out of scope for this slice (see docs/notifications-feature.md):
durable multi-instance storage, chat-share/system-announcement producers,
and toast/desktop notifications.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A8KD83dJU7XCZx1GUDD1kk
@github-actions
github-actions
Bot
added
documentation
Improvements or additions to documentation
backend
api
frontend
testing
ui
labels
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1496 (v1 slice — see scope notes below).
Adds a preview-gated, per-user real-time notification center. Today, background jobs (Tools Service, e.g. AI OCR) only report progress to a client with an open
/jobs/:jobId/progressSSE connection — closing the tab or navigating away silently loses the completion event. This adds a small, durable record of terminal job events that survives across page loads and multiple open tabs.server/services/notifications/NotificationService.js— in-process event bus (notify(userId, type, data)); persists then broadcasts to any live SSE listeners.server/services/notifications/NotificationStore.js— per-user JSON-file persistence (contents/data/notifications/<userId>.json, capped at 200 entries/user).server/routes/notifications.js—GET /api/notifications/stream(SSE, multi-tab per user),GET /api/notifications(list),POST /:id/read,POST /read-all. Gated behind a newnotificationsfeature flag (default off) + migrationV078.server/routes/toolsService/jobStore.js—notifyClients()now also emits a notification on terminal job states only (completed/error/cancelled) — intermediate progress ticks are intentionally not persisted (too frequent, e.g. one per OCR page, to be a useful notification-list entry).client/src/features/notifications/—useNotificationshook (REST initial load + SSE live updates, same fetch+ReadableStream pattern asuseEventSource.jsfor custom auth headers) andNotificationBell/NotificationPanelUI, mounted inLayout.jsx's header for authenticated users when the flag is enabled.Deliberately out of scope for this slice (per the issue's own implementation-plan comment)
NotificationService.notify()call sites, so swapping to a real DB later doesn't require touching producers.chat.shared(no such feature exists yet) andsystem.announcement(no admin broadcast UI) have no producer in this PR.NotificationWeb API integration.Full write-up:
docs/notifications-feature.md.Test plan
npm run lint:fix && npm run format:fix— clean on all changed filesserver/tests/NotificationStore.test.js(append/list/scope-per-user/mark-read/mark-all-read/path-traversal-rejection/200-item cap) — all passserver/routes/notifications.js,server/routes/toolsService/jobStore.js, andserver/featureRegistry.jsimport cleanly with no errors🤖 Generated with Claude Code
https://claude.ai/code/session_01A8KD83dJU7XCZx1GUDD1kk
Generated by Claude Code