Skip to content

feat(apps): crewmate.import owner card and ctx.crewmate for .crewmate bundles - #21721

Merged
chenmingwei23 merged 1 commit into
mainfrom
feat/crewmate-import-consent
Oct 19, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
feat/crewmate-import-consent

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An app can propose one crewmate from a .crewmate bundle, the owner sees exactly what it would create and what it leaves out, and only the owner's press creates it.

The accepted RFC rfc-crewmate-share.md (#21508, accepted on main by #21655) needs one generic App SDK capability and an owner card. Today an app has no sanctioned way to create a crewmate: POST /api/agents is owner-only, and widening it to app tokens would let any app install grants.

Why it matters

This is the core half of Phase 1. Without it the Crewmate Share app and any template-gallery app have nothing to call.

Not a goal

  • The owner-facing Pending changes view for app: cards, cancelling them when the app is disabled, and re-consent when an update adds the permission (next PR).
  • Export (propose_export), the Crewmate Share app itself.
  • Writing MCP servers or skills: refused until the mate-owned agent file exists (RFC §5.7).
  • Writing rules, crons, key results, the avatar or the dashboard template, and a provenance stamp on the crew record.

What changed (motivation → approach → change)

Apps must propose, never create → reuse the change-card store and the crewmate.create plan so the owner routes and their app-token refusal stay the only gate → a new crewmate.import card kind and ctx.crewmate (apps/crewmate_sdk.py, built in apps/context.py from both apps/hooks_integration.py and apps/lifecycle.py) for apps that declare permissions.proposeCrewmate: true (apps/manifest.py).

  • crewmate_bundle.py (new, so the over-cap change_card_catalog.py only gains the kind): crewmate_import_params checks a parsed bundle and fails closed on unknown keys, another format, a newer formatVersion, grants, page HTML, rules, and any MCP server or skill.
  • dashboard/handlers/change_cards.py (propose_app_card): the card is stored under app:<name> with no conversation. Agents cannot see or propose the kind, and a chat slot key with that prefix is refused.
  • The press runs POST /api/agents with approval_mode: "normal" in the same write, then the long-term goal. Undo, evidence and state reads are crewmate.create's, including the member-id check on Undo (dashboard/change_cards.py). The first commit (feat(agents): accept approval_mode on POST /api/agents #21656) touches dashboard/agent_admin/crew_records.py.
  • The card lists name, sender (not verified), description, goal, approval ("asks you before each tool, like your other crewmates"), the servers your crewmates already use without asking, each said as what it reaches (a service's host or a program on this computer) with a link to the default crewmate template, "Stays with the sender" and "Not brought over", the last two sent as codes the dashboard words. Strings are in every website/src/i18n/locales/*.json catalog; the kind is registered in website/src/api/cards.ts.
  • A taken name becomes the first free <name> 2; the owner can edit it.

Builds on #21656 (merged), which added approval_mode to POST /api/agents; the card pins normal in that one create.

Backwards compatibility

Compatible: every part is new. No existing kind, route or manifest field changes, and an app without the permission sees nothing new.

Removes nothing: the shared crewmate.create branches only gain the new kind.

Tests

  • test/test_change_card_crewmate_import.py: each refusal class; the plan pins normal and carries no grant; agents cannot propose the kind; ctx.crewmate exists only for a literal true on both context builders; end to end, propose writes only a card under app:share, the app token's press is 403, the owner's press creates in normal, another app cannot read the status, and Undo deletes with the member-id guard armed.
  • website/src/cards/CardChanges.test.tsx: the new rows render localized.
  • Preview, switched off: ctx.crewmate stays None for every app (crewmate_sdk.PREVIEW_ENABLED = False) until the owner view that lists app: cards lands (Mate sharing Phase 1: import one crewmate from a .crewmate bundle through an owner card #21718); the docs say so. The tests switch it on to cover the contract.
  • prove.py --per-hunk was run; the hunks it flagged in the shared create paths are now covered by the tests above.

Manual verification

Rendered the card (round 6: plain-word server rows, template link) through Storybook and Playwright in dark, light and Chinese.

Screenshots / video

Import card, dark

Light and Chinese

Import card, light

Import card, Chinese

Related Issues

Part of #21718

Refs #21508, #21656

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

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 17, 2026 23:38
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

Design-level review of 76fc9f68224e13cd269f3e9a4e13aa204735a9b5 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

An imported crewmate gets the default template's auto-approved servers, so content from a stranger's bundle drives tools that run without asking. The RFC promises "asks before every tool".

Watch

  • Inherited auto-approve breaks the RFC's trust promise. The cause is that build_preview creates with "kiro_agent": DEFAULT_CREWMATE_TEMPLATE, and that template keeps its inherited_auto_approve. This PR only discloses those servers in a row ("Your crewmates use these without asking", RISK_WIDEN). The RFC says something stricter: §"Approval" reads "normal: asks before every tool", and line 296 says "More trust comes only from the owner's later crewmate.update or crewmate.capabilities card". The sender writes description and goal, which is external content. Once the owner presses, that content steers a crewmate whose template servers skip the prompt. Today's crewmate.create has the same row, but there the owner wrote the goal. Here a stranger did, so the same row now crosses the external-content boundary. The preview flag (PREVIEW_ENABLED = False) keeps this reversible for now. It stops being reversible once the next PR (Mate sharing Phase 1: import one crewmate from a .crewmate bundle through an owner card #21718) turns the flag on.
    Clears when: the import creates with no template autoApprove (or the RFC is amended by its owner to accept inherited grants for imports), with a test pinning which one was chosen.

[DESIGN-REVIEWED] 76fc9f6

Description read

[DESCRIPTION-READ] 371bb585ae7783d2459ccf7ce4e0bd05d471822f1ba1fc65a40ba15c9addad6e

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ human override accepted

@iamwhatever overrode this lane for 76fc9f68224e13cd269f3e9a4e13aa204735a9b5 via /ai-review override (this commit only).

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 76fc9f68224e13cd269f3e9a4e13aa204735a9b5 — 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/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The whole capability ships switched off (PREVIEW_ENABLED = False), so no app gets ctx.crewmate and the Goal "an app can propose one crewmate" is not delivered here.

Not justified as shipped

What this change ships

Inventory (8 items) — 7 justified

Intent: let an app hand over a .crewmate bundle so the owner reviews and creates that crewmate with one press. This is an ADDITION, and the accepted RFC rfc-crewmate-share.md covers it.

  1. A preview switch keeps ctx.crewmate off for every app — zero consumers, gates the whole feature dark
  2. New manifest permission proposeCrewmate — justified
  3. ctx.crewmate.propose / status for apps — justified
  4. Bundles are refused if they carry grants, rules, MCP servers, skills, page HTML or a newer format — justified
  5. New owner card "Import crewmate" with From, Approval, inherited servers and what they reach, "Stays with the sender", "Not brought over" — justified
  6. A taken name becomes " 2" … " 9" — justified
  7. Agents and chat slots cannot propose this card kind or use the app: key — justified
  8. Undo, evidence and state reads of crewmate.create now also cover imports — justified

[FIRST-PRINCIPLES-REVIEWED] 76fc9f6

Description read

[DESCRIPTION-READ] e3f8541d91df3da51b6754f4b7a25534e0536c915ac85857ef32cbfb0e8b3c97

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 76fc9f6

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 76fc9f68224e13cd269f3e9a4e13aa204735a9b5: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 76fc9f68224e13cd269f3e9a4e13aa204735a9b5 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 76fc9f6

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 76fc9f68224e13cd269f3e9a4e13aa204735a9b5: <one-sentence reason>

@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 Oct 18, 2026
@iamwhatever
iamwhatever force-pushed the feat/crewmate-import-consent branch from e1f6cf0 to 1b8a399 Compare October 18, 2026 00:47
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 18, 2026
@iamwhatever
iamwhatever force-pushed the feat/crewmate-import-consent branch from 1b8a399 to 74fe495 Compare October 18, 2026 01:48
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Item 1 — zero consumers span=c6bb244e460d

needs-a-decision (conductor scope): RFC Phase 1 is split into PRs; the owner view that lists app: cards is the next PR on #21718, by plan.
Until it lands, ctx.crewmate and permissions.proposeCrewmate are marked Preview in docs/app-kit and the docs say a card raised today expires unpressed.
No built-in app uses it, and none can ship against it until the view lands.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Item 2 — RFC still draft on base span=9a6daeeb1cd0

needs-a-decision (maintainer): #21508 merged; #21655 records the acceptance and narrows §5.7 to "refuse mcpServers/skills", which this PR implements.
This clears when a maintainer merges #21655; this branch then rebases.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Item 4 — free-name retry loop span=1f88913cb361

rebutted: RFC §5.4 asks for it: "the card proposes the first free name (Release Captain 2) and the owner can edit it before the press".
Passing already_exists back would make every app re-implement name picking against a roster it cannot read (owner-only routes).
The loop is 11 lines, bounded at 9 tries, and covered by the end-to-end test.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

accepted: no app may ship against ctx.crewmate before the owner-view PR lands. The app-kit docs mark it Preview and say so; the owner view is the next step on #21718.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • "Not included" vs "Left out" read as one list span=c342389f005a

fixed in 74fe495: the rows are now "Stays with the sender" (memory, history, credentials, approval settings) and "Not brought over (this version can't import these)".

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Card mixes "import", "applied" and "Decline change" span=28a13eae6e95

accepted-as-is: the expiry line and "Decline change" are the shared change-card shell every kind uses; renaming them per kind is a shell change outside this PR's goal.
The kind label ("Crewmate import"), title and primary button all say import.

@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 Oct 18, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Consent with no subject span=107cf5ec612f

accepted-as-is: the widen box is the shared change-card shell for every widening kind; naming the widened item inside it is a shell change for all kinds, outside this PR's goal. The row it gates names the servers.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Two left-out rows read as one span=a1447838eb39

accepted-as-is for this PR: the rows now say why each is missing (stays with the sender vs this version cannot import). Renaming again would be the third wording round on the same rows; the owner-view PR can revisit with the view in hand.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • One action, three verbs span=6c40984f4852

accepted-as-is: the expiry line and Decline button are the shared shell wording across all card kinds; per-kind shell wording is outside this PR's goal.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Shorten the inherited-row label span=0476ce297f7c

acknowledged, not taken: the shell has no per-row hint for this row today, so moving the template explanation into a hint needs a renderer change; the label carries it instead.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Title stays English in zh-CN span=c1bc8e0398f2

accepted-as-is: every change-card title is gateway-written English today (crewmate.create included); cardTitle localizes only list-setting titles. Localizing titles is a shell-wide change.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

accepted-and-tracked: today no app card exists, because ctx.crewmate is None (PREVIEW_ENABLED=False), so _broadcast and the per-slot reads never see an app: card on this head. When _settle housekeeps an app: card, _broadcast would still call chat_cards.record_change_status and deliver_ws_owners with slot app:. The owner-view PR that turns the switch on (#21718) must route app: cards there and test it.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Item 2 — oversized: crewmate_host wiring with zero runtime consumers span=f2dd0dabbae8

needs-a-decision (conductor): the switch-off was the conductor's call for this PR; the alternative is to remove the two wiring lines here and re-add them with the owner view. No push on this head until decided.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override ux d9719f5: Maintainer decision, same as the override on 31f5a5a: this head is only the rebase onto main after #21656 merged. The remaining UX note is wording only (the widen warning vs 'Asks before each tool'). The card ships off (PREVIEW_ENABLED=False), and its wording is reviewed again in the entry PR with real screenshots.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the ux AI finding as false positive, not applicable, or explicitly accepted for d9719f5a7ea8e82de962a4c0bda2061b89c911f1.

Maintainer decision, same as the override on 31f5a5a: this head is only the rebase onto main after #21656 merged. The remaining UX note is wording only (the widen warning vs 'Asks before each tool'). The card ships off (PREVIEW_ENABLED=False), and its wording is reviewed again in the entry PR with real screenshots.

This decision applies only to this commit. A new push requires a new judgment.

@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 Oct 18, 2026
@iamwhatever
iamwhatever force-pushed the feat/crewmate-import-consent branch from d9719f5 to 192ed0c Compare October 18, 2026 08:18
@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 Oct 18, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override ux 192ed0c: Maintainer decision, same as the overrides on 31f5a5a and d9719f5. This head only rebases onto main to pick up #21792, with no content change. The remaining UX note is wording only. The card ships off (PREVIEW_ENABLED=False), and its wording is reviewed again in the entry PR with real screenshots.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the ux AI finding as false positive, not applicable, or explicitly accepted for 192ed0ca9fba0b2bb31bb23b3b6c2379bffae903.

Maintainer decision, same as the overrides on 31f5a5a and d9719f5. This head only rebases onto main to pick up #21792, with no content change. The remaining UX note is wording only. The card ships off (PREVIEW_ENABLED=False), and its wording is reviewed again in the entry PR with real screenshots.

This decision applies only to this commit. A new push requires a new judgment.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Item 6 — import-only reach row duplicates crewmate.create's auto_approve row span=78582ae89235

accepted-and-deferred: the import-only form came from three UX rounds on this card; moving crewmate.create to the same reach row changes an existing card's wording outside this PR's goal. It belongs with the owner-view PR (#21718), which owns both crewmate cards.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Item 8 — rides along: PREVIEW_ENABLED = False span=8b00781b221b

accepted: disclosed and reversible by decision; #21718 turns it on with the owner view.

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 18, 2026
@iamwhatever
iamwhatever force-pushed the feat/crewmate-import-consent branch from 192ed0c to 76fc9f6 Compare October 18, 2026 20:54
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 18, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override ux 76fc9f6: Maintainer decision, same as the earlier overrides on this PR. This head is only a conflict rebase onto main, with no content change. The remaining UX note is wording only (risk_widen_import vs 'Asks you before each tool'). The card ships off (PREVIEW_ENABLED=False), and its wording is reviewed again in the entry PR with real screenshots.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the ux AI finding as false positive, not applicable, or explicitly accepted for 76fc9f68224e13cd269f3e9a4e13aa204735a9b5.

Maintainer decision, same as the earlier overrides on this PR. This head is only a conflict rebase onto main, with no content change. The remaining UX note is wording only (risk_widen_import vs 'Asks you before each tool'). The card ships off (PREVIEW_ENABLED=False), and its wording is reviewed again in the entry PR with real screenshots.

This decision applies only to this commit. A new push requires a new judgment.

@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 Oct 18, 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.

Approving per maintainer bulk readiness pass (readiness: passed, no failing lanes).

@chenmingwei23
chenmingwei23 merged commit 650b69f into main Oct 19, 2026
103 of 105 checks passed
@chenmingwei23
chenmingwei23 deleted the feat/crewmate-import-consent branch October 19, 2026 02:05
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 19, 2026
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