Repository navigation
feat(relay-viewer): tell a person once when they're added to a Team Crew - #37523
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The screenshots show every new control and state, and the blind reader read the main path correctly: the "added to" note, its Open button, the caret dot and the New tag. Notes
[UX-REVIEWED] fec8607 Description read[DESCRIPTION-READ] 06b44ba07563e0330ad517dc886fbeab45b3f7554289089ea21367041fd0eeaf That sha256 names everything this verdict read: the PR description, plus the 21 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) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: notices are recorded by the stable Notes
[DESIGN-REVIEWED] fec8607 Description read[DESCRIPTION-READ] 27c3721e514f0271d5de4f610d9e2cc6a652459421f9d7d27b34ec48304a58e8 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The "unseen" dot and its seen route go past the frozen Goal, and the owner-only channel set holds a single value. Notes
What this change shipsInventory (8 items) — 6 justifiedIntent: a person who has been given a Team Crew learns of it once, by name, and can open it from there. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] fec8607 Description read[DESCRIPTION-READ] e42c80e3bf99e77858e628de4af76f0216a7fd66ed127b5c90f17db372468a27 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 6.1 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- src/kiro_crew/dashboard/notification_coordinator.py:543 -- Bulk acknowledgment overwrites a later Mark unread
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 — LOW. Every condition checks out. False positive or not applicable? A repository writer can comment: |
9ed8868 to
61002d2
Compare
|
|
|
|
|
|
|
61002d2 to
7944107
Compare
|
7944107 to
3729bc6
Compare
|
|
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for adding the gone-Crew frames. One change is still needed before this can merge.
Earlier review: item 1 (no screenshot of the gone-Crew notice) is fixed on this head. The capture script has a gone frame, and the body now has dark and light stills of the notice.
website/src/components/TeamCrewsGroup.tsx:265. A person presses Open on a "You've been added to " note and lands on/chat?relay_crew=<id>.useOpenFromNotedoes not just open the Crew. It looks in the cached list first. On a miss it makes a fresh read (fetchRelayCrewsNow). If that read fails it refetches the list and comparesdataUpdatedAtagainststartedAt. It holds the Open while waiting and shows its ownnote_crew_gonetext. The server already makes this check._list_then_mintinsrc/kiro_crew/dashboard/handlers/relay_viewer.py:419lists the Crews again on every mint and refuses withCREW_ACCESS_NOT_GRANTEDwhen the ID is missing.relayRefusalTextalready turns that code into "You no longer have access to this Crew.", which is what the row's own Open (TeamCrewsGroup.tsx:187) shows. So the client runs a second copy of the server check, and that copy can race. Most of the hardest new frontend tests exist only for it: the stale cache re-read, a cache change while the fresh read is out, a refetch that returns the same array, and the list read failing twice. Issue #37522 asks for an Open that works "the way its Team Crews row does". Smallest fix: keep the query-param removal, thehandledonce-guard and the hold while the list is hidden (no bridge, or the feature is off). Replace the cached-lookup, fresh-read and refetch branches with oneopenRelayCrew(wanted). On failure showrelayRefusalText(res.error), withopen_crew_failedand the name when the Crew is in the cached list. Then deletefetchRelayCrewsNow, thenote_crew_gonekey in every locale, and the tests that only cover the re-read races. One more gain: a Crew granted after this window last read the list now opens directly, because the server lists the Crews again anyway.
Optional:
- Withholding a
system.relaynote from a non-owner who is not relayed (a chat allowlist login or an app token) is tested only on the WebSocket. If_withheld_frominmessaging_api/notifications.py:92returnsNone, or theowner_only_noteguard inupdates_streams.py:460goes away, no test fails. Add that caller to the list, ack/delete (expect 403owner_only) and SSE tests, or narrow the Tests sentence to what is pinned. - The new
POST /api/relay-viewer/crews/seenroute has no tests for a non-owner, a relayed caller, the off state, or more than 200 IDs. Its sibling GET route has a test for each. docs/system-specs/modules/dashboard-token-auth.mdanddocs/system-specs/modules/app-notifications.mddo not yet describe the owner-onlysystem.relaychannel or the 403owner_onlyrefusal.
1966d7d to
8f60799
Compare
|
@KiroCrewCaptain done on 8f60799. |
8f60799 to
9140ffa
Compare
|
9140ffa fixes both blocks the AI review raised on 8f60799. The note's Open is now gated on An Open from Settings > Remote Crew > Shared Crews now records seen and clears the New mark, the same way the switcher does. If the save fails, the row says so. There's a new test for this in |
9140ffa to
5cc6927
Compare
5cc6927 to
990f594
Compare
990f594 to
1efca69
Compare
23a3b51 to
afe550b
Compare
A successful Crew list read compares its Team Crews with relay-viewer-crews.json under the data home, keyed by endpoint ID. A Crew not recorded yet is written first, then announced on a new system.relay bell channel: "You've been added to <name>" with an Open action, or one "You have access to N Team Crews" note when two or more arrive in one read (a first sign-in with several already granted). The list entry carries unseen until the person opens the Crew or the switcher that lists it (POST /api/relay-viewer/crews/seen), which drives a dot on the switcher caret and a New tag on the row. A failed read, the viewer off, or an unreadable state file never announces anything. Closes #37522
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On this head the review traced the owner-only withholding of system.relay notes on every transport: the WebSocket check in _ws_client_allowed via socket_reads_as_owner, the SSE host-owner check, _withheld_from and the 403 owner_only on list, ack, unack and delete, and the Web Push skip. It also checked that reconcile writes before it announces, and that the filtered clear and ack-all write before they change memory.
Earlier review: item 1 from the first round (no still of the gone-Crew notice) was fixed on 1966d7d. Item 1 from the second round is fixed on this head. useOpenFromNote now makes one openRelayCrew(wanted) call and leaves the grant check to the server. fetchRelayCrewsNow and note_crew_gone are gone.
Security: teammates are already refused /api/relay-viewer on every path, and this PR closes the shared bell as the last way a teammate could learn the owner's Team Crews. The new seen route refuses relayed callers and sits behind the owner gate. It checks IDs against the anchored endpoint ID pattern, caps a request at 200 IDs, only changes IDs the file already holds, and does its file work off the event loop. Every withhold and refusal writes an audit row.
Done well: a failed write never repeats a note or loses the earlier dots, and each failure case has a test.
The design is signed off under the standing maintainer sign-off for changes by team members.
Optional:
app-notifications.mdandshared-crew.mddo not yet describe thesystem.relaychannel, the owner-only withholding, or the 403owner_onlyand 500persist_failedanswers.- In
messaging_api/notifications.py(about line 196), ack-all takes the new per-entry path for every teammate, even when no owner-only note exists. Gating it the way clear is gated would keep the shipped path for that case. - For someone already on a v0.13.0 prerelease, the first list read after the upgrade finds no state file and announces Team Crews they already had. One sentence in
remote-crew.mdwould cover it.
Problem / Motivation
Goal: When someone is given a Team Crew, the desktop app tells them once, by name, with a way to open it.
Step 4 of the Shared Crew UX mock ("When user opens Crew, they're notified they have been added to a Shared Crew") has no implementation. The dashboard already re-reads
GET /api/relay-viewer/crewsevery 60 s and a new grant shows up in Local > Team Crews, but nothing says so: the person only finds it if they open the Crew switcher.Why it matters
Sharing a Crew is only useful once the teammate knows it's there. Today the person granting access has to tell them out of band, and a teammate who doesn't open the switcher never sees it.
Not a goal
src/kiro_crew/relay_viewer/cps.py), so a missing Crew isn't proof access was removed; the open window's lost-access notice is Relay Crew window: show a lost-access notice when access is refused, not a disconnect #35144. A Crew that leaves stays recorded and is not announced again if it returns.What changed (motivation → approach → change)
The stable key is
endpointId: the list is de-duplicated on it and opening a Crew sends it, whilenamecan change. The list carries no grant time, so "new" means "not announced before".The record lives on the viewer's gateway, in
relay-viewer-crews.jsonunder the data home, since a new relay window starts with empty browser storage. After a successful list read, the crews handler compares its Team Crews with that file; a Crew not recorded is written first and announced after, so a failed write sends nothing. One new Crew gets "You've been added to " with an Open action; two or more in one read get one "You have access to N Team Crews" note, on a newsystem.relaybell channel (labelled Team Crews, so it can be muted on its own).Each entry now carries
unseen. The switcher's caret shows a dot and the row a New tag until the person opens the switcher that lists it or opens the Crew (switcher, note or Settings), whichPOST /api/relay-viewer/crews/seenrecords. The route answers 503 when it couldn't save; the dashboard sends at most 200 IDs per request and clears a dot only for IDs the gateway confirmed. The Open action lands on/chat?relay_crew=<id>; the switcher opens that Crew as its row would, at every header width, and if it can't, says why in the top bar, naming the Crew, with Ask the agent. The Open goes straight to the bridge, cached or not: the gateway re-lists on every open and refuses an ungranted Crew (CREW_ACCESS_NOT_GRANTED), so a late grant opens and a revoked one shows the row's refusal. The note's Open button is translated.These notes name Team Crews the machine owner's own sign-in can open, so
system.relayreaches the machine owner alone (is_host_owner_dashboard_request): a Shared Crew teammate is withheld it on the notification list and its delete/ack/clear, the WebSocket and SSE, and it is never sent as a Web Push, whose subscriptions record no reader (OWNER_ONLY_CHANNELSinsrc/kiro_crew/dashboard/ws_event_scope.py, checked insrc/kiro_crew/dashboard/messaging_api/notifications.py,src/kiro_crew/dashboard/websocket_hub.py,src/kiro_crew/dashboard/handlers/updates_streams.pyandsrc/kiro_crew/dashboard/notification_coordinator.py). A filtered clear or ack-all writes first and changes memory only once that lands, asdismissdoes; a failed write answers 500. The gate moved to the machine owner because #38209 made every teammate pass the owner gate (one-role decision).Two reviewer calls: the summary covers any read with two or more new Crews, so a batch of grants is one note; and "seen" also means opening the switcher, since the dot points at the menu.
Where:
src/kiro_crew/relay_viewer/crew_notices.py(record and notes),src/kiro_crew/dashboard/handlers/relay_viewer.pyandsrc/kiro_crew/dashboard/routes/connections.py(theunseenfield and the seen route),src/kiro_crew/notifications/bus.py(the channel),website/src/hooks/useRelayViewerCrews.tsandwebsite/src/api/client/instances.ts(seen calls),website/src/components/TeamCrewsGroup.tsxandInstanceTabBar.tsx(dot, tag, Open),website/src/components/SharedCrewsCards.tsx(a card's Open records seen),website/src/shell/topbar/shellHeader.tsx(one switcher for both header widths),website/src/test/ApiClient.refactor.surface.test.ts(the new client method in the pinned order),website/scripts/capture-relay-crew-added.mjs(the screenshots below),website/src/components/notifications/notifMeta.tsx(copy and Open label, used byNotificationBanner.tsx,NotificationFeed.tsx,NotificationDetailPanel.tsx) andwebsite/src/pages/settings/NotificationsPanel.tsx(translated copy, channel label and tip), every locale underwebsite/src/i18n/pluspluralKeys.jsonanden.context.json, andsrc/kiro_crew/docs/remote-crew.mdwith the feature map.Backwards compatibility
Compatible: the crews answer gains one field (
unseen) and a new route; nothing existing is renamed or removed.Removes nothing: no route, field, key or record is taken away.
Tests
test/test_relay_viewer_crew_notices.py: a new Crew notifies once and repeat reads don't; a first read with several Crews posts one summary (and never a Personal Crew); a failed read or the viewer off never notifies or writes the file; seen clears the dot and rejects a malformed ID; a seen that can't be saved, or whose state file can't be read, answers 503 and the dot stays; a failed write for a new Crew keeps the earlier Crews' dots; a Crew that leaves and returns isn't announced again; an unreadable file is rebuilt without a note; a failed write sends nothing.website/src/components/TeamCrewsGroup.test.tsx: the caret dot and New tag, seen recorded once when the menu shows it and cleared on close; a failed seen keeps the dot and says it wasn't saved; a seen reply that lands after the menu closed still clears the dot; 450 unseen Crews go out as 200/200/50; the Open action's query opens that Crew once; a failed list read keeps the Open and the Crew opens once a read succeeds; a Crew missing from the cached list still opens through the bridge; a list read that lands after history moved on opens nothing and leaves the new page; a list read that started before a seen save can't bring the dot back; a Crew the gateway no longer grants shows "You no longer have access to this Crew."; a failed open names the Crew and keeps the dot.website/src/components/notifications/noteActionLabel.test.ts: a gateway note's Open reads in the dashboard's language; other actions keep their label.website/src/components/SharedCrewsCards.test.tsx: an Open from a Settings card records the Crew as seen and clears its New mark in the shared list.test/test_owner_only_notifications.pyandtest/test_shared_crew_teammate_owner_access.py: an SSM, tailnet or relay teammate gets nosystem.relaynote on the WebSocket, SSE or notification list and is refused 403owner_onlyacking or deleting one; the machine owner gets them on all of these and can change them. Each teammate case is red with its gate reverted, and red on the old owner gate. A teammate's clear or ack-all whose write fails answers 500 and changes nothing, and keeps a note delivered or acked while it was being written.test/test_web_push.py: asystem.relaynote is never handed to the Web Push fan-out; the Crew's own note still is.test/test_relay_viewer_routes.py: the entry shape now includesunseen.website/src/test/ApiClient.refactor.surface.test.ts:relayViewerCrewsSeenin the pinned key order.Proof: not provable -- other: new feature, no defect to revert; the new tests cover the added behavior.
Run locally on the rebased head: the relay viewer, notification, Web Push, messaging and Shared Crew suites (1,044 and 451 passed across two runs), the four changed frontend test files (259 passed),
tsc -p ., eslint on the changed frontend files, and black, flake8 and mypy on the changed Python. The full cross-surface set is left to CI.Manual verification
The screenshots below are the real built SPA with the API and the desktop bridge stubbed (
website/scripts/capture-relay-crew-added.mjs); every frame asserts what it shows before it is written. Still not done: a grant in the desktop app against a live control plane.Screenshots / video
The bell note for one new Team Crew, with Open:
Two or more at once get one note:
The dot on the switcher caret, and the open switcher with the New tag on the new row only:
Open from the note when the Crew's host is offline: the refusal in the top bar names the Crew, with Ask the agent and dismiss (the message clamps; its tooltip has the whole text):
Open from the note on a Team Crew the gateway no longer grants (access taken back): the top bar shows the gateway's refusal, "You no longer have access to this Crew.", the same text the row's own Open shows. Dark, then light:
A seen state the gateway couldn't save, in the open switcher:
An Open from Settings > Remote Crew > Shared Crews records seen too; when the save fails, the row says so (the light frame's row highlight is the capture's mouse still resting on it after the click):
The Team Crews channel in Settings > Notifications > Sources, with its tip:
The other theme of each
Related Issues
Closes #37522
Related: #35144 (lost-access notice in the relay Crew window), #38209 (Shared Crew teammates act as the owner).
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)