Skip to content

fix: make Team Crew screens work for teammates over the relay - #38437

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/teammate-relay-screens
Nov 17, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/teammate-relay-screens

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Any teammate could press Settings › Remote Crew › Turn off: no confirmation, the relay stopped for everyone, and only the host machine can turn it back on.
  • A reload while the host was off the relay left the window on the relay's raw {"reason":"crew_not_connected",…} JSON for good; choosing the Crew again only focused that window.
  • When the host's network dropped silently, both windows kept saying "Gateway connected" for minutes while panels failed with "Could not read the KAS engine status · Ask the agent".
  • Teammates were offered owner-only controls that the server then refused (Secrets' Add secret, Remote Control's Turn off, Enable remote crew management, channel forms, Connect your phone), host-admin instructions (sudo apt install espeak-ng), "your device" wording, a hostname shown as "Crew owner", and a silent /terminal.
  • After sign-out Team Crews still listed Crews as online, then offered "Ask the agent" instead of Sign in; a Crew whose host left read "reconnecting" forever.
  • Closing a chat someone else started asked nothing, and the person viewing it was silently moved into another chat.
  • New bot accepted an empty name; Bot chat card buttons sat under the floating header; the Task Runner workspace path was clipped with no full-path tooltip.

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

  • Changing what a teammate may do beyond the 2026-11-01 decision: everything stays the teammate's except the Terminal, credentials that outlive access, and managing who may reach the Crew (Remote Control off and remote crew management are in that last group).
  • Any relay or control-plane change; the relay's own close codes and answers are taken as they are.
  • Roles, or a per-teammate permission UI.
  • The idle relay page that makes no request and whose socket has not yet gone silent: it learns of a dropped host from the socket's silence window, not sooner.

What changed (motivation → approach → change)

  • Remote Control and remote crew management stay the owner's. PUT /api/remote-control is a teammate refusal (teammate_access.REMOTE_ACCESS_WRITES); instances.* joins the admission config roots, so PATCH /api/config/kirocrew refuses a teammate with "only the Crew owner can manage remote crews". Reading the Remote Control state stays open.
  • Owner-only screens say so (useViewerIsNotOwner): Secrets (both panels), Remote Control, remote crew management, Channels and a new /terminal route 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).
  • Host offline. The relay answers a reload with 503 crew_not_connected, which a service-worker-served navigation hides from the window's network hook. relay-crew-window.js also reports a 5xx main frame from did-navigate (one report per load), relay-crew-open.js reloads a window showing an error when the Crew is chosen again, and sw.js serves the cached shell for a navigation the relay answered with x-kiro-relay-error. Panels that read through the relay stay quiet on crew_not_connected (utils/relayHostOffline) and read again on reconnect.
  • Silent host. The relay keeps the page's socket open and accepts the next upgrade without the host, so in the relay window the existing silence watchdog now takes the dashboard offline (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.
  • Team Crews. Sign-out resets the list and the signed-out state offers Sign in; a row not connected and last seen over two minutes ago reads offline (RELAY_CREW_RECONNECTING_FOR_MS).
  • Shared chats. Closing a chat another person started always asks, naming them; who "another person" is uses the server's identity rule (the mode response's 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.
  • Bots and Task Runner. Create bot is held while the name is empty; the Bot chat scroller pads for the floating header and dock so a focused card button lands clear of them; the workspace field grows and its tooltip leads with the full path.
  • Spec: 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_only code.

Reader: src/kiro_crew/shared_crew/teammate_access.py:is_owner_only_for_teammates -- crew page -- PUT /api/remote-control now refused for a teammate; owner passes | test_turning_remote_access_off_stays_the_owners
Reader: 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 CLI kirocrew config set unaffected | test_a_teammate_cannot_patch_an_admission_key
Reader: 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.tsx
Reader: 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

  • Backend: teammate refusals for /api/remote-control writes and instances.*, the per-key message, GET still open; viewer_ids for the owner and a teammate; admission_usage raises UsageOff and the People view sets usage_off.
  • Electron (node --test): a 503 seen by did-navigate raises one notice in either event order; reopening a window on an error page reloads it.
  • Service worker: a relay 503 navigation gets the cached shell; no cached shell keeps the relay answer; the Crew's own 404/200 are untouched.
  • Socket: in the relay window a silent socket goes offline and the next one counts only after a frame; a frameless reopen is dropped; Remote Control off survives an accepted-then-4404 socket; nextOfflineCause transitions; 4410 classification.
  • Screens: teammate vs owner rendering for every screen above; Team Crews sign-in state and the two-minute offline rule; close prompt with the owner's several ids; closed-elsewhere notice in a shared Crew, personal-Crew landing and the conductor cascade; New bot empty name; scroll padding; InstanceTabBar stays quiet on 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_crew overlaid) 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:

  • Teammate PUT /api/remote-control → 403 owner_only; PATCH instances.enabled → 403; GET → 200; no Turn off or Enable button.
  • Remote Control off, teammate reloads: app shell and "Reconnecting…", then the "currently unavailable" notice; Team Crews reads "offline · last seen 3m ago"; host back: Check again and choosing the Crew again both reopen it.
  • iptables drop 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.
  • Sign-out: Crew window closes, Team Crews offers "Sign in to Kiro".
  • B closes A's chat: B is asked, naming A; A stays on the closed notice; B closing B's own chat asks nothing.
  • Secrets, Voice, People, Computer Use, Channels, Privacy, /terminal, Task Runner path and New bot empty name read as described above.
  • Not seen on the real relay: the 4410 "Remote access is off" wording. Turning Remote Control off reached the viewers as the host-gone close and the window's notice, so that path is covered by unit tests only.

Screenshots / video

Teammate, Settings › Remote Crew — before / after:

Before: Turn off offered to a teammate
After: owner-only notice

Reload while the host is off the relay — before / after:

Before: the relay's raw JSON
After: the app's reconnecting view

Remote Control off → reload → unavailable notice → host back → reopen (frames from the relay window, sidebar cropped, author line blurred):

Offline to recovery

Closing a chat another person started (their email blurred):

Close confirmation naming who started the chat

More after shots

Unavailable notice
Chat closed elsewhere
Secrets for a teammate
Terminal for a teammate
Channels for a teammate

Teammate screens on the real setup (emails and host name blurred):

Team Crews after sign-out: Sign in to Kiro
People: Shared with your team, owner named Crew owner
Voice without the host install command
Computer Use on Linux
New bot holds Create until it has a name
Task Runner shows the full workspace path

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_teammates refuses) instead of an "Only the Crew's owner can …" notice

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

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 17, 2026 12:58
@bolichen97
bolichen97 requested a review from CrysisDeu November 17, 2026 12:58
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design-level problem blocks this. The new teammate refusals use the existing is_owner_only_for_teammates and admission-root seams, and the owner path is unchanged.

Notes

  • One PR carries about nine unrelated fixes (Bot name validation, Task Runner tooltip, chat dock padding next to relay refusals). Bisecting or reverting one of them means reverting all of them, so split the non-relay UI fixes out next time.
  • sw.js now serves the cached shell for any navigation the relay answered with x-kiro-relay-error. That makes the window's offline state depend on did-navigate and the socket watchdog, so keep the Electron 503 test as the pin for that link.

[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 .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 17, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

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

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

  • RelayReconnectingView with offlineCause === 'remote_off' ("Remote access to this Crew is off" / "The Crew's owner turned off remote access…" / "This page reconnects by itself once it's back on."). This is what a teammate sees when the owner turns Remote Control off, which is the PR's headline case. Shot-04 shows only the generic "Reconnecting…" copy. Fix: attach a screenshot of a teammate window after the owner turns Remote Control off.
  • Privacy disclosure in a shared Crew (localDataTitleShared "Stays on the Crew's computer" and the localDataBody*Shared lines). No supplied image shows it. Fix: attach a Settings › Privacy screenshot from a teammate.
  • Secrets relay_unavailable ("Secrets can be seen and changed only on the Crew's computer, not through Remote Control."). Shot-09 shows only the teammate notice, not what an owner sees over the relay. Fix: attach a screenshot of the owner reaching Secrets over the relay.
  • Team Crews row that turns offline (RELAY_CREW_RECONNECTING_FOR_MS). Shot-12 shows only the signed-out list. Fix: attach a screenshot of a Team Crews row whose host left more than two minutes ago.
  • Task Runner workspace tooltip that leads with the full path. Shot-17 shows the field but not the tooltip. Fix: attach a screenshot of the tooltip on hover.

Notes

  • Shots 01 and 02 use "Remote Crew", "Remote Control" and "Kiro relay" side by side. The blind reader could not tell the first two apart and did not know what "Kiro relay" means. Fix: change on_teammate to "Remote Control is on. People with access can reach this Crew from their own devices."
  • Shot-05/08 "This chat was closed outside this window." offers only "Start a new chat". The reader asked for "a way to reopen the old chat", and the shot-06 close dialog says you can reopen the session later. Fix: add a "Reopen chat" action next to it.

[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 .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 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 04e28874e6b292a195abcbc8f022e5273be3fd95 — 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

Every item answers a defect from the two-person relay test in the description. Remote Control off and instances.* belong to the base spec's "managing who may reach the Crew" owner-only group. One reversed pin is only partly declared.

Notes

  • Item 6 — undeclared: the diff reverses the pin "the host turning access off (4410) … stay refusals" (classifyClose(4410) changes from 'refused' to 'remote_off', and isRelayRetrying now retries it). The description only says "The same wait keeps a Remote Control off (4410) reason until the host answers". It never says 4410 stops being a refusal and now reconnects on its own. Subtraction: keep 4410 as 'refused' and drop the remote_off cause, its retry and its cover, unless the field test showed teammates stuck on the refusal.

What this change ships

Inventory (10 items) — 9 justified

Intent: 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.

  1. A teammate can no longer turn Remote Control off or manage remote crews (403 owner_only) — justified
  2. Owner-only screens (Secrets, Channels, Remote Control, remote crews, Terminal) show an "only the owner" notice instead of controls — justified
  3. Reloading while the host is off the relay recovers instead of leaving the relay's raw JSON page — justified
  4. A host that goes silent now shows offline; the next socket counts as connected only after its first frame — justified
  5. Panels stay quiet on crew_not_connected and read again on reconnect — justified
  6. Remote Control off (4410) is no longer a refusal; the window waits and reconnects on its own — undeclared
  7. After sign-out Team Crews offer Sign in; a row not seen for 2 minutes reads offline — justified
  8. Closing a chat someone else started asks first; a shared-Crew tab stays on "closed outside this window" — justified
  9. Wording fixes: host-machine phrasing, "Crew owner", Voice install command dropped, People's usage_off line — justified
  10. New bot needs a name; Bot chat card buttons sit clear of the header; Task Runner path tooltip — justified

[FIRST-PRINCIPLES-REVIEWED] 04e2887

Description read

[DESCRIPTION-READ] fa88ccaad2e2efc39c38e47058783904fd137948b24ae01ef22f694c512e5614

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 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 04e2887

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

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

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 04e28874e6b292a195abcbc8f022e5273be3fd95 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 04e2887

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

@bolichen97
bolichen97 force-pushed the fix/teammate-relay-screens branch 2 times, most recently from c29cf17 to a0ae305 Compare November 17, 2026 13:08
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=1f9a49b97513 Relay-refused Secrets reads bypass ErrorNotice

fixed in a0ae305

The relay's relay_local_credential refusal of the Secrets list now renders through ErrorNotice with the read's report (secretsOwnerOnly.tsx), with noHandoffReason because the relay never carries the vault, so the agent cannot change the refusal. The teammate notice stays a StatusNotice: it is a capability notice from the owner check, not a failed read. Class sweep: the other owner-only notices this PR adds (Remote Control, remote crew management, Channels, /terminal) all come from useViewerIsNotOwner, none from a refusal.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=1f9a49b97513 Relay vault refusal suppresses a runnable agent hand-off

fixed in 8782b93

The relay refusal notice now passes askAgent: the agent still runs for an owner on Remote Control, so the hand-off is offered; the vault restriction is unchanged.

@bolichen97
bolichen97 force-pushed the fix/teammate-relay-screens branch from a0ae305 to 8782b93 Compare November 17, 2026 13:25
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=20079bead3ef Platform guidance incorrectly rules out supported Windows hosts

fixed in 8782b93

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.

@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 17, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=c83856e7d2ab Reset the owner-check mock between tests

fixed in 5dcb456

The file's beforeEach now resets api.viewerOwnerOk and seeds the owner answer; only the teammate case overrides it. Ran the file shuffled with two seeds: 74/74 both times. The other owner-check mocks in this PR's tests are vi.spyOn calls restored in their files' afterEach.

@bolichen97
bolichen97 force-pushed the fix/teammate-relay-screens branch from 8782b93 to 5dcb456 Compare November 17, 2026 17:54
@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
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=39487d6b17d0 Signed-out relay list hides a runnable agent hand-off

fixed in cb85d7f

The signed-out list keeps Sign in to Kiro as its first action and now keeps the ErrorNoticeMenuItem hand-off after it, so a backend that does not run on the Kiro sign-in can still take it; noHandoffReason is gone. The test pins both items and their order.

@bolichen97
bolichen97 force-pushed the fix/teammate-relay-screens branch from 5dcb456 to cb85d7f Compare November 17, 2026 18:05
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=5d3b8482bc8d Teammate channel views suppress status-read failures

fixed in 7e879b6

For a teammate the selected channel now shows its failed status read as an ErrorNotice (title "Status unavailable", the read's message and report, askAgent) above the owner-only notice; the connection form stays hidden. New test: a failed Telegram status read renders the error with Ask the agent beside the owner-only notice.

@bolichen97
bolichen97 force-pushed the fix/teammate-relay-screens branch from cb85d7f to 7e879b6 Compare November 17, 2026 18:16
@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention labels Nov 17, 2026
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.
@bolichen97
bolichen97 force-pushed the fix/teammate-relay-screens branch from 7e879b6 to 04e2887 Compare November 17, 2026 19:57
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 17, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: 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.

  • REMOTE_ACCESS_WRITES adds PUT /api/remote-control to the routes a teammate is refused. The handler already requires the owner gate, so the owner and GET reads behave as before.
  • Adding instances to the admission config roots closes the one remaining path for a teammate to manage remote crews. The /api/instances* routes were already refused through remote_route_limit.

Data the server sends. viewer_ids uses the existing owner.viewer_ids helper, so a teammate sees only their own id. usage_off tells "the Crew doesn't count usage" apart from "the usage reader failed".

Frontend. The owner-only screens use useViewerIsNotOwner. Until the owner check answers they show the normal controls, which is acceptable because the server still enforces every refusal.

Socket changes. The new socket states only affect relay windows:

  • The "wait for the first frame" state is set only by noteHostSilent (relay window only) or by a 4410 close (relay only).
  • noteFrame and the 15 s first-frame timer always clear or re-trigger that

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 04e28874e6 · 2402 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@cruisercohen cruisercohen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread website/public/sw.js
// 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')) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines 20 to +23
/** 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'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
KiroCrewCaptain merged commit a1ac53e into main Nov 17, 2026
101 of 104 checks passed

@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.

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_off state. The viewer-refused-control scene in website/scripts/capture-38100-offline-cover.mjs still 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 503 crew_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 = false reset in relay-crew-window.js. The other is the viewerIds wiring at the two close-prompt call sites. You could add a test for each, or make viewerIds a required argument. The Proof: line also names an older head.

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.

3 participants