Repository navigation
fix: make Enroll as bot on a custom agent create a bot - #35642
Conversation
d4f90c7 to
c71e021
Compare
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The fix reuses the create-then-add-abilities path the server already points to, changes no server contract, and the removed i18n keys have no readers outside this patch. Notes
[DESIGN-REVIEWED] 953d517 Description read[DESCRIPTION-READ] 4c495b19d717f09cbf32e3e9e52a7f540a53b61bc384c4ae5dc7c405a59f1e2b 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Step one of the dialog repeats the create-bot form and error mapping that Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: let a user turn a custom agent into a working bot from its Enroll action, which today always ends in a 409. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 953d517 Description read[DESCRIPTION-READ] f7ad9b87248a274a3cbb40d488b8a3b6825667a7f8571203f9e08a90a8633b75 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: the blind reader identified every primary control (Enroll as bot, Create bot, Add these 1, Done) correctly and said they would use each one. Notes
[UX-REVIEWED] 953d517 Description read[DESCRIPTION-READ] 839896953ca4145f92863165ef9e80bd11aad9fe3ff09cc721fecaa5e55626e1 That sha256 names everything this verdict read: the PR description, plus the 8 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 |
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: |
Code change approver recommendation: A person should decideWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 787 lines, more than the 400 it may approve on its own. Fixes the Enroll action, which always got a 409. It now creates the bot on the built-in worker ( 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 |
c71e021 to
762f7a4
Compare
|
One "Not a goal" line is set aside, by the lead's decision. The description lists "Renaming the action, or changing the existing Why: the UX review of What changed for it:
The rest of that "Not a goal" line still holds: the action keeps its name, "Enroll as bot". I wrote the 11 translations myself. No native speaker has checked them. |
9ca8072 to
4ed5c43
Compare
Enroll posted the agent's name as both the bot's name and its template, and POST /api/agents refuses that with 409 template_name_in_use because a bot's own file is resolved under its name. Enroll now opens a dialog that proposes a free name, creates the bot on the built-in worker, and then adds the agent's abilities through the bot editor's reviewed Add abilities pane. Fixes #32346
4ed5c43 to
953d517
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Read the full diff. Fixes #32346. Enroll used to POST a Bot named after the template from the template itself, and the server refuses both (template_name_in_use, mate_template_unsupported). Now the Bot is created on DEFAULT_CREWMATE_TEMPLATE under a free <agent>-bot[-N] name, and the abilities go through the existing reviewed WorkerKitPane add. The pane change is additive: initialTemplate previews once and writes only on Add, and onBusyChange keeps the dialog open while a write is in flight. Error codes map to the same strings the members dialog uses. The 13 locales carry the same keys. No regex in product code.
Non-blocking: the client-side hint also refuses a name that matches another Bot's display_name, case-insensitively. The server does not refuse that, so a user who really wants that name must use the Bot editor. Fine to leave as is. LGTM.
Problem / Motivation
Goal: "Enroll as bot" on a custom agent ends with a bot that has that agent's abilities, instead of always failing with 409
template_name_in_use.Customize → Custom agents → (agent) → Enroll as bot fails for every agent. The button posted the agent's name as both the bot's name and its template:
Reproduced on a pod at
a0bf0ca47d0dwith exactly that request.POST /api/agentsrefuses the shape on purpose: a bot's own config file is resolved under the bot's name, so a bot can never carry a template's name (dashboard/agent_admin/crew_records.py). A different name alone would not help either: a create may start only from the built-in worker (mate_config.start_template_refusal,mate_template_unsupported).Why it matters
Enroll is the obvious door for running a custom agent, or an agent that an installed app ships, as a bot. The door has been closed for every agent since #23010, and the user sees a raw server refusal with no way forward from that screen. A user reported it again on Slack on 2026-11-11.
Not a goal
POST /api/agentsaccepts. The refusal of a bot named after a template stays.enroll_hinttext.What changed (motivation → approach → change)
Symptom: every Enroll ends in 409. Root cause: the button built a request the server can never accept, and the server's own message already names the supported route: "Bots start from the built-in worker; create it, then add abilities from that agent in its editor." Change: Enroll now does those two existing steps in one dialog.
<agent>-bot, then-2,-3, …), which the user can changePOST /api/agentswith the built-in worker askiro_agentcrewWorkerKitApi.preview, thenapplyonly when the user confirmswebsite/src/pages/overview/EnrollAsBotDialog.tsx(new): the dialog.agent_exists,template_name_in_use,invalid_member_name) and a bot list that could not be read are each anErrorNotice. No raw 409 is shown.website/src/components/crew/WorkerKitPane.tsx: three optional props,initialTemplate(preview that agent once the pane is ready),onAppliedandonBusyChange. The add is still written only on confirm.website/src/pages/overview/AgentTemplatesTab.tsx: the menu row opens the dialog. The "Already enrolled" state is gone: it tested for a bot named after the agent, which cannot exist.website/src/i18n/locales/*.json, all 12 languages: nine new keys;enroll_alreadyandenrolledremoved;enroll_hintreworded (see the comment on the "Not a goal" line: fix: make Enroll as bot on a custom agent create a bot #35642 (comment)); pseudolocale regenerated. The hint and the line shown after the add now both say that the bot gets the agent's abilities and that later changes to the agent do not reach it. Neither says "copy": on this page "Bots with their own copy" counts bots that forked the agent's file, and an enrolled bot is not one of them. I wrote the 11 translations myself; no native speaker has checked them.docs/system-specs/modules/crew-mode.mdanddocs/feature-map/README.md: the Enroll paragraph, the file-table row and the feature-map row.No route or handler is touched, so the builder-security exposure rule does not apply to this diff.
Backwards compatibility
Compatible: the old Enroll request always failed, so nothing that worked stops working. The server is unchanged.
Removes nothing: the only things taken out are the
enroll_alreadylabel with the check behind it, which could never be true, and theenrolledline, which the newenroll_addedline replaces.Tests
Proof: not provable -- frontend test (prove.py runs Python only)
By hand instead: with the create request mutated back to
{ name: agent, kiro_agent: agent }, two tests fail (creates the bot under a free name on the built-in worker, never under the agent nameandshows the enrolled mate on the Crews roster); restored, all pass.website/src/pages/overview/EnrollAsBotDialog.test.tsx(new, 10 tests): the free-name rule; the create goes out under the suggested name on the built-in worker and never under the agent's name; a name a bot already shows is skipped; the abilities are previewed for the new bot and written only on confirm, with the footer reading Finish without abilities before and Done after; the way out is disabled while the add is being written, and a failed add is then shown; Done is also disabled while a second add (the agent picked again) is being written; an agent's auto-approvals appear in the preview and nothing is granted before confirm or on leaving; a 409template_name_in_useis said in words with no raw code; a custom agent's name is refused as a hint under the field without a request; a bot list that cannot be loaded is said, and the create still works.website/src/components/crew/WorkerKitPane.test.tsx: an agent the door already picked is previewed once and still written only on Add; the pane tells its host while a preview or an add is in flight.website/src/test/AgentTemplatesTab.test.tsx: the Enroll test used to pin the broken request (name: 'reviewer'); it now opens the dialog, checks the suggested name, and expectsname: 'reviewer-bot', kiro_agent: 'kirocrew'and the abilities preview. The menu row is checked for the new promise (this agent's abilities; later changes do not reach it) and for not saying "copy".namedCeiling).Run locally on this head: those three files plus the i18n catalog tests, 411 passed.
npm run typecheck,npm run jscpd,npm run i18n:checkwithI18N_BASE_REF,scripts/check_feature_map.pyandscripts/docs-lint.shpass.Manual verification
On a pod built from this head, driven with Playwright at 1440×900: created a custom agent
reviewerwith a prompt, opened Custom agents → reviewer → More actions → Enroll as bot, kept the suggested name, pressed Create bot, saw Finish without abilities as the only footer button, pressed "Add these 1", saw Done, pressed it. The page then says "reviewer-bot now has reviewer's abilities. Later changes to reviewer do not reach it." The same pod build answered 409 to the old request (see Problem).A phone-width run (390×844) passed on the earlier head
d4f90c7ead41: the dialog was 326 px wide, the page did not scroll sideways, and every button sat inside the screen. It was not repeated on this head.Not checked: a screen reader, and a real agent with a third-party MCP server and auto-approvals on a live gateway (a component test covers that case).
Screenshots / video
The menu row with the reworded hint:
Step 1, the name with a free suggestion:
Step 2, the agent's abilities previewed for the new bot. The only primary button is the pane's Add:
After confirming, the footer becomes Done:
After Done:
Related Issues
Fixes #32346
Sibling sweep
Swept: git grep -n "createKirocrewAgent" -- website/src
Sibling: website/src/pages/overview/AgentTemplatesTab.tsx -- changed here
Sibling: website/src/pages/members/NewCrewmateDialog.tsx -- not affected -- it always sends the built-in worker as
kiro_agentand already saystemplate_name_in_usebeside the name fieldPattern harvest
Not generalizable: one button kept a request shape that a later server rule made impossible; the test that should have caught it mocked the API and pinned the broken request.
Checklist
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; see the Licensing section of CONTRIBUTING.md.