PR 319: Implement notifications

rancher/rancher-ai-ui, torchiaf, head 69677ca, reviewed 2026-11-16. Backend for all previews: mf-rancher-16 (Rancher 2.16 head, agent v1.2.0-alpha.5). Two passes: Cody's process (A) and ours (B, fresh agent).

Verdict: request changes. The feature works as designed once its two shell dependencies land. As it stands, though, the dot can't show on any Rancher the extension supports and CI is red because of it. Desktop notifications also have an inconsistent default and a permission request that Firefox and Safari block. The notification text and the 5-second close undercut the point of the feature.

What I'd post

I tried it on Rancher 2.16 as-is and with rancher/dashboard#19693 and @rancher/icons 2.0.67 patched in. With those, the dot, the desktop notification and click-to-open work as described; the points below are what I ran into.

Body video pair offered (URL band cropped for GitHub): "PR as-is on 2.16" and "with 19693 + icons 2.0.67", below. No preview links in the review.

1. pkg/rancher-ai-ui/index.ts:73

The dot only renders with rancher/dashboard#19693, which is still open and documented for 2.17, while this extension supports Rancher >= 2.13. So on every Rancher it runs on today the reply is counted but no dot shows, and that is also why the new indicator test fails on CI (Rancher 2.16 head).

2. pkg/rancher-ai-ui/components/header/ChatPanelMenu.vue:62

icon-notify-bell-off only exists in @rancher/icons 2.0.67, which no shell ships yet, so by default "Disable Desktop Notifications" has no icon and its label sits out of line with the other items.

3. pkg/rancher-ai-ui/store/storage.ts:15

The default depends on what the user saved before: new users get desktop notifications on (the description calls it opt-in), anyone who already toggled Auto-Scroll gets them off, and their next Auto-Scroll change turns them on without touching this option.

4. pkg/rancher-ai-ui/composables/useChatMessageComposable.ts:625

This fires on every </message>, and the agent also closes a message on an error, when it stops for a confirmation and after each plan step. So a failure is announced as "Response complete", a confirmation waiting for the user reads like a finished reply, and a running plan notifies before its answer arrives.

5. pkg/rancher-ai-ui/handlers/notification/channel/index.ts:69

Permission is only requested when a reply ends while the page isn't focused, never from a click, and MDN notes that Firefox 72+ and Safari block requests that don't come from a user gesture (https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API). With the setting on by default, those users never get a prompt or a notification, and nothing tells them why.

6. pkg/rancher-ai-ui/handlers/notification/channel/index.ts:93

Closing it after 5 seconds also removes it from the OS notification center (MDN on Notification.close()), so someone who wasn't looking at the screen, which is the case this is for, comes back to nothing.

7. cypress/e2e/tests/features/notifications.spec.ts:100

The WebSocket stub goes in after beforeEach has opened the chat, so it never captures the chat socket and __triggerMessageCompletion does nothing. The dot then depends on the mock reply still streaming when the chat closes, so the test will be flaky once the shell side lands.

8. Question pkg/rancher-ai-ui/handlers/notification/channel/message.ts:14

Issue 301 also covers Liz asking for something while the chat is closed. An MCP sign-in request keeps the message open while the agent waits, so nothing fires until the chat is opened. Is that case meant to be covered?

9. Optional pkg/rancher-ai-ui/store/notification.ts:35

removeNotification can't receive its index through a commit and nothing calls it; hasUnread and notifications aren't used either, and the stored descriptions are never read.

10. Optional pkg/rancher-ai-ui/store/notification.ts:1

There are no unit tests for the new store or the channel logic (enabled/focus check, permission branch, summary text), while the repo's handlers and the chat composable have them.

11. Optional pkg/rancher-ai-ui/pages/Chat.vue:465

A few new comments only repeat the line under them (here and in the two channel files), and clearBeforeUnload doesn't clear notifications and also runs on unmount.

Ask first (look-only)

ChatPanelMenu.vue:60-62 + en-us.yaml:356-362 (Pass B, look-only): the Auto-Scroll item reads "Turn Auto-Scroll ON/OFF" with an icon for the current state; the new one reads "Enable/Disable Desktop Notifications" with an icon for the state after the click, and its tooltip repeats the label. Not in the review: your rule is to ask before look-only comments.

Comparison

FindingPass A (Cody)Pass B (ours)Merged
Dot needs dashboard PR 19693 (2.17); CI e2e redfoundfoundpost
Default menu item has no icon (icons 2.0.67)foundfound (folded into the dependency)post, own comment
Default on for new users, off with saved prefs; Auto-Scroll flips it onfoundfoundpost
Fires on every </message>: errors say "Response complete", confirmations read as done, plans notify per stepfound (plan + confirmation + error)found (error, confirmation by reading, 4 notes per plan as a question)post, one root-cause comment
Permission asked when unfocused, no gesture (Firefox 72+, Safari)foundfoundpost
close() after 5s also removes it from the notification centerfoundmissed (logged as working)post
e2e WebSocket stub never catches the chat socketmissedfoundpost
MCP sign-in wait never notifiesmissedfound (question)post as question
Unused store members; removeNotification can't workfoundfound (optional)post, optional
No unit tests for store/channelnot a pass (Cody runs test coverage by name only)found (optional)post, optional
Comments that repeat the code; clearBeforeUnload namedropped (no-nit rule)found (optional)post, optional
Menu item wording/icon differs from Auto-Scroll item-found (look-only)ask Marcelo first
"Planning message ready: 1 tasks"seen with scripted framesdropped: one-task plans are never showndropped (B is right: _is_direct_handoff)
Cost
Pass A (this session)about 1h20m wall clock; 7 comments; 2 demo videos; acceptance table
Pass B (fresh agent)18.4 min, 85 tool uses, 256k tokens; 11 points (3 blockers, 2 suggestions, 4 optional, 2 questions)

Both passes saw the same core problems. A alone caught the 5-second close (B logged the auto-close as working). B alone caught the e2e stub that can't work, the MCP sign-in case, and the comment nits. B also showed that "1 tasks" can't happen with the current agent.

Pass A: demos

PR as-is on Rancher 2.16 shell: answer arrives, no dot; default menu item has no icon. (Stands in for the base-branch demo: rancher-ai-main's backend agent is down.)
With dashboard 19693 + icons 2.0.67: the dot appears when the answer ends, opening the chat clears it, new menu option.

Pass A: acceptance criteria (#301, #293, PR body)

CriterionVerdictHow
AC1Badge on Liz's icon when the chat is closed (#301 title/body)Partly metWorks with 19693 patched in; never shows on 2.13-2.16 (PR as-is); CI red
AC2Told when Liz asks for confirmation (#301 "asking for some confirmation")Partly metDot shows; desktop text reads like a finished reply; MCP sign-in never notifies (Pass B)
AC3Works for planning (#293 lists Notifications)Partly metApproval plan: "Planning message ready: N tasks"; running plan notifies per step, before the answer
AC4Desktop notifications opt-in (PR body)Not metOn by default for new users; off for users with saved preferences

#301 has no comments; the PR body doesn't link it (found through dashboard PR 19693's "Contributes to"). Design fidelity, component reuse and a11y had nothing in scope. The dot's missing text alternative belongs to dashboard 19693, not here.

Pass A: checks

red dot on the Liz button while a plan is still running

Pass B: summary

3 blockers (dependency + CI, default, permission), 2 suggestions (text vs event, e2e stub), 4 optional (unit tests, dead code, comments, look-only menu), 2 questions (MCP sign-in, notification per plan step). Coverage grid: correctness, security, store/state, i18n, styling, tests, a11y, plus Dev / UX / UI. 43 checks logged, including a real-agent run and Firefox/WebKit permission probes; the headless results were inconclusive. Files: scratchpad/passB/review.md, coverage.md, checked.md, draft.md.

Environment notes