Skip to content

feat(crew-mode): the Crew panel routes answer a crewmate thread as a root - #28869

Merged
chenmingwei23 merged 1 commit into
mainfrom
feat/mate-root-crew-routes
Nov 3, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
feat/mate-root-crew-routes

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The Crew panel's routes answer a crewmate (mate) thread as a root, so a mate's sessions can be listed, steered, approved and drawn on the timeline the way a Crew Mode conductor's are.

#26952 stamps mate_root / mate_dispatched_by on every session a mate thread dispatched, but nothing reads them. The four Crew panel routes (GET .../crew-workers, GET .../crew-timeline, POST .../crew-workers/{w}/steer, POST .../crew-workers/{w}/approve) answer only a Crew Mode root, so a mate thread gets 404 not_crew_mode_root.

Why it matters

This is migration step 3 of the crewmate workers RFC (#26643). The mate Profile card's Sessions tab (step 4) and approvals in the mate chat (step 5) both read these routes.

Not a goal

  • Any UI: the Sessions tab and the mate chat's approval cards are later PRs.
  • Hiding anything from the sidebar or any list (step 6, behind a flag).
  • Opting any other crew_root consumer in for mates.
  • A normal chat-* slot running as a mate (RFC: out of scope).

What changed (motivation → approach → change)

Goal → reuse the Crew panel's code with the root kind decided by the slot frame's own stamps, so a mate's sessions are read by mate_root and no crew_root rule fires for them → this change in dashboard/handlers/crew_workers.py:

  • A root is a Crew Mode root (stamped crew_mode_root) or a mate thread (slot mode member that the same stamp_rows pass recorded in known_mate_roots). A mate's worker is not a root.
  • Its live sessions are the rows stamped crew_root or mate_root for it; closed ones come from the session tree as before. A closed mate thread this gateway saw is answered from saved data, like a closed Crew Mode root.
  • All four routes use that one test, so steer and approve refuse a session outside the named root's own tree whatever the root's kind (not_a_worker). The owner-only, app-token-refused gate is untouched.
  • The list answer for a mate adds root_kind: "mate" and takes dispatched_by from mate_dispatched_by. A Crew Mode root's answer is byte-for-byte what it was.
  • A steer into a mate's session is not counted in the Crew Mode steer metric.
  • src/kiro_crew/crew_mode.py: mate_workers_of beside workers_of, and the mate_root comment says who reads it now. The crew-mode system spec gains a row.

The RFC this implements is draft on main. It was merged in #26643 and the owner chose this path in #27837.

Backwards compatibility

Compatible: a Crew Mode root's four routes return the same rows and codes; a mate thread that got 404 now gets an answer. The 404 message names both kinds of root; its code is unchanged.

Removes nothing: the diff only widens which root key the routes accept; no row, field, key or function is hidden, removed or renamed.

Tests

test/test_crew_workers_mate_root.py:

  • a mate thread's list is its child and grandchild, with groups, ledger line and dispatcher; root_kind is mate;

  • a Crew Mode root's answer has no root_kind and the same rows;

  • a mate's worker, a plain chat, and a member-mode row with a creator are refused as roots;

  • a closed mate thread's list is read from saved data;

  • the timeline draws the mate and its sessions;

  • steer reaches a mate's worker and records no Crew Mode steer metric; a session outside the mate's tree, and a mate worker named under a Crew Mode root, are refused;

  • every route keeps the owner gate for a mate root;

  • approve, through the real per-slot approve route: the owner decides a mate worker's request once; an app token cannot; another mate cannot approve this mate's worker; a mate's worker is no root to approve through.

  • a steer under a root that is no mate is still counted in the Crew Mode metric; a mate's is not.

Existing Crew Mode route, steer, timeline and mate-stamp suites pass unchanged. Local GPT and Opus reviews: no blocking findings.

Proof: not provable -- other: new feature, not a fix; no production hunk to revert against a failing test.

Manual verification

N/A — unit coverage sufficient: the routes are exercised end to end in tests, with no UI reading them yet.

Related Issues

Part of #28859

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

Contributed under the project's Apache-2.0 license.

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners November 3, 2026 05:35
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 19f1d0b642dc79cf5ffc321e1df879a243a4a2fa touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design-level concerns: the four routes now share one root test, which widens what they accept without changing what a Crew Mode root gets back.

Notes

  • _tree_workers falls back from workers_of to mate_workers_of when the first returns nothing, so whether a root is "crew" or "mate" is re-guessed from the rows on each call. _live_root already knows the kind. Passing that kind into _tree_workers would avoid the two disagreeing if known_mate_roots and the stamps ever get out of step.
  • person_steer works out is_mate again with its own expression instead of reusing _live_root/_closed_root_kind. Use the shared helper so the steer metric and the routes can't classify the same root differently.

[DESIGN-REVIEWED] 19f1d0b

Description read

[DESCRIPTION-READ] 5ea446a1a9e103a8bf43a4bc4ff4218b00eb6452257c33f8ccb2fd9b3195abf0

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 3, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 19f1d0b642dc79cf5ffc321e1df879a243a4a2fa — 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

The new root_kind: "mate" field has no reader. The route widening, the tree test and the metric exclusion each answer a named harm, so nothing blocks.

Notes

  • Item 3 — zero consumers: out["root_kind"] = ROOT_KIND_MATE has 0 readers in website/ or src/ outside tests (searched for root_kind). The future Sessions tab already knows it is on a mate's card, because it calls the route with the mate's key. Subtraction: delete the root_kind key from the list answer and the if kind == ROOT_KIND_MATE branch that sets it.
  • Item 1 — undeclared provenance: the description says the RFC "is draft on main" (base list: rfc-crewmate-workers-under-the-crewmate.md:status: draft). This passes only because the routes add a capability next to the existing one and change no default or visible surface. When steps 4 and 5 put this in front of users, they will need a recorded decision.

What this change ships

Inventory (6 items) — 4 justified

Intent: let a person list, steer, approve and timeline a crewmate thread's dispatched sessions the way they already can for a Crew Mode conductor. This is an ADDITION.

  1. The four Crew panel routes answer a mate thread, live or closed, instead of returning 404 — justified
  2. Steer and approve refuse a session outside the named root's own tree, whatever the root's kind — justified
  3. The list answer for a mate names root_kind: "mate" — zero consumers
  4. A mate worker's dispatched_by comes from mate_dispatched_by — justified
  5. Steers into a mate's sessions are no longer counted in the Crew Mode steer metric — justified
  6. The 404 message now names both kinds of root; its code is unchanged — justified

[FIRST-PRINCIPLES-REVIEWED] 19f1d0b

Description read

[DESCRIPTION-READ] 8e99342719e192e3962bb60308f286e997a0dd793e5f04d33110abd93aec7201

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 3, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 19f1d0b642dc79cf5ffc321e1df879a243a4a2fa and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 19f1d0b

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

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 19f1d0b

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

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

@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 3, 2026

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

Approved for bulk merge: readiness passed, no conflicts, checks green.

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.

2 participants