Repository navigation
fix: make Team Crew screens work for teammates over the relay - #38437
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level problem blocks this. The new teammate refusals use the existing Notes
[DESIGN-REVIEWED] 04e2887 Description read[DESCRIPTION-READ] a6b5ed5cdf12814f48496badfd754b31ee92b2f5aac614af9b7f4dc1ca122b64 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 |
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing the "Remote access to this Crew is off" relay screen. The new remote-off state has no screenshot, and neither do the shared-Crew Privacy wording or the offline Team Crews row. Evidence gaps
Notes
[UX-REVIEWED] 04e2887 Description read[DESCRIPTION-READ] d5d0bb69915f3913597648b6e2a406a2132a00b35c30f3be54b23fd9165db5a9 That sha256 names everything this verdict read: the PR description, plus the 20 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 Every item answers a defect from the two-person relay test in the description. Remote Control off and Notes
What this change shipsInventory (10 items) — 9 justifiedIntent: let a teammate reached over the relay use a Team Crew without false controls, stale "connected" states, or the power to take it offline; FIX.
[FIRST-PRINCIPLES-REVIEWED] 04e2887 Description read[DESCRIPTION-READ] fa88ccaad2e2efc39c38e47058783904fd137948b24ae01ef22f694c512e5614 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 findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
c29cf17 to
a0ae305
Compare
The relay's |
The relay refusal notice now passes |
a0ae305 to
8782b93
Compare
The Linux reason now reads "Computer Use isn't available on Linux in this release." in every locale, without naming macOS as the only supported platform; the panel test pins it. |
The file's |
8782b93 to
5dcb456
Compare
The signed-out list keeps Sign in to Kiro as its first action and now keeps the |
5dcb456 to
cb85d7f
Compare
For a teammate the selected channel now shows its failed status read as an |
cb85d7f to
7e879b6
Compare
A real two-person Team Crew test over the Kiro relay (Linux host, two desktop-app viewers on another machine) found screens that offered a teammate owner-only controls, broke when the host went away, or gave wrong advice. One teammate could also turn off Remote Control for everyone, which only the host machine can undo. - Turning Remote Control off and instances.* config writes stay the machine owner's (teammate_access); reading the state stays open. - Owner-only screens tell a teammate so instead of offering a control the server then refuses: Secrets, Remote Control, remote crew management, Channels, /terminal; Connect your phone is not offered; Voice, People, Computer Use and Privacy read right for a teammate. - A reload while the host is offline gets the app shell (service worker) and the relay window's notice, not the relay's raw JSON; reopening a Crew whose window shows an error reloads it. - In the relay window a silent socket takes the dashboard offline and only a frame from the host brings it back; panels stay quiet on the relay's crew_not_connected answer. - Sign-out clears Team Crews and offers Sign in; a Crew not seen for two minutes reads offline. - Closing a chat someone else started asks first; a tab whose chat was closed elsewhere stays with a notice in a shared Crew. - New bot holds Create until it has a name; Bot chat card buttons scroll clear of the floating header; the Task Runner path is readable.
7e879b6 to
04e2887
Compare
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 14% chance that this change introduces a defect, above the 12% limit for approving on its own. I found no blocking issues, so I'm approving. Trust boundary. The two server-side changes are narrow and correct, and both have tests.
Data the server sends. Frontend. The owner-only screens use Socket changes. The new socket states only affect relay windows:
Tier: 2, held for a person: security-sensitive path. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
cruisercohen
left a comment
There was a problem hiding this comment.
Comment-only review with four non-blocking suggestions.
| // ── Disabled feature gate (mirrors InstancesPanel) ── | ||
| // Shared Crews open over the relay, not an SSH/SSM tunnel, so their card does | ||
| // not wait on this switch; it keeps its own hidden rule. | ||
| if (disabled && notOwner) { |
There was a problem hiding this comment.
This notice only shows when disabled is true, and disabled is only true for the instances_disabled code. That is what the relay answers. A teammate on Tailscale or SSM reaches the gateway instead, and _guard in handlers_instances_gate.py refuses them with owner_only before it checks instances.enabled. So they skip this branch and get the load error, not the notice. The new text in shared-crew.md says remote crew management shows the notice for teammates. Suggest gating on notOwner alone, ahead of both the disabled and the load-error branches, and adding a test with an owner_only 403. I found this by reading the code, not in a running app.
| // error body (JSON) and its typed reason header. Rendered as is, the window | ||
| // shows that body with no way back; the cached shell boots the SPA, whose | ||
| // offline view retries until the host returns. | ||
| if (e.request.mode === 'navigate' && !resp.ok && resp.headers && resp.headers.get('x-kiro-relay-error')) { |
There was a problem hiding this comment.
The comment above says this is for a Crew whose host is gone, but the check matches any non-empty x-kiro-relay-error. Electron's relayError() in relay-crew-window.js compares the value to crew_not_connected. With this check, a relay refusal of the viewer (an expired token, or access removed) boots the cached app instead of showing the relay's answer. No test covers that case. serviceWorkerRelayError.test.ts only tests crew_not_connected. Suggest matching only the host-gone reason here (crew_not_connected, plus crew_not_answering if you want it). If the wider match is on purpose, please update the comment and add a test for a relay 403 navigation.
| * alias does ask, the text still names any live work. | ||
| * | ||
| * In a shared Crew a close removes the chat for every person in it, so a chat | ||
| * another person started always asks, on every path, and names them. That |
There was a problem hiding this comment.
This says a chat another person started always asks, on every path. Only the single-chat closes pass viewerIds (useSessionActions.ts and useKeyboardShortcuts.ts). Folder cleanup (FolderCleanupPanel.tsx) and stale-session cleanup (sessionCleanup.tsx) also close chats through deleteSlot. They have their own confirm step, but it does not name the people whose chats they close. Suggest narrowing the comment to every single-chat close (sidebar, menus and Cmd+W), or listing other people's chats in the two cleanup confirms.
| /** A dashboard socket that the Kiro relay ended for a reason a reconnect cannot | ||
| * fix on its own: its token could not be renewed (`session_ended`), or the | ||
| * relay refused it with a code from its own block (`refused`). */ | ||
| export type OfflineCause = 'session_ended' | 'refused' | ||
| export type OfflineCause = 'session_ended' | 'refused' | 'remote_off' |
There was a problem hiding this comment.
The doc says every cause is one a reconnect cannot fix on its own. remote_off does not fit that. It is retried (isRelayRetrying in utils/offlineReason.ts only excludes refused and session_ended), and the reconnect works once the owner turns Remote Control back on. Suggest adding a remote_off line to the doc. Related: close code 4410 used to be classed refused and now waits and reconnects by itself. Please add a sentence to the PR body saying so, since it changes the earlier behaviour.
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Reviewed head 04e2887. In teammate_access.py, REMOTE_ACCESS_WRITES runs after the GET/HEAD early return, so a teammate can still read /api/remote-control but gets a 403 on PUT, POST or DELETE. The instances root is also new in _ADMISSION_CONFIG_ROOTS. Both go through the existing is_owner_only_for_teammates check, and parametrized tests cover relay, Tailscale and SSM for every write verb. viewer_ids is computed in memory, and each viewer sees only their own ids. The new frontend and Electron tests use fake or pinned clocks, and the sw.js test runs the real worker file. PR Readiness is green on this head.
Security: this PR adds two teammate refusals and widens nothing. Both fail closed at the existing teammate check, and the owner path and the read path are pinned by tests on both sides. The relay input this PR parses (the 503 reason and the x-kiro-relay-error header) only selects which notice or cached shell to show. It grants no access. The new close prompt only adds a confirmation step.
Done well: the close prompt now uses the server's list of the owner's ids. An owner who signs in under several ids is no longer taken for another person.
Optional:
- 4410 now maps to the retrying
remote_offstate. Theviewer-refused-controlscene inwebsite/scripts/capture-38100-offline-cover.mjsstill expects the red refusal notice, so please update it. With the scene updated, the harness can also render the remote_off screen, which the UX lane could not evaluate. That screen has no attached render yet, and neither do the Privacy shared wording, Secrets relay_unavailable, the stale Team Crews row or the Task Runner tooltip. - In
website/public/sw.js, the cached shell replaces any relay error response that carries the header. Consider limiting it to 503crew_not_connected, and add a test that a relay 401 or 403 passes through. - Two invariants have no test that fails when they break. One is the
mainFrameReported = falsereset inrelay-crew-window.js. The other is theviewerIdswiring at the two close-prompt call sites. You could add a test for each, or makeviewerIdsa required argument. TheProof:line also names an older head.
Problem / Motivation
Goal: A teammate in a Team Crew reached over the Kiro relay gets screens that work for them, honest offline states, and cannot shut everyone out by turning Remote Control off.
A real two-person Team Crew test over a pre-release Kiro relay (Amazon Linux 2023 host, two desktop-app viewers on a separate Ubuntu machine, every request crossing the relay) found, on the nightly with and without #38209:
{"reason":"crew_not_connected",…}JSON for good; choosing the Crew again only focused that window.sudo apt install espeak-ng), "your device" wording, a hostname shown as "Crew owner", and a silent/terminal.Why it matters
Team Crews are about to ship, and every teammate on every Team Crew meets these screens; one of them lets a single teammate take the Crew offline for the whole team until the owner reaches the host.
Not a goal
What changed (motivation → approach → change)
PUT /api/remote-controlis a teammate refusal (teammate_access.REMOTE_ACCESS_WRITES);instances.*joins the admission config roots, soPATCH /api/config/kirocrewrefuses a teammate with "only the Crew owner can manage remote crews". Reading the Remote Control state stays open.useViewerIsNotOwner): Secrets (both panels), Remote Control, remote crew management, Channels and a new/terminalroute show "Only the Crew's owner can …"; an owner refused by the relay's local-credential limit gets "only on the Crew's computer" instead. Connect your phone is not offered to a teammate. Voice drops the host install command, Computer Use shows a localized reason, Privacy says "the Crew's computer", People reads "Shared with your team" and names an owner known only by machine name "Crew owner"; the "cannot report work per person" line shows only for a failed reader (usage_off).crew_not_connected, which a service-worker-served navigation hides from the window's network hook.relay-crew-window.jsalso reports a 5xx main frame fromdid-navigate(one report per load),relay-crew-open.jsreloads a window showing an error when the Crew is chosen again, andsw.jsserves the cached shell for a navigation the relay answered withx-kiro-relay-error. Panels that read through the relay stay quiet oncrew_not_connected(utils/relayHostOffline) and read again on reconnect.noteHostSilent) instead of a plain replacement that reads as connected; the next socket counts only once it carries a frame (awaitsFirstFrame/noteFrame,HOST_FIRST_FRAME_MS). The same wait keeps a Remote Control off (4410) reason until the host answers.RELAY_CREW_RECONNECTING_FOR_MS).viewer_ids, every principal of the owner). In a shared (network) Crew a tab whose chat was closed outside it stays on "This chat was closed outside this window." with Start a new chat; closes this window made, conductor cascades included, land as before.docs/system-specs/modules/shared-crew.md(what a teammate may do,usage_off,viewer_ids); feature map row for the Terminal route.Backwards compatibility
Compatible: the owner's own dashboard, a direct or loopback gateway and a single-person Crew behave as today; the new refusals answer only a teammate (relay, Tailscale or SSM principal), with the existing
owner_onlycode.Reader: src/kiro_crew/shared_crew/teammate_access.py:is_owner_only_for_teammates -- crew page --
PUT /api/remote-controlnow refused for a teammate; owner passes | test_turning_remote_access_off_stays_the_ownersReader: website/src/pages/settings/RemoteControlCard.tsx:RemoteControlCard -- crew page -- a teammate sees the status line and the owner-only notice, no Turn off | RemoteControlCard.test.tsx
Reader: src/kiro_crew/dashboard/handlers/core_config_patch.py -- crew page --
instances.*refused for a teammate with its own message; owner and CLIkirocrew config setunaffected | test_a_teammate_cannot_patch_an_admission_keyReader: website/src/pages/settings/RemoteCrewPanel.tsx -- crew page -- a teammate gets the owner-only notice instead of Enable remote crew management | RemoteCrewPanel.sharedCrewsOff.test.tsx
Reader: website/src/components/mobileConnect.tsx:useMobileConnect -- crew page -- a teammate gets no Connect your phone row or guide step | App.shell.mobileConnect.test.tsx
Reader: website/src/pages/settings/SecretsPanelLegacy.tsx, SecretsPanel.tsx -- crew page -- a teammate gets the notice instead of Add secret and the authorize command | SecretsPanelLegacy.teammate.test.tsx, SecretsPanel.test.tsx
Reader: website/src/pages/settings/ChannelsPanel.tsx -- crew page -- a teammate reads status and gets the notice instead of the editable form | ChannelsPanel.test.tsx
Reader: website/src/pages/settings/PeoplePanel.tsx -- crew page -- the work-per-person line hides only when
usage_off| PeoplePanel.test.tsxReader: website/src/pages/chat/useChatPageSessionController.ts -- crew page -- in a shared Crew a tab keeps its place on a close made elsewhere; a personal Crew and this window's closes land as before | ChatPage.popoutClosedNotice.test.tsx
Tests
/api/remote-controlwrites andinstances.*, the per-key message, GET still open;viewer_idsfor the owner and a teammate;admission_usageraisesUsageOffand the People view setsusage_off.node --test): a 503 seen bydid-navigateraises one notice in either event order; reopening a window on an error page reloads it.nextOfflineCausetransitions; 4410 classification.crew_not_connected.Proof: PROVEN test/test_shared_crew_teammate_owner_access.py::test_turning_remote_access_off_stays_the_owners[ssm-PUT], test/test_shared_crew_teammate_owner_access.py::test_turning_remote_access_off_stays_the_owners[tailscale-PUT] (head 16f5090); the frontend and Electron halves: not provable -- frontend test (prove.py runs Python only)
Manual verification
On a real setup: host on Amazon Linux 2023 running this branch's gateway (nightly package with this branch's
kiro_crewoverlaid) with the relay leg on a pre-release relay; two teammates in desktop-app instances (this branch's Electron files in the app bundle) on a separate Ubuntu machine. Each finding was reproduced on the unpatched nightly first, then checked on this branch:PUT /api/remote-control→ 403owner_only;PATCH instances.enabled→ 403; GET → 200; no Turn off or Enable button.iptablesdrop of the host's relay traffic for 105 s with both pages idle: both show "Reconnecting…" by 40 s; both connected again 40 s after the rule is removed, no stale banners./terminal, Task Runner path and New bot empty name read as described above.Screenshots / video
Teammate, Settings › Remote Crew — before / after:
Reload while the host is off the relay — before / after:
Remote Control off → reload → unavailable notice → host back → reopen (frames from the relay window, sidebar cropped, author line blurred):
Closing a chat another person started (their email blurred):
More after shots
Teammate screens on the real setup (emails and host name blurred):
Related Issues
Follows #38209 (teammate owner parity) and #38103 (calm offline state).
Sibling sweep
Swept: git grep -nE "useViewerIsNotOwner|owner_only|relay_local_credential" -- website/src src/kiro_crew/shared_crew
Sibling: website/src/pages/members/MembersPage.tsx -- not affected -- already holds Import for a non-owner through the same hook
Sibling: website/src/pages/settings/TailscaleInvites.tsx -- not affected -- its own owner read already hides invite management
Swept: git grep -nE "onDead: forceReconnect|forceReconnect(" -- website/src/hooks
Sibling: website/src/hooks/useDashboardHealthProbe.ts -- not affected -- it runs only while the dashboard is already offline
Pattern harvest
Rule candidate: review-prompt
Pattern: an owner-only control rendered for a shared-Crew teammate (a button whose route
is_owner_only_for_teammatesrefuses) instead of an "Only the Crew's owner can …" noticeChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.