Skip to content

feat(relay-viewer): tell a person once when they're added to a Team Crew - #37523

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
feat/relay-crew-added-notice
Nov 17, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
feat/relay-crew-added-notice

Conversation

@tim-finnigan

@tim-finnigan tim-finnigan commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

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/crews every 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

What changed (motivation → approach → change)

The stable key is endpointId: the list is de-duplicated on it and opening a Crew sends it, while name can 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.json under 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 new system.relay bell 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), which POST /api/relay-viewer/crews/seen records. 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.relay reaches 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_CHANNELS in src/kiro_crew/dashboard/ws_event_scope.py, checked in src/kiro_crew/dashboard/messaging_api/notifications.py, src/kiro_crew/dashboard/websocket_hub.py, src/kiro_crew/dashboard/handlers/updates_streams.py and src/kiro_crew/dashboard/notification_coordinator.py). A filtered clear or ack-all writes first and changes memory only once that lands, as dismiss does; 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.py and src/kiro_crew/dashboard/routes/connections.py (the unseen field and the seen route), src/kiro_crew/notifications/bus.py (the channel), website/src/hooks/useRelayViewerCrews.ts and website/src/api/client/instances.ts (seen calls), website/src/components/TeamCrewsGroup.tsx and InstanceTabBar.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 by NotificationBanner.tsx, NotificationFeed.tsx, NotificationDetailPanel.tsx) and website/src/pages/settings/NotificationsPanel.tsx (translated copy, channel label and tip), every locale under website/src/i18n/ plus pluralKeys.json and en.context.json, and src/kiro_crew/docs/remote-crew.md with 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.py and test/test_shared_crew_teammate_owner_access.py: an SSM, tailnet or relay teammate gets no system.relay note on the WebSocket, SSE or notification list and is refused 403 owner_only acking 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: a system.relay note 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 includes unseen. website/src/test/ApiClient.refactor.surface.test.ts: relayViewerCrewsSeen in 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:

You've been added to Platform Team, with Open

Two or more at once get one note:

You have access to 3 Team Crews

The dot on the switcher caret, and the open switcher with the New tag on the new row only:

Crew switcher caret with a dot

Open switcher: Platform Team tagged New, Docs Crew not

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):

Couldn't open Platform Team. This Crew is offline.

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:

gone dark

gone light

A seen state the gateway couldn't save, in the open switcher:

Couldn't save that you've seen this. It will show as new again.

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):

card-seen-failed dark

card-seen-failed light

The Team Crews channel in Settings > Notifications > Sources, with its tip:

Team Crews channel row and tip

The other theme of each

banner light

summary light

caret light

menu dark

refusal light

seen-failed light

settings dark

Related Issues

Closes #37522

Related: #35144 (lost-access notice in the relay Crew window), #38209 (Shared Crew teammates act as the owner).

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@tim-finnigan tim-finnigan self-assigned this Nov 15, 2026
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of fec86076b5830c2223672819563b38db85141482 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • The notes say "Open it from Team Crews in the Crew switcher", but nothing on screen is labelled "Crew switcher". The reader could only guess it meant the caret ("I'm guessing it's the small arrow"). Point at what's on screen instead, e.g. "Open it from the Team Crews list in the crew menu at the top", or give the menu a visible "Crews" heading.
  • The "You have access to N Team Crews" summary has no action and doesn't name any Crew. The reader "can't tell which ones they are". List up to three names in the body and add an action that opens the switcher.
  • The top-bar refusal is cut to one line, so the reason is lost ("You no longer have acces…", "Couldn't open Platform…"). Put the reason first and the name second, e.g. "No access to Platform Team", so the clipped text still says what went wrong.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of fec86076b5830c2223672819563b38db85141482 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: notices are recorded by the stable endpointId before they are sent, the new channel goes only to the machine owner on every feed, and screenshots are attached.

Notes

  • The owner-only check is now copied into five places: the notification list, its write routes, the WebSocket, SSE and Web Push. If another owner-only channel or transport is added later, it can be missed in one of them. A single audience_may_read(note, request) helper would make that harder.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of fec86076b5830c2223672819563b38db85141482 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • Item 3 — oversized: the Goal is "tells them once, by name, with a way to open it", and the bell note with Open (items 1–2) already does that. The caret dot, the New tag, the seen field and POST /api/relay-viewer/crews/seen (with 200-ID batching and a 503 path) are a second indicator the Goal never asks for. Subtraction: delete unseen from _entry, mark_seen, api_relay_viewer_crews_seen, relayViewerCrewsSeen and the dot/tag in TeamCrewsGroup.tsx/InstanceTabBar.tsx, and keep the announced-ID record only. Clears when: the mechanism is removed, or a human amends the Goal.
  • Item 6 — one consumer, generalized: OWNER_ONLY_CHANNELS = frozenset({"system.relay"}) has exactly one member, and all 5 call sites of owner_only_note test membership in it. Subtraction: compare channel == crew_notices.CHANNEL directly and drop the set.

What this change ships

Inventory (8 items) — 6 justified

Intent: a person who has been given a Team Crew learns of it once, by name, and can open it from there. ADDITION.

  1. The bell says "You've been added to " with Open the first time a Team Crew appears — justified
  2. Two or more new Crews in one read get a single "access to N Team Crews" note — justified
  3. A dot on the switcher caret and a New tag on the row until the person sees or opens that Crew — oversized
  4. A new "Team Crews" bell channel the person can mute in Settings › Notifications — justified
  5. The Open link (/chat?relay_crew=) opens that Crew, or names it in the top-bar refusal — justified
  6. Team Crew notes are withheld from Shared Crew teammates on the list, live feeds and Web Push; teammates can't ack, delete or clear them — justified
  7. The narrow header now shows the Team Crews switcher in the desktop app — justified
  8. Announced Crews are kept in relay-viewer-crews.json under the data home — justified

[FIRST-PRINCIPLES-REVIEWED] fec8607

Description read

[DESCRIPTION-READ] e42c80e3bf99e77858e628de4af76f0216a7fd66ed127b5c90f17db372468a27

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed fec86076b5830c2223672819563b38db85141482 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] fec8607

Verdict parsed from the review's SHA-scoped output markers for commit fec86076b5830c2223672819563b38db85141482.

False positive or not applicable? A repository writer can comment:
/ai-review override fable fec86076b5830c2223672819563b38db85141482 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)

GPT 6.1 flagged blocking issues on fec86076b5830c2223672819563b38db85141482; Opus 5.5 adjudication downgraded every one of them. Downgraded: the remedy each one needs is disproportionate to the harm it prevents. Adjudication downgraded all 1 blocking finding(s): the remedy each one requires is disproportionate to the harm it prevents.

This comment is updated in place on each push.

Review details

BLOCKING -- src/kiro_crew/dashboard/notification_coordinator.py:543 -- Bulk acknowledgment overwrites a later Mark unread

note["acked"] = True
Trigger: A Shared Crew teammate clicks Mark all read, then Mark unread while the bulk save is pending. The optimistic dashboard update immediately enables Mark unread; /api/notifications/unack reaches set_acknowledged, which changes the flag before waiting for the bulk operation’s rewrite lock.
Outcome: The bulk commit overwrites the newer unread flag, and the queued unack rewrite persists acked=True. Both requests succeed, but reloading shows the notification as read.
Anchor: defect
Fix: Acquire the shared rewrite lock before individual ack/unack mutations, and persist within that lock, so the later unread operation takes effect after the bulk commit.
Sites: src/kiro_crew/dashboard/notification_coordinator.py:568, reached through src/kiro_crew/dashboard/messaging_api/notifications.py:189 and DashboardState.unack_notification.

[BLOCK-MERGE-DOWNGRADED] fec8607
[GPT-REVIEWED] fec8607

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 — LOW. Every condition checks out. set_acknowledged changes note["acked"] without taking the rewrite lock (notification_coordinator.py:568). The bulk commit then sets the same note back to acked=True once its write lands (:543). And rewrite waits on that same lock (:429-431), so the queued unack persists the bulk value. The person has to click Mark unread inside the write window of a Mark all read they just made. The result is visible, not silent: :544 sends notification_ack for that note, so the open view flips it back to read right away. Clicking Mark unread again fixes it, and nothing is lost or exposed.
The real fix is bigger than it looks. asyncio.Lock is not reentrant and rewrite takes it itself, so set_acknowledged (and the same unlocked mutate-then-rewrite pattern in acknowledge_where, delete and clear) would have to become instance methods with a separate write-under-lock path. That is a new lock-ordering contract to fix a sub-second, self-correcting race.

[ADJUDICATION] fec86076b5830c2223672819563b38db85141482 total=1 uphold=0 downgrade=1
DOWNGRADE F1 src/kiro_crew/dashboard/notification_coordinator.py:543 reason=disproportionate-remedy
[GPT-ADJUDICATED] fec86076b5830c2223672819563b38db85141482

False positive or not applicable? A repository writer can comment:
/ai-review override gpt fec86076b5830c2223672819563b38db85141482 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Nov 15, 2026
@tim-finnigan
tim-finnigan force-pushed the feat/relay-crew-added-notice branch from 9ed8868 to 61002d2 Compare November 15, 2026 19:16
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 15, 2026
@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • No rendered evidence for the new Team Crews surfaces span=470ee0505d1c

fixed in 61002d2: The description now carries the bell note with Open, the summary note, the caret dot, the open switcher with the New tag, and the Open refusal, in both themes, from website/scripts/capture-relay-crew-added.mjs (real built SPA, API and desktop bridge stubbed, each frame asserted before it is written).

@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • Open-failure ErrorNotice has no hand-off decision span=b35f7a7c07eb

fixed in 61002d2: The notice now sets askAgent, as the bar's own list-failure notice beside it does; the top bar holds no draft (website/src/components/TeamCrewsGroup.tsx).

@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • Feature-map row still says API only / no frontend span=4464213526e3

fixed in 61002d2: The row now names its navigation (the switcher's Team Crews group, the bell note and its Open, Settings > Notifications > Team Crews), its frontend files, and relay_viewer/crew_notices.py beside the handler.

@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • Notification Open does nothing in a narrow desktop window span=39487d6b17d0

fixed in 61002d2: shellHeader.tsx now mounts one CrewSwitcher in both the wide and the single-bar header, so the relay_crew query is read at every width.
Same commit: a note naming a Crew no longer on the list now shows the access-gone refusal instead of nothing.

@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • The Open-failure notice lacks the required hand-off decision span=39487d6b17d0

fixed in 61002d2: The notice now sets askAgent, as the bar's own list-failure notice beside it does; the top bar holds no draft (website/src/components/TeamCrewsGroup.tsx).

@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • Failed seen writes are acknowledged as successful span=72d3c814d514

fixed in 61002d2: mark_seen now returns whether the write landed and the route answers 503 NOT_SAVED when it didn't; the dashboard clears a cached dot only for IDs the gateway confirmed. Tests: test_a_seen_that_cannot_be_saved_says_so_and_keeps_the_dot, and 'keeps the dot when the gateway could not save' in TeamCrewsGroup.test.tsx.

@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • The seen route rejects batches produced by the switcher span=44cccfc59160

fixed in 61002d2: recordRelayCrewsSeen now sends at most 200 IDs per request (the route's cap) and returns only the IDs whose batch was saved; the test 'sends a long unseen list in batches' pins 450 as 200/200/50.

@tim-finnigan
tim-finnigan force-pushed the feat/relay-crew-added-notice branch from 61002d2 to 7944107 Compare November 15, 2026 19:24
@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • A failed list read turns a note's Open into a false access-gone refusal span=b35f7a7c07eb

fixed in 7944107: useOpenFromNote now waits while the list is hidden OR its read failed (hidden || refusal !== null), leaving the relay_crew query in place, so access-gone is said only when a read that succeeded does not list the Crew.
Test: 'keeps the Open through a failed list read and opens the Crew once a read succeeds' in website/src/components/TeamCrewsGroup.test.tsx.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 15, 2026
@tim-finnigan
tim-finnigan force-pushed the feat/relay-crew-added-notice branch from 7944107 to 3729bc6 Compare November 15, 2026 19:57
@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • Seen-write failures never reach an error surface span=39487d6b17d0

fixed in 3729bc6: recordRelayCrewsSeen now returns { saved, failed }. A failed save shows seen_not_saved through ErrorNotice (with its menu item) in the Team Crews group, and through the switcher's notice on the note-Open path. Both keep askAgent per errors-use-error-notice, since the bar holds no draft.
Test: 'keeps the dot when the gateway could not save that the Crew was seen' now also asserts the notice.

@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • Closing before the seen response leaves saved dots uncleared span=39487d6b17d0

fixed in 3729bc6: The group tracks whether its menu is still open; a seen reply that lands after it closed clears its saved IDs from the cache right away. Test: 'clears the dot when the seen reply lands after the menu closed'.

@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • A failed new-grant write hides previously unseen Crews span=72d3c814d514

fixed in 3729bc6: reconcile now keeps a copy of the stored records; when writing the new Crews fails it announces nothing but returns the unseen IDs the file already held. Test: test_a_failed_write_for_a_new_crew_keeps_the_earlier_dots.

@tim-finnigan
tim-finnigan marked this pull request as ready for review November 15, 2026 20:56
@tim-finnigan
tim-finnigan requested review from a team and KiroCrewCaptain as code owners November 15, 2026 20:56
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 17, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

  1. 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>. useOpenFromNote does 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 compares dataUpdatedAt against startedAt. It holds the Open while waiting and shows its own note_crew_gone text. The server already makes this check. _list_then_mint in src/kiro_crew/dashboard/handlers/relay_viewer.py:419 lists the Crews again on every mint and refuses with CREW_ACCESS_NOT_GRANTED when the ID is missing. relayRefusalText already 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, the handled once-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 one openRelayCrew(wanted). On failure show relayRefusalText(res.error), with open_crew_failed and the name when the Crew is in the cached list. Then delete fetchRelayCrewsNow, the note_crew_gone key 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.relay note from a non-owner who is not relayed (a chat allowlist login or an app token) is tested only on the WebSocket. If _withheld_from in messaging_api/notifications.py:92 returns None, or the owner_only_note guard in updates_streams.py:460 goes away, no test fails. Add that caller to the list, ack/delete (expect 403 owner_only) and SSE tests, or narrow the Tests sentence to what is pinned.
  • The new POST /api/relay-viewer/crews/seen route 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.md and docs/system-specs/modules/app-notifications.md do not yet describe the owner-only system.relay channel or the 403 owner_only refusal.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 17, 2026
@tim-finnigan
tim-finnigan force-pushed the feat/relay-crew-added-notice branch from 1966d7d to 8f60799 Compare November 17, 2026 03:33
@tim-finnigan

Copy link
Copy Markdown
Contributor Author

@KiroCrewCaptain done on 8f60799. useOpenFromNote now makes one openRelayCrew(wanted) call, whether or not the cached list has the Crew. It keeps the query-param removal, the handled once-guard and the existing hold (hidden || refusal !== null). On failure it shows relayRefusalText(res.error), prefixed with open_crew_failed and the name when the cached list has the Crew. fetchRelayCrewsNow is gone, so are note_crew_gone in all 13 locales and the re-read race tests (stale-cache re-read, the six obsolete-Open-after-navigation cases, a cache change during the fresh read, refetch-returns-same-list, and both reads failing). There are two new tests: a Crew missing from the cached list still opens through the bridge, and a CREW_ACCESS_NOT_GRANTED refusal shows "You no longer have access to this Crew.". The gone frames are recaptured to show that refusal, and the body is updated to match. The optional items are left for later.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 17, 2026
@tim-finnigan
tim-finnigan force-pushed the feat/relay-crew-added-notice branch from 8f60799 to 9140ffa Compare November 17, 2026 03:56
@tim-finnigan

Copy link
Copy Markdown
Contributor Author

9140ffa fixes both blocks the AI review raised on 8f60799.

The note's Open is now gated on useRenderedLocationIsCurrent() again, so a render that lags a navigation still in flight doesn't replace the new page or open the Crew. A new test drives a Router that keeps the note's location while history moves to Settings. It fails without the guard (the location goes back to /chat) and passes with it.

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 SharedCrewsCards.test.tsx, and dark and light frames are in the body.

@tim-finnigan
tim-finnigan force-pushed the feat/relay-crew-added-notice branch from 9140ffa to 5cc6927 Compare November 17, 2026 04:13
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Nov 17, 2026
@tim-finnigan
tim-finnigan force-pushed the feat/relay-crew-added-notice branch from 5cc6927 to 990f594 Compare November 17, 2026 06:22
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 17, 2026
@tim-finnigan
tim-finnigan force-pushed the feat/relay-crew-added-notice branch from 990f594 to 1efca69 Compare November 17, 2026 07:23
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 17, 2026
@tim-finnigan
tim-finnigan force-pushed the feat/relay-crew-added-notice branch 2 times, most recently from 23a3b51 to afe550b Compare November 17, 2026 08:20
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 17, 2026
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 KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md and shared-crew.md do not yet describe the system.relay channel, the owner-only withholding, or the 403 owner_only and 500 persist_failed answers.
  • 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.md would cover it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shared Crew: tell a relay viewer when they've been added to a Team Crew

2 participants