Skip to content

fix(shared-crew): let a relay teammate see a team Crew's Bots - #34334

Merged
bolichen97 merged 1 commit into
mainfrom
feat/relay-teammate-bots-read
Nov 10, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
feat/relay-teammate-bots-read

Conversation

@tim-finnigan

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

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A teammate who opens a team Crew through the Kiro relay sees that Crew's Bots instead of "Could not load your bots."

GET /api/members is owner-only: members_roster.api_members calls require_owner_dashboard_request(request, "members.list.read"), and a relay teammate's relay:<Kiro user ID> subject never matches the owner, so the Bots page shows its load-failure notice.

Why it matters

Team Crews exist so a team can use one Crew's Bots. Today a teammate cannot even see which Bots there are, and the page reports it as a failure with a retry that can never succeed.

Not a goal

What changed (motivation → approach → change)

Before writing code, three questions:

1. Does #29609 already cover relay teammates? No. #29609 allow-lists /api/members for is_guest_session, which ends in collaborators.is_collaborator_actor. That requires the actor's provenance to be in _MEMBER_PROVENANCES = {TAILSCALE_SERVE, TAILSCALE_LISTENER, SSM_INVITE} (src/kiro_crew/shared_crew/collaborators.py:36, which #29609 does not change). A relay teammate's principal comes from identity.relay_principal, which stamps provenance=Provenance.KIRO_RELAY (src/kiro_crew/shared_crew/identity.py:217). So is_guest_session is false for every relay caller, and the two PRs do not overlap.

2. Which roster fields are owner-private, and what does the Bots tab need? Owner-private: slot_key and running (the owner's DM slot), last_message, last_message_stopped, has_dm_message, has_user_dm_message (the owner's DM history), projections and last_active_ts (the owner's member log), has_goal, heartbeat_on, welcome_owed, welcome_claimed, starred, star_order, and the local setup (workspace, memory_store, memory_version, memory_owner, kiro_agent, model, reasoning_effort, worker_model, worker_reasoning_effort, approval_mode, dynamic_capabilities, dashboard_card_send, triggers). To render a row the page needs name, slug, display_name, avatar, plus description, source and dashboard_created for the label and the listing rule (rosterFilter.listedByDefault).

3. What would "use" need? Listed under Follow-up for Bolin. None is opened here.

The change follows the pattern that let a relay teammate read People, sessions and mode (#32953): api_members asks routes_identity._relay_teammate (the ingress-published relay caller plus a kiro_relay human principal) before the owner gate, and a teammate gets members_roster._teammate_roster. That builds rows from the config alone with the seven fields above, masked as the owner's row masks them, and touches no binding, transcript or member log, so the owner read's reconcile writes never run for a teammate. A teammate's read leaves an allowed SEL row like the owner's, filed under the relay caller's relay:<Kiro user ID> label with resources=relay_teammate (members_access._audit_teammate_read). Both new helpers are listed on the handlers/members.py facade, as every roster helper is. It lists only Bots a person created here (dashboard_created); the other config rows reach the owner's list only through the owner's DM history. Because the check runs before the owner gate and returns false for the owner, the owner's response is unchanged.

On the page, a thread open that comes back 403 owner_only now says "Only this bot's owner can chat with it." with no retry, the way the Dashboard tab already words its owner-only refusal (MembersPageThread.tsx, an ownerOnly flag on the thread outcome in membersQuery.ts, and the new thread_owner_only string in every catalog with its en.context.json note). Every member write stays owner-only.

Backwards compatibility

Compatible: the owner's response is byte-identical (pinned by a test), a non-relay non-owner still gets 403 owner_only, and the only new answer is a 200 to a caller that got 403 before.

Removes nothing: the owner's roster and every member write keep their shape and gate; a teammate's narrower row is new.

Tests

  • test/test_members_roster_relay_teammate.py, over the real relay ingress, client-sent strip and token auth: a teammate's read writes one allowed members.list.read SEL row under relay:<id>; a relay teammate gets 200 with each owner-private field absent by name and only the person-created Bot listed; the owner's bytes match a run with the teammate branch switched off and still carry slot_key, running, last_message, projections, workspace, model; a non-owner token with a forged relay header is refused owner_only; a teammate's POST /api/members/{slug}/thread and /fresh-start are refused owner_only.
  • MembersPage.test.tsx: a teammate-shaped roster renders, a thread owner_only refusal shows the owner-only line, never "Could not load your bots" or "Could not open this bot's chat". Fails with MembersPageThread.tsx reverted (checked by hand; prove.py runs Python only).
  • Determinism: the backend file passed 3 forward and 3 reversed-order runs; the frontend tests passed under --sequence.shuffle with two seeds.

Proof: PROVEN test/test_members_roster_relay_teammate.py::test_a_relay_teammate_reads_the_bots_without_the_owners_view, test/test_members_roster_relay_teammate.py::test_a_relay_teammates_read_is_audited_under_their_relay_label (head 2923dbc)

Local: isort, flake8, mypy on the changed module, tsc -p tsconfig.app.json, eslint on the changed files, 752 members and shared-crew backend tests, 776 spec and doc tests, 66 frontend files under src/pages/members, src/i18n and the dock. The full local gate selected 1,259 backend files (1,244 cross-surface) and ran on one xdist worker for lack of memory, so I stopped it; CI runs that set.

Manual verification

Captured the real MembersPage gateway-free with the roster stubbed to teammate rows and every per-Bot route answering 403 owner_only, in both themes.

Screenshots / video

Relay teammate, dark: the chat column says who may chat, and the Dashboard tab keeps its existing owner-only line.

teammate dark

The Bots list a teammate now gets, in the switcher:

teammate list dark

teammate list light

teammate light

Related Issues

Closes #34327

Sibling sweep

Swept: git grep -n "require_owner_dashboard_request" -- src/kiro_crew/dashboard/handlers/members*.py src/kiro_crew/dashboard/handlers/member_goals.py
Sibling: src/kiro_crew/dashboard/handlers/members_thread.py -- not affected -- a write that spends on the owner's account, kept owner-only by design
Sibling: src/kiro_crew/dashboard/handlers/members_thread_turns.py -- not affected -- greet and fresh start are writes, kept owner-only
Sibling: src/kiro_crew/dashboard/handlers/member_goals.py -- not affected -- the Goals tab is a per-Bot owner view, out of this PR's goal
Sibling: website/src/pages/members/CrewDynamicDashboard.tsx -- not affected -- already words its owner_only refusal plainly

Pattern harvest

Not generalizable: the narrowed row is specific to what the roster's owner view holds, and the relay-teammate admission already has one shared predicate (routes_identity._relay_teammate).

Follow-up for Bolin (use, not in this PR)

Each of these runs or wakes a Bot on the owner's account, and stays as it is here:

  • POST /api/members/{slug}/thread (open the DM): owner-only (members_thread.py:170); refused for a relay teammate, pinned by a test here.
  • POST /api/chat (send into the DM slot): open to a relay teammate today, on main as well as here. Probed through the relay ingress, strip and token auth in front of the chat handlers: a teammate's send to an existing member slot (member-<slug>, derivable from the slug this roster now shows) passed every gate and was dispatched as a turn; an empty message reached the handler's own message_required 400. Route wrappers that only the full gateway installs were not in the probe. This PR does not change it, and it now matters more, so it needs a decision before teammates use this list.
  • POST /api/members/{slug}/greet and /fresh-start: owner-only (members_thread_turns.py:47, :133); fresh start refused for a teammate, pinned by a test here.
  • POST /api/spawn (run a Bot as a worker): owner-only for a dashboard user (messaging_api/spawn.py:346).
  • The Bots switcher still offers New bot and Import from file to a teammate (second screenshot); both are owner writes and are not reworded here.
  • Goals and heartbeat schedules (/api/members/{slug}/goals*, the wake schedule): owner-only through member_goals._owner_member (member_goals.py:146).

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

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the teammate branch reuses the existing relay-teammate check, returns a separate config-only row, and leaves the owner's path and every member write untouched.

Notes

  • The description says POST /api/chat is open to a relay teammate on main. That spends on the owner's account and contradicts the "use stays owner-only" premise, so it needs its own issue soon rather than a follow-up bullet.

[DESIGN-REVIEWED] 2923dbc

Description read

[DESCRIPTION-READ] 118765c671f348506a7e0ed83e8ccd47c6850100d18f2c72867d4c38a215dbae

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 2923dbca5d519bc292a85460537e27140a1b443c — 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 fix gives the relay-teammate read the same admission that People, sessions and mode already use, and every other item is part of removing the reported "Could not load your bots" failure (#34327).

What this change ships

Inventory (8 items) — 8 justified

Intent: a teammate who reaches a team Crew through the Kiro relay can see its Bots instead of a load failure. FIX.

  1. A relay teammate's GET /api/members now answers 200 with person-created Bots only — justified
  2. A teammate's row holds identity fields only: no slot, DM line, projections, settings — justified
  3. Bots that were not created through the dashboard (package specs, default) are left out of the teammate's list — justified
  4. A teammate's roster read leaves an allowed SEL row under relay:<id> — justified
  5. A teammate opening a Bot's chat sees "Only this bot's owner can chat with it.", with no retry — justified
  6. New thread_owner_only string in every locale catalog, plus its context note — justified
  7. Two new helpers are listed on the members.py facade's TYPE_CHECKING block (its documented contract) — justified
  8. The shared-crew and member-event-log specs now record the teammate read — justified

[FIRST-PRINCIPLES-REVIEWED] 2923dbc

Description read

[DESCRIPTION-READ] 0dfce11b9b7f740ab6fb98e401ac5a3c66b3f40e7b3ed431d31bbe2bb9f14070

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing blocks. The blind reader read the new chat notice correctly ("a warning that I can't talk to this bot"), and the screenshots show the teammate's Bots list in both themes.

Notes

  • The thread_owner_only context note says "Calm, not an error", but ErrorNotice variant="inline" draws it as red text with a warning triangle. The reader also saw it as a different thing from the Dashboard tab's boxed refusal: "same kind of message, so I can't tell why they look different". Use the muted look the Dashboard owner notice uses.
  • "Only this bot's owner can chat with it." doesn't say who the owner is. The reader asked "who the owner is… how to get access". Name the owner, for example "Only {kirodotdev} can chat with this bot", if that name is available where the notice renders.

[UX-REVIEWED] 2923dbc

Description read

[DESCRIPTION-READ] e86e281a175949eaa64de05879040fa0376ac2f926738bdb001466af90149bb1

That sha256 names everything this verdict read: the PR description, plus the 7 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 10, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 2923dbc

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

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

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 2923dbca5d519bc292a85460537e27140a1b443c and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2923dbc

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

@tim-finnigan
tim-finnigan force-pushed the feat/relay-teammate-bots-read branch 2 times, most recently from b216b27 to e8fa340 Compare November 10, 2026 06:28
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 10, 2026
@tim-finnigan
tim-finnigan force-pushed the feat/relay-teammate-bots-read branch from e8fa340 to ca8f07f Compare November 10, 2026 07:04
@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 10, 2026
@tim-finnigan

Copy link
Copy Markdown
Contributor Author
  • fixed span=86cee9f237b1

fixed in ca8f07f: the teammate branch now writes an allowed members.list.read SEL row before it returns, filed under the relay caller's relay:<Kiro user ID> audit label with resources=relay_teammate (members_access._audit_teammate_read, same call shape as _audit_owner_read).
test_a_relay_teammates_read_is_audited_under_their_relay_label pins the exact row and fails with the call removed.
self-added: yes
mechanism: SEL allowed row on the relay-teammate roster read

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 10, 2026
@tim-finnigan
tim-finnigan force-pushed the feat/relay-teammate-bots-read branch from ca8f07f to 2923dbc Compare November 10, 2026 07:36
@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 10, 2026
@tim-finnigan
tim-finnigan marked this pull request as ready for review November 10, 2026 08:03
@tim-finnigan
tim-finnigan requested review from a team and KiroCrewCaptain as code owners November 10, 2026 08:03
@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 10, 2026

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

Read the whole diff at 2923dbc (23 files), tests included. Approving.

What I checked:

  • GET /api/members now answers a relay teammate that the Kiro relay verified (_relay_teammate, already on main for the People, sessions and mode reads) with a narrow roster. This loosens a read that was a 403 for them. It adds no new refusal.
  • The branch sits after the app-caller guard and before the owner gate, so the owner's read is unchanged. A test compares the owner's response with the teammate branch forced off, and the bytes match.
  • _teammate_roster reads the config only. It lists person-created Bots only, and each row holds name, slug, display name, description, avatar, source and dashboard_created, with the display name and description masked as the owner's row masks them. A test lists 27 owner-private fields (slot, last DM line, projections, workspace, model, star order and so on) and checks none is present, and that the workspace value never appears in the body. Nothing is written, so the owner read's reconcile never runs.
  • Any other non-owner still gets 403 owner_only, and the thread and fresh-start writes stay owner-only for the teammate. Tests cover both.
  • The granted read is audited under the relay caller's own label.
  • The Bots page words the thread open's owner_only refusal as who may chat, with no retry. The new string is in all 13 locales and the translator context file.
  • No regex added. 102 checks pass and none is red or pending. Five more show cancelled, and each has a later success on this head (Issue Gate, PR Hygiene, PR Policy, GPT 6.1 Review, Sensitive Change Review).

@bolichen97
bolichen97 merged commit 40f555e into main Nov 10, 2026
102 of 108 checks passed
@bolichen97
bolichen97 deleted the feat/relay-teammate-bots-read branch November 10, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] A relay teammate gets 403 from GET /api/members, so the Bots page says it could not load

2 participants