Repository navigation
feat(bots): a Bot's chat carries the tools of an app its owner ticked it for (preview) - #37813
chenmingwei23 wants to merge 2 commits into
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: the blind reader understood both primary controls, and every new notice and state appears in a screenshot. Notes
[UX-REVIEWED] ccb39f9 Description read[DESCRIPTION-READ] 6e2abea5431e45f2f175b1e4695644ead3bea9e42dbaee2e799541b41664afc1 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the feature is a default-off preview, so the design can still be walked back. The revocation machinery is the long-term risk. Notes
[DESIGN-REVIEWED] ccb39f9 Description read[DESCRIPTION-READ] 12fe8dd160bd2023f3408859105cae7c24635ede2f42f834d01291413b4fa89d 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 The one premise risk is merge order: this reverses a recorded conductor decision whose superseding entry is not on base yet. Notes
What this change shipsInventory (10 items) — 9 justifiedIntent: let a Bot that its owner ticked for an app use that app's tools from its own chat, behind a preview. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] ccb39f9 Description read[DESCRIPTION-READ] 8d7b0c684c1a87c928c699c17dc9a1b63ee8858fa13ae85bee61ab87f6961a68 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/acp/runtime_session_setup.py:875 -- Provisional mount records let revoked app code start
BLOCKING -- src/kiro_crew/bot_chat_app_tools.py:419 -- A pending close exempts other Bots from an actively held revocation fence
BLOCKING -- src/kiro_crew/bot_chat_app_tools.py:730 -- Withheld-server fingerprints cause unnecessary Bot reloads
BLOCKING -- src/kiro_crew/bot_chat_app_tools.py:863 -- App-server mounts reverse the recorded conductor boundary
[BLOCK-MERGE] ccb39f9 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F3 — MEDIUM/LOW. The fingerprint is built from an entry that has already been changed. [ADJUDICATION] ccb39f9 total=1 uphold=1 downgrade=0 [ADJUDICATION-FENCED] ccb39f9 fenced=3 flagged=0 False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — 🔴 changes requested (blocking)Reviewed A trust revoke that raises after it takes the Bot revocation-fence hold never gives the hold back. The app then stays fenced out of every Bot chat until the gateway restarts, and granting trust again does not fix it. BLOCKING — src/kiro_crew/dashboard/handlers/security_trusted_apps.py:795 Trigger: Notes:
[BLOCK-MERGE] ccb39f9 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
67e17c5 to
9085b1e
Compare
|
The Opus 5.5 BLOCK (recorded-decisions-are-not-regressions, against the 2026-11-04 conductors-stay-simple entry) is handled in #37812, which now supersedes that entry for this one case and asks its decider to restate it. This PR waits for #37812 to merge, then rebases onto main. No code change here for that finding. |
9085b1e to
ce3d5e1
Compare
0026cc3 to
9d7e43e
Compare
4e452c3 to
9ad75a9
Compare
9ad75a9 to
d21ab47
Compare
3c18c30 to
0cf88f1
Compare
0cf88f1 to
dc9f262
Compare
49fd035 to
d9e1d21
Compare
6073966 to
b488128
Compare
b488128 to
5bf9427
Compare
|
Item 5 (the BLOCK) is addressed: the Item 7 is addressed: Item 6 (noted, not a BLOCK): the three fence layers are retained with justification added in a new
All three layers are verified by tests that go red when each one is removed. They are not duplicates of each other. |
… in UI; offload seed-lag check to thread
Builds on #32983 (merged;
permissions.bots). Merge order: the decision PR #37812 first (docs only; its entry supersedes both the conductor clause of the 2026-11-04 entry, decided by @iamwhatever, and the stock-conductor clause of the 2026-11-02 entry, for this one case, and needs both decision owners to restate it), then this PR.Problem / Motivation
Goal: a Bot the owner ticked for an app can use that app's tools from its own chat, behind a default-off feature preview.
A Bot's own chat runs on the shared
kirocrew-mate-conductorspec, which mounts only the platform servers. #32983 lets an app see and wake the Bots the owner ticked for it, and explicitly leaves out the other half: giving that Bot the app's tools in its own chat. So when an app wakes a Bot, the Bot has no way to read what the app wants or to answer through the app. Its only route is a worker, which costs a second turn and puts the Bot's words in the worker instead of its own chat. The 2026-11-04 entry sends new abilities to workers on the reasoning that a conductor only analyzes and dispatches; #37812 answers why a Bot's own chat is the exception (it is where the owner talks to the Bot and where its memory lives) and needs @iamwhatever to agree.Why it matters
An owner who ticks a Bot for an app expects that Bot to work with the app, from its own chat, with its own memory and project. Today the wake arrives, and the Bot can only say it cannot see the app's data. The owner has no way to fix that short of rebuilding the Bot outside the Bot system.
Not a goal
What changed (motivation -> approach -> change)
Symptom -> cause -> fix:
session_mcp_crewmate._crewmate_worker_spec->mate_worker.worker_session_spec)._crewmate_conductor_specsits next to_crewmate_worker_spec(array hosts), and the KAS projection calls the same seam. Both callbot_chat_app_tools.conductor_session_spec, which adds an app's server to THIS Bot's chat only while all of these hold:bot_chat_app_toolsfeature preview is on;contributes.botChatServers: [{agent, server}], naming a server one of its own agents declares;toolsBot scope;This extends #32983's field. Points 4 and 5 reuse #32983's grant instead of adding a second switch:
permissions.botsgains a third scope,"tools", next toreadandwake. It is staged and explicit-only like the other two, so an install approves nothing and the owner approves it on the app's page. The design decision is recorded in #37812 (a docs/decisions entry that narrows the 2026-11-04 conductor clause and the 2026-11-02 stock-conductor clause); whethertoolsbelongs inpermissions.botsor in a field of its own is the open question for the #32983 author.Details:
template_mcp_additions.ENTRY_KEYS), so no trust key such asautoApprovereaches the Bot's chat, and mounted as<app>:<server>withKIROCREW_SESSION_LABELset to the chat's session so the server knows which Bot is calling. A server switched off under its own name (spec, Kiro global settings or any Crew MCP store) does not mount; its switched-off tools stay off asdisabledTools; a malformeddisabledToolsrefuses the server. A platform server of the same name wins. Tool calls still follow the Bot's own approvals.ACP_BACKENDS_MATE_WORKER_KIT). Its chat says so once, at the cold start. The cold-start notice is queued viaAUTOMATION_NOTICE_KINDso the Bot receives it as an inject row on its next turn and tells its owner -- not as a Crewnoticerow in the chat. This followsdocs/decisions/2026-10-09-crewmate-chat-draws-messages-only.md: runtime notices for a crewmate chat are injected into the crewmate's next turn, not drawn as gateway rows in the chat.after_app_change, which compares every live Bot chat with that record and queues a no-replay discard or reload. Disable, uninstall and trust withdrawal are different: they callstop_app_bot_chat_serversbeforeafter_app_change, which callsdiscard_conversationimmediately withoutskip_if_busy, stopping the Bot's current turn. A Bot mid-turn is interrupted. Trust revoke returns two distinct 409 codes:teardown_incomplete(the app's own runtime could not be fully stopped -- grant is left in place) andbot_chat_stop_incomplete(the app teardown succeeded but some Bot chats could not be stopped -- grant is already removed, retry the Bot stop). The UI surfaces stop failures on disable and uninstall. Only ordinary grant changes (ticking or unticking a Bot) still take effect at the next idle boundary via the queued fresh-start path. A Bot whose servers were added, or whose entries an app update changed, reloads in place. A reload skips a chat whose fresh start is already queued, so disable then enable never starts two agent processes on one chat.edition_locks.feature_previews, so it is off on LTS whatever is stored. An offer names an agent by its file stem; the rendered spec is found under the name that agent declares (_register_agentsfiles it under that name).agent_sdk.agent_specs.stamp_session_label, so application code still imports nothing from the ACP layer.tools. All 12 locales are updated.docs/app-kit/manifest-reference.md(contributes.botChatServers, thetoolsscope) anddocs/system-specs/modules/app-kit-platform.md.Backwards compatibility
Compatible:
toolsis a new optional scope andcontributes.botChatServersa new optional key; manifests and grants that work today parse and behave the same, and with the preview off (the default) no Bot chat spec changes.Removes nothing: the diff only adds a scope, a manifest key, a preview flag, a per-session spec builder, and security teardown hooks; the shared conductor spec and every existing grant are untouched.
Tests
test/test_bot_chat_app_tools.py(57 tests), among them: mount with label; preview gate; scope gate; ticked-Bot gate; only the app's own agent's server is offered; an offer finds an agent by the name its spec declares; the preview reads off under the LTS lock; a platform server wins; the array-host projection carries it for the conductor and not for other agents; no trust key reaches a mounted entry; a server or tool switched off under its own name stays off; a malformeddisabledToolsrefuses the server; a Bot chat on Kiro CLI mounts nothing and is told once; a change starts lost Bots fresh and reloads gained ones; a tick undone before its reload applied keeps the conversation; registry updates and trust revokes reach Bot chats; a Bot chat's Claude deny rules cover its mounted servers. The module docstring maps each guarantee to the one-line change that reddens it; the five added for review findings were each run that way and went red.test/test_config_live_server_appliers.py: the newdashboard.bot_chat_app_toolsapplier is registered and scoped.test_app_bot_grant_routes,test_app_bot_access,test_app_bot_disabled_token,test_feature_previews_config,test_apps_routes_coverage_enable_disable,test_apps_uninstall_keep_specific,test_app_update_local_trust_switch,test_app_update_market_source_route,test_config_baseline; vitestAppDetailBotGrants.test.tsx,previewFlagServerSync.test.tsx,settingsSearchGovernance.test.ts,previewSurfaces.test.tsx(its info-tip count goes from 15 to 16 for the new row).i18n-checkclean,tsc --noEmitclean. Settings registry, UI index and config baseline regenerated on the current main.Proof: not provable -- other: feature PR; each guarantee was reddened by hand as listed in the test module docstring
Manual verification
Pod run, real model, an app that offers one server and declares
permissions.bots: ["tools", "wake"], three Bots in three projects, preview on:Only the array-host (Claude) path ran in the pod; the KAS projection is covered by unit tests only.
The Kiro CLI notice has no pod run and no screenshot: on this gateway a Bot cannot be pinned to
kiro(PUT /api/agents/<bot>withacp_backend: "kiro"answers 400, "acp_backend must be one of: (empty), claude, codex, kas"), so a Bot chat cannot be put on Kiro CLI from the product. Tests are the evidence instead:test_a_bot_chat_on_a_harness_without_its_spec_mounts_nothing_and_says_soasserts the chat gets exactly one row,("system", _HARNESS_NOTICE, "msg msg-info"), whose text is "This bot's engine can't use app tools, so they're off in this chat. Switch the bot to Kiro Agent, Claude Code or Codex to use them."; that a second cold start does not repeat it; that_MOUNTEDstays empty (no app tools mounted); that a harness which carries the spec, or a Bot with no ticked app, gets no notice.test_every_bot_chat_cold_start_reports_its_harness_to_the_noticeasserts the allocation path records the harness (note_harness_without_app_tools), andtest_the_turn_that_claims_a_new_bot_chat_posts_its_owed_noticeruns a real dashboard turn (test/turn_harness.py) on a newly claimed session and asserts the notice lands in the chat exactly once; removing thedeliver_harness_noticecall inturn_admissionturns it red.Screenshots / video
Narrated pod run (ticking a Bot, the Bot answering through the app's tools, unticking it):
Revocation race fences: why three layers
Three separate mechanisms guard a Bot chat's app-server entries against stale state; each one covers a gap the others cannot:
Per-app generation (
_APP_GENERATIONS+_PROJECTION_GENS) -- fences in-flight projections at the three delivery call-sites.revoke_app_generation(app)bumps only that app's counter;conductor_session_specsnapshots each app's counter per alias before reading the grant table;check_and_filter_projectioncompares alias-by-alias. This matters for the Codex harness: codex folds whitespace in server names, so the sidecar must store the original alias keyed against its app's counter to match the folded form at delivery -- a single global epoch cannot link a folded name back to its original to know whether it changed.test_a_server_codex_registers_under_a_folded_name_is_revoked_on_untickgoes red if this layer is removed (codex deliversteam_app:my_serverbut the sidecar storesteam-app:my server; without per-alias matching the folded alias is passed through after revocation).Change epoch (
_CHANGE_EPOCH+_PROJECTION_EPOCH) -- fences therecord_mountedpath that harnesses take when they hand the session directly (without going throughcheck_and_filter_projectionfirst).after_app_changebumps the epoch, not the per-app counter, so a concurrent tick or preview change detected at record time triggers a reconcile without staling other projections.test_an_untick_during_a_first_projection_is_reconciled_once_it_recordsgoes red if this layer is removed.Re-projection set (
_REPROJECT_SLUGS) -- prevents the reconcile from treating a generation-mismatch drop as "harness-withheld". Whencheck_and_filter_projectiondrops an entry because its per-app counter advanced, it records the alias in_REPROJECT_SLUGS;record_mountedthen excludes it from_UNMOUNTED. Without this,after_app_changesees the alias inwithheld, filters it out ofnow, concludesnow == was, and schedules no reload -- the tools never come back.test_gen_dropped_entries_are_recovered_by_reconcilegoes red if this layer is removed._HAD_SIDECAR-- guards re-deliveries on the harness paths that bypassconductor_session_spec. Harnesses like KAS and the AcpClient array can callcheck_and_filter_projectionmore than once on the same session (once for the main array, once for a re-seed). The first call pops the sidecar;_HAD_SIDECARlets the second call pass through rather than fail-closed.test_every_harness_settles_the_record_after_its_own_withholdingandtest_the_array_resolver_settles_the_record_from_what_it_hands_the_sessiongo red if this guard is removed.Security teardown
Disable, uninstall and trust revoke call
stop_app_bot_chat_serversbefore the grant change is recorded. This stopsdiscard_conversationon each Bot chat that is running the app's servers immediately, withoutskip_if_busy, so the Bot's current turn is interrupted. Trust revoke uses two distinct 409 codes:teardown_incompletewhen the app's own runtime could not be stopped (grant kept, trust not revoked);bot_chat_stop_incompletewhen trust was successfully revoked but some Bot chats could not be stopped (grant removed, retry the Bot stop).Reason: after trust is revoked, the app's code must not keep executing in any Bot chat -- even a chat that is mid-turn. This is a security requirement. Grant changes (ticking or unticking a Bot) still take effect on the next turn via the existing queued fresh-start path.
Why the three delivery call-sites check per-app revocation generation (
check_and_filter_projection/_APP_GENERATIONS). Aconductor_session_specprojection reads the grant table and builds the sidecar in one blocking step;revoke_app_generationbumps only that app's counter before the grant table changes. The three call-sites (AcpRuntime mirror, AcpClient array, KAS projection) each callcheck_and_filter_projection, which compares the sidecar snapshot against the current counter and strips any entry whose generation advanced -- so a session that read a stale grant before the revocation cannot mount the revoked server. Using a per-app counter means an unrelated tick or untick for a different app does not stale the in-flight projection's entries for the first app.Why all Claude Bot chat arrays go through the seed-lag check.
runtime_session_setup._mirrored_session_mcpnow calls the shared check that KAS and codex already called: if the session's seed spec is not yet available (the KAS lag window), the entire MCP array is withheld and the session starts with no app servers. This keeps app code out of a chat that is still being configured. The check is offloaded to a thread so it does not block the event loop during a cold start.Why immediately stopped Bot chats are not also queued for a deferred fresh start.
stop_app_bot_chat_serversremoves each successfully stopped session from_MOUNTEDbefore returning. Theafter_app_changereconcile that follows iterates_MOUNTED; because the stopped slugs are gone, it does not also queue a fresh start on the same sessions. Only sessions that could not be stopped immediately remain in_MOUNTED, so those may still receive a deferred reconcile on their next idle boundary.Manual verification
Screenshots of the stop-failure UI were taken in a pod running head 192bad9, with API responses stubbed via page.route to inject real failure payloads. The stubbed response body drives actual rendering; no DOM was modified.
test_stop_app_bot_chat_servers_stops_a_busy_session_immediately: verifiesdiscard_conversationis called withoutskip_if_busy.test_stop_app_bot_chat_servers_returns_failure_when_discard_raises: verifies a session that cannot be stopped is reported as failed (not swallowed), which is what causes the disable warning and trust-revoke 409.test_failed_bot_stop_counts_as_incomplete_in_blanket_revoke: verifies the 409 path.Related Issues
Builds on #32983. Decision record: #37812.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.
Screenshots
All screenshots taken in pod kc-bot-chat-v2pod running head 192bad9, with API responses
stubbed via page.route to inject real failure payloads. No DOM was modified; the UI renders
the stubbed response.
Feature Previews page -- "App tools in bot chats" row, (i) hint expanded (pod, genuine rendering):
Trust revoke 409 -- trust removed, app row removed (No apps trusted yet.), Bot chat still running, Retry stop button (Security panel, pod, page.route stubbed):
App page "Bots this app can reach" -- tools scope line, preview-off hint (app detail, pod, page.route stubbed):
Uninstall warning -- bot chats still running after uninstall, app card removed (Library page, pod, page.route stubbed):
Disable warning -- not every step finished after disable, app card moved to Disabled section (Library page, pod, page.route stubbed):