Repository navigation
feat(notifications): link agent notes to the session that sent them - #22966
unstablebrainiac merged 1 commit into
Conversation
UX Review (Opus 5.5, fork) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing a screenshot of the notification detail panel for an agent-sent note. The PR makes Go to chat / Resume chat appear on those notes and sends mate notes to the Members page, but attaches no images. Evidence gaps
Notes
[UX-REVIEWED] 28157c7 Description read[DESCRIPTION-READ] 2a0a8f8f2a1325d19ac43454e86ab86498b7ae2b93745758708929baa14e6d5e That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: both agent routes take the link from the sender's attested key through one resolver. An unattested caller gets no link, and so does a cron run with no tab of its own. Notes
[DESIGN-REVIEWED] 28157c7 Description read[DESCRIPTION-READ] 694d406e1cc2ebe405ff69084d451a7f2abf46c5b1e48e40b7cc2a6d07b0a438 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The new resolver is built from helpers that already exist ( What this change shipsInventory (8 items) — 7 justifiedIntent: a bell note an agent sends opens the chat that sent it. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 28157c7 Description read[DESCRIPTION-READ] e4eac4001f52111e50f9365ec0a5d62737bc3066a970873662406c026b3aefe0 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
6bf8496 to
27d6414
Compare
27d6414 to
ae0da04
Compare
ae0da04 to
c477764
Compare
A note an agent publishes with send_notification, and the bell copy of send_message, did not say which session published it, so the detail panel offered no way back to the conversation. Both routes set the note's slot and history_key from the caller's attested session key, when the dashboard holds that session's tab. Go to chat reads slot. Resume chat resumes with history_key: a bare slot name names no transcript, so resuming by it opens an empty chat. A mate's note opens its thread on the Members page instead, as its sidebar row does, since the chat page does not show mate threads. A cron run with no tab of its own gets no link: the banner hides a note whose slot is the chat on screen, and the chat that created the cron never shows the cron's output.
c477764 to
28157c7
Compare
|
HOLD at 28157c7. The change itself looks sound. What blocks: two lanes on this head have items with no reply.
What clears it: attach the screenshots, or reply to each item with a reason. If any item becomes a follow-up, link an issue for it. I read the diff and CI. I did not run tests. — crew-pr-reviewer (r120) |
|
|
|
|
|
iamwhatever
left a comment
There was a problem hiding this comment.
Approving 28157c7.
The link back to the sender is safe. _publishing_session_meta takes slot and history_key only from the caller's attested session key, and only for a tab the dashboard holds, so a request body cannot point a note at another session (proactive_send.py#L147-L164). Every r120 item now has a reply. The five screenshots are in the description, and the label and banner notes have reasons. The Design rebuttal holds: slot_registry.py refuses a member- key for any non-member slot (slot_registry.py#L221), so the Members-page choice and history_key cannot disagree.
All lanes pass, and GPT and Opus report no findings. CI is green: 99 checks pass or are skipped, plus PR Readiness. The branch is 69 commits behind main, but a trial merge with current main is clean, and the new wiring in handlers/messaging.py survives #23052.
Reviewed head: 28157c7
— crew-pr-reviewer (r121)
Problem / Motivation
Goal: A bell note an agent sends opens the chat that sent it.
A note an agent publishes with
send_notification, or thatsend_messagedrops into the bell, does not say which session sent it. Its detail panel shows no Go to chat button, so getting back to the conversation means guessing from the title.Why it matters
The bell is where unattended agents report. With several sessions running, a note that cannot lead back to its conversation sends the user hunting through the sidebar, or gets ignored.
Not a goal
POST /api/notifications/push) and the notes the gateway writes about a session. Both set their own fields already.What changed (motivation → approach → change)
An agent's bell note opens the chat that sent it. The detail panel shows Go to chat while that tab is open, and Resume chat once it is closed. A mate's note opens its thread on the Members page, since the chat page does not show mate threads.
The gateway already knows the sender. Both routes read the caller's attested session key, to put a crewmate's face on the note and to apply that session's mute, then drop the key before the note is stored. Notes that keep a
slot, such as cron results, heartbeat notes and crewmate messages, already get the detail panel's buttons.So both routes stamp two fields from that same key, through one resolver,
_publishing_session_metainmessaging_api/proactive_send.py:slot, the session's tab while the dashboard holds it, andhistory_key, that tab's transcript key. Neither comes from the request body. Go to chat readsslot. Resume chat inNotificationDetailPanel.tsxresumes withhistory_key, and withslotfor a note that has none: a bare tab name names no transcript, so resumingchat-2-200reads achat-2-200transcript that does not exist and opens an empty chat.The chat page shows only ordinary chat tabs, and a mate's DM thread is not one. So both buttons on a note from a mate's thread open
/members?member=<name>, the page that thread's sidebar row opens: Go to chat names the open slot'sagent(an open thread that names none opens the bare Members page, as its row does), and Resume chat the note'smemberonce the thread has closed, because the Members page holds the mate's one thread. The panel applies the row's rule itself, because only the sidebar may import the sidebar's row model (ChatSidebar.ownerComposition.test.ts). Crewmate message notes, which already carry the mate's thread asslot, get the same Go to chat.slothistory_keydashboard:<tab>cron-<id>cron:<id>Only the sender's own tab counts. The banner skips a note whose
slotis the chat on screen. That is right for the chat that wrote the note, which already shows the tool call. It would be wrong for the chat that created a cron, which never shows the cron's output: borrowing its tab would hide the cron's alert while the user sits there. Asend_messagethat offers[OPTIONS:]choices links too, since it is the note most likely to need an answer. A closed cron tab resumes from itscron:<id>transcript, the way the History tab opens it.docs/system-specs/modules/app-notifications.mddocuments the link, the feature map's Notifications row names it, andwebsite/src/types/index.chat.tsaddshistory_keyto theNotificationtype.Backwards compatibility
Compatible: notes from the two agent routes gain two optional fields,
slot, which cron, heartbeat and crewmate notes already carry, andhistory_key, which the tab hand-over note already carries. A note withouthistory_keyresumes byslot, as every note did. No request field, response field or validator changes.One behaviour goes away: the banner for a note sent by the chat on screen. One changes: Go to chat on a crewmate message note went to the chat page, where a mate's thread does not show, and now opens that thread on the Members page, as the note's Open button does. Every reader of the new fields:
Reader: website/src/hooks/notificationBanner.ts:targetsCurrentView -- chat -- a note whose slot is the focused chat shows no banner, as a heartbeat note does; that chat shows the tool call and the note stays in the bell (NotificationBanner.test.tsx "suppresses a note about the chat on screen while the window is focused")
Reader: website/src/components/notifications/NotificationDetailPanel.tsx:directSlot -- chat -- Go to chat switches to
slot, or opens a mate's thread on the Members page; Resume chat opens a closed mate thread there, else resumes withhistory_key, elseslot(NotificationDetailPanel.resumeHistory.test.tsx, NotificationDetailPanel.memberNavigation.test.tsx)Reader: website/src/components/notifications/notificationHandoff.prompt.ts:buildNotificationPrompt -- chat -- the hand-off prompt names the session by its tab (
- Session: <slot>)Reader: src/kiro_crew/dashboard/ws_event_scope.py:_decide_ws_event -- app -- a notification frame is judged by its notification scope; its
slotis ignored for slot scoping andhistory_keyis not read, so the frame reaches the same apps as beforeTests
test/test_notification_session_link.py(new):slotandhistory_keyfor each caller in the table, both routes stamping them, a request body that cannot choose them, an unattested caller that gets neither, asend_messageoffering choices that still links, and a closed session that resumes its messages through the real resume route by the note'shistory_key.website/src/test/NotificationDetailPanel.resumeHistory.test.tsx(new): Resume chat resumes withhistory_key, and withslotfor a note that has none.website/src/test/NotificationDetailPanel.memberNavigation.test.tsx(new): Go to chat on an open mate thread opens/members?member=<name>without switching the chat pane, Resume chat on a closed one opens the same page without resuming a transcript, an open thread that names no mate opens the bare Members page, a closed one whose note names no mate resumes from history, and an ordinary chat still opens on the chat page.test/test_dashboard_file_io.py: the twosend_messagetests that assert the exactstate.notifycall expectmeta=Nonefor a caller with no session.test/test_proactive_send_source_line.py: its fake slot carries thekeyevery real slot has, which the note'shistory_keyreads.X-Session-Keyheader, linking only notes that can be muted, borrowing a cron's creator tab, droppinghistory_key, a panel that resumes byslotwhen the note hashistory_key, and a panel that sends a mate's note to the chat page from either button, names the wrong mate, sends an open thread that names no mate to the chat page, or sends a closed one whose note names no mate to the Members page.-n0, 10 at-n 4 --dist loadgroupbesidetest_notification_publisher_mute.pyandtest_notification_crewmate_member.py, and in a shuffled order (seed 7317, 84 passed);NotificationDetailPanel.memberNavigation.test.tsxran 10 times, and the fourNotificationDetailPaneltest files ran shuffled together (seed 7317, 18 passed). All green.Manual verification
Not run live. Both routes run under aiohttp's
TestServerwith the auth marks the middleware sets, and the closed-tab case runs end to end: the note is published through the agent route, the tab is removed, and the real resume route returns the session's messages. The panel's changes are which key Resume chat sends and which page a mate's note opens, each pinned by its test.Screenshots / video
Captured from this branch's built SPA with the dashboard API stubbed, the method
website/scripts/capture-notification-go-to-chat.mjsuses. Each note carries the fields the two routes stamp:slotandhistory_key, plusmemberon a mate's note. The capture script checks each state before it saves a frame, including that Resume Chat sends the history keydashboard:chat-12-1792700000and not the tab name.An agent's note while its chat is open shows one Go to Chat button:
The same note after its chat is closed shows Resume Chat, which reopens the chat with its transcript:
A mate's note: Go to Chat opens that mate's thread on the Members page. Once the thread is closed, Resume Chat opens the same page.
Related Issues
Closes #22941
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)