feat(agents): add desktop notifications via VAPID web push#22454
feat(agents): add desktop notifications via VAPID web push#22454
Conversation
Wire the existing webpush.Dispatcher into the chatd Server so that when an agent chat finishes processing (status transitions to waiting or error), a web push notification is dispatched to the chat owner. Sub-agent chats are skipped to avoid notification spam from internal delegation. On the frontend, add a WebPushButton bell icon to the Agents page top bar (both the empty state and agent detail views) so users can subscribe/unsubscribe to push notifications directly from /agents, which has its own layout and doesn't use the standard Navbar.
|
I have read the CLA Document and I hereby sign the CLA Coder seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
Documentation CheckUpdates Needed
Automated review via Coder Tasks |
…ribe - Check PublicKey() != "" before dispatching so NoopWebpusher (used when web-push experiment is off) doesn't cause noisy warning logs on every chat completion. - Fix pre-existing bug in useWebpushNotifications: unsubscribe() now calls API.deleteWebPushSubscription before browser-side unsubscribe so the server removes the stale endpoint.
Summary
Wire VAPID web push notifications into the Agents (chat) system so users get desktop notifications when an agent finishes running.
Backend
webpush.Dispatchertochatd.Serverand pass it through fromcoderd.Options.WebPushDispatcherprocessChat()'s deferred cleanup, dispatch a web push notification when the chat reaches a terminal state:waiting(success): "Agent has finished running."error(failure): the error message, or "Agent encountered an error."ParentChatID.Valid) are skipped to avoid notification spam from internal delegationFrontend
WebPushButtoncomponent — a bell icon that uses the existinguseWebpushNotificationshooknullwhen theweb-pushexperiment is offEnd-to-end flow
/agents→ browser subscribes via VAPIDrunningstatusprocessChatdefer sets status towaiting/error→ dispatches web push