Skip to content

feat(slack): pick each code channel's agent - #21991

Merged
kyleseaman merged 2 commits into
mainfrom
feat/slack-code-channel-agent-select
Nov 10, 2026
Merged

kyleseaman merged 2 commits into
mainfrom
feat/slack-code-channel-agent-select

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Two commits on main:

  1. feat(slack): pick each code channel's agent in its kickoff or with /kirocrew agent: this PR's own work, the agent picker and its hardening.
  2. feat(slack): start code-channel sessions in a configured approval mode (#21997): feat(slack): start code-channel sessions in a configured approval mode #21997, which was reviewed as its own PR and then squash-merged into this branch (by iamwhatever, 2026-11-02 16:34Z) instead of into main, plus the seam fixes and the creator-mode reconciliation below. feat(slack): start code-channel sessions in a configured approval mode #21997 predates main's fix(dashboard): workers follow their conductor's approval mode after dispatch #25866 (a conductor's mode change reaches the workers that inherited it), so on this base its own Trust raise had to be narrowed to fix(dashboard): workers follow their conductor's approval mode after dispatch #25866's rules; that is the one place this branch differs from a plain rebase of the merged branch beyond moving feat(slack): start code-channel sessions in a configured approval mode #21997's Settings controls into the base's split files (slackCodeDraft.ts, SlackCodeChannelDefaults.tsx). See Sensitive change.

Seam fixes (in commit 2). A fresh-context review of the two features together found one should-fix and four nits, all fixed, each with a test that fails without it: a finished archive (stamp stored, fence lifted) now fails the agent switch's commit check, which only read the fence; the approval select, the Trust card and worker cards check the workspace before any reply; an approval select value that is no mode is audited as <invalid>; a rebind during a raise points at the live kickoff; a cancelled approval pick redraws the select; both pickers share one validated slash-command name; and a worker whose window can't load leaves its card unclaimed.

Problem / Motivation

Goal: Let the owner of a Slack code channel run that channel from Slack without the dashboard: choose which agent runs it, and choose how its tool approvals are answered. In scope:

  • the channel's agent, from the kickoff's Agent for this channel select or /kirocrew agent <name>;
  • the configured starting approval mode (Settings → Code channels: Normal, Reads or Trust), applied when the channel's session is created;
  • per-channel approval mode changes from Slack, owner-only and audited: the kickoff's Approval mode select, /kirocrew approval normal|reads|trust, and Trust this channel on an approval card; both the button and the select ask for confirmation first;
  • approval cards posted top-level in the channel, not threaded under the kickoff;
  • the worker approval relay: a prompt from a worker the channel's session started is posted to the channel and answerable there;
  • live-worker propagation: a channel mode change (raise or lower) reaches the workers that session is already running, and a raise to Trust answers their pending tool prompts.

This deliberately reverses the earlier "Trust excluded in group channels" decision for code channels: Kyle approved all three modes (Normal, Reads, Trust) for a code channel, with the owner-only gate and the in-channel Trust warning.

Kyle's asks, verbatim: "I would like you to build the fulll implementation of Slack Code for Crew" and "i want this to be a GREAT experience, customers should be able to create a default folder and/or agent (with model/effort) as default and just make it work." Then, for the agent picker: "let us pick ANY agent."

"Any agent" resolves to the _choosable roster: every agent that can actually run a channel. That is every user-defined agent plus the shipped kirocrew-conductor, kirocrew-team-lead and the coding agents. kirocrew-lite (no tools), kirocrew-guest (a trust boundary), the dashboard manager and kirocrew-heartbeat (unattended polling) stay out, per the "Which agents." paragraph of docs/request-for-change/rfc-slack-code-channels.md, because none of them can run a channel. The kickoff picker, /kirocrew agent and Settings → Slack's "Default agent" picker all call that one existing function, unchanged.

Today every code channel runs the resolved default agent (the Slack Code card's default, else the folder's default_agent, else kirocrew-conductor), and its session always starts in Normal: every tool call waits for an approval click in the dashboard. Nobody is usually watching the dashboard while the channel is in use, so the agent stops at its first shell command and the channel goes quiet.

Why it matters

A default suits most channels, but not all of them. Without a per-channel choice, someone who wants a coding agent for one task has to change the default for every channel, or leave Slack and switch the session in the dashboard. And without an approval mode the channel can use, the first build or test command waits on a prompt only someone at the dashboard can answer; the workaround is to open each channel's session in the dashboard and flip it to Trust by hand, every time a channel opens.

Not a goal

  • A model or reasoning-effort choice per channel. Both still come from the card defaults; the picker changes only the agent.
  • The conductor's dispatch boundary. A conductor-led channel still can't dispatch (the gateway refuses channel_session). A separate item designs that exemption.
  • Changing which agents are offered. The list is the base settings PR's, untouched.
  • No hook-based approval override. Crew's script hooks cannot set a session's approval mode, and this PR does not invent a hook system.
  • No mode changes outside the channel's own lineage: sessions the channel's current session did not start are never relayed or changed.
  • No YOLO option. YOLO is process-wide, never a property of one session.
  • No re-apply after a gateway restart. Session trust is in memory for every session; after a restart a code channel's session asks again until someone picks a mode.
  • The Slack Code RFC (docs/request-for-change/rfc-slack-code-channels.md) gains §3.4 Approval modes in code channels, recording the owner-only "Trust this channel" exception to the group-channel no-Trust rule. The exception itself awaits the owner's decision on this PR.
  • Manifest changes. None are needed: /kirocrew and interactivity are already in the manifest.

What changed (motivation → approach → change)

Both features reuse the dashboard's own transactions, so neither adds a store or a privileged write of its own.

  • Agent (commit 1). The kickoff is now Block Kit with an Agent for this channel select of the _choosable roster, preselected with the resolved default; /kirocrew agent [<name>] does the same from the command line. Both run switch_slot_agent as a non-owner caller (notice=False; the picker writes the one /agent transcript line). Owner-only, SEL-audited, and a pick during a turn is refused with "try again". The gates are re-checked after the switch path's awaits and again at the switch's commit (new optional SlotAgentSwitchCaller.still_permitted, None for every existing caller), and a restored session's transcript is loaded off the event loop first. Details: Agent picker below.
  • Approval mode (commit 2, feat(slack): start code-channel sessions in a configured approval mode #21997). A new default, slack.code_channel_defaults.approval_mode (ask / trust_reads / trust, unset = ask), seeds the channel's session through a new shared seed_slot_approval once the binding is written. In the channel: an owner-only Approval mode select under the agent picker, /kirocrew approval normal|reads|trust, top-level approval cards with Trust this channel, a relay of the channel's workers' prompts, and propagation of a mode change to running workers. Every change goes through apply_approval_mode, the dashboard picker's audited mutation, fenced at the commit. Details: the three approval sections below.

Docs: docs/guides/slack-setup.md gains "Choosing each code channel's agent" and "Approval mode for code channels".

Agent picker (commit 1)

  • Kickoff picker. The kickoff text, then an Agent for this channel static_select (kc_code_channel_agent) set to the resolved default (card default > folder default_agent > kirocrew-conductor). Its options come from slack_code_settings._agent_names, the same call the Settings picker makes. A pick switches the channel's session and the kickoff is redrawn from the session's real agent with a "set by @user" note; a refused switch puts the select back. If the new session took a different agent than the resolved default, routing._bind_channel redraws the kickoff once to show it.
  • /kirocrew agent [<name>] in a code channel. commands.handle_slash takes the agent sub-command (and, with commit 2, trust); any other /kirocrew text goes to the normal registry. Same gates as /summarize. An unknown name is refused with the list; a bare /kirocrew agent shows the current agent and the list. Outside a code channel /kirocrew agent is the app's own command.
  • What each agent does. Each option's label is a plain role and the name for a shipped agent (Team lead (kirocrew-team-lead)), or the name alone for any other; labels are unique and never cut (a name past Slack's 75-character label cap is not offered; /kirocrew agent still reaches it). What the agent does goes on the option's own description line: for each shipped agent a short hand-written best for phrase that fits Slack's 75 characters uncut (one table, agent_picker._SHIPPED, with a test that each fits and none repeat); only a user-defined agent shows its spec's description, through the display sink, cut at a word to fit, and /kirocrew agent lists one line per agent with its description.
  • Same name, different kind. A pick of the name the channel already runs answers "unchanged" only when the session runs that template: a folder or Slack default can resolve the channel to a same-named crewmate, and picking the template then switches to it.
  • A pick during a turn is refused, never held: turn_in_flight answers "A turn is running. Try again to switch to X when this turn ends." and running sub-agents get their own try-again reply. Nothing is kept in memory (a deliberate subtraction; see Review history).
  • Permissions. Owner only (is_allowed_user), in a code channel that is not archived and whose activation and origin both admit the bot. Every decision writes one SEL row (caller=slack-code-channels, operation=slack.code_channel.agent). A typed value that can't be an agent name is shown and audited as <invalid>.
  • Gates that close mid-switch. After the switch path's awaits (agent discovery, the window load) the gates are checked again: the stored binding (archived, or rebound to a new session, which points at the live kickoff), then the Slack channels policy, then the synchronous gates (workspace, owner, archive fence, feature, channel and origin activation). The synchronous ones also ride into switch_slot_agent as still_permitted, read in its no-await commit section, so a gate that closes during its own awaits refuses with caller_not_permitted (403).
  • Event loop. notice=False skips the built-in notice's load_window_off_loop, so the picker awaits it before the switch (which reads slot.messages) and before _announce's append. A failed load refuses with "try again" before anything commits.
  • Failures. A switch that raises is answered, audited (result=failed) and redrawn; a cancel before the commit redraws the kickoff; a refusal reason is redacted before it reaches Slack.
  • Degrades gracefully. If the agents can't be listed the kickoff still posts as Block Kit with only the Approval mode select; if Slack refuses the Block Kit post (e.g. missing_scope) it goes out as plain text. Names over Slack's 75-character label cap are not offered (the 150-character value cap is wider); the 100-option cap keeps the selected agent.

Where: src/kiro_crew/slack/code_channels/agent_picker.py (new), commands.py, routing.py, surface.py, src/kiro_crew/slack/events_slash.py, interactions.py, src/kiro_crew/dashboard/chat_api/agent_switch.py (the optional still_permitted field).

Approval mode default and seeding (commit 2)

Settings. The Code channels card gets an Approval mode picker with the session approval picker's labels (Normal / Reads / Trust). A new code channel runs with gains an Approvals row. Picking Trust shows an inline warning: anyone allowed to talk to the bot in the channel drives an agent whose tools run without asking, and sessions it starts inherit that. PUT /api/slack/config accepts the three values, stores ask as unset and refuses anything else; a value already stored is not re-checked on a save that does not touch it. The copy is in all 12 locales.

Runtime. When create_bound_session has created and bound the channel's session, it puts the slot on the mode, only after the binding is written, so a retracted session leaves no audit record. The new shared helper dashboard/slot_approval_seed.seed_slot_approval writes what the dashboard picker's Reads / Trust writes (_trust / _trust_reads on every slot sharing the session, the session's approval policy, a mode_change:<mode> SEL record attributed to slack:code_channel). Unlike a person's press it never touches the YOLO override and never replaces trust the slot already holds. The crewmate thread seed (handlers/members._seed_member_approval) now calls the same helper. ask changes nothing.

Hook point. Crew's script hooks fire once a turn is under way and can't set a session's approval mode; the code-channel turn hooks are internal. The setup guide says so and tells the user how to keep one channel on Normal.

RFC addition (for #21425's rfc-slack-code-channels.md, §1 Resolution order): one row, approval mode | code_channel_defaults.approval_mode only; unset is ask. The API paragraph gains: an approval mode must be ask, trust_reads or trust, with ask stored as unset. The runtime applies it through seed_slot_approval once the session is bound, never touching the YOLO override.

Part Files
Config config/sections_slack.py, config/section_builders.py, config/sections.py
Resolution slack/features.py
Runtime slack/code_channels/binding.py, dashboard/slot_approval_seed.py, dashboard/handlers/members_thread.py
Settings API dashboard/slack_code_settings.py, website/src/api/client/messaging.ts
Settings UI pages/settings/SlackCodePanel.tsx, website/src/i18n/locales/ (12 locales + regenerated en-XA.json)

Approval cards in the channel, Trust this channel, worker approvals (commit 2)

  • Cards post in the channel. A code channel's own session posts its "Tool approval requested" card top-level, where the agent's replies go (the rule lives in feat(slack): code channels core #21410, below this PR). Ordinary linked threads keep threading.
  • Trust this channel. The card keeps Approve (the one primary button) and Reject and adds a secondary Trust this channel: owner-only, under the code-channel gates. It puts the session on Trust through apply_approval_mode, whose sweep approves the waiting call; posts one warning line in the channel; and writes a slack.code_channel.approval_mode SEL row. Nothing is resolved by id state-wide; the already-on-Trust race is answered with resolve_slot_approval pinned to the card's future.
  • A spent card changes nothing. apply_approval_mode gains an optional still_live predicate, asked before any trust flag or policy is written; a prompt answered or expired meanwhile gets a 409. Existing callers omit it.
  • Worker approvals are relayed. A prompt from a session the channel's current session created (_created_by) is also posted top-level, headed Worker: <title> wants to run:, with the tool and its arguments through the usual outbound redaction and nothing from the worker's transcript. Approve / Reject (owner-only, lineage re-checked live) resolve the worker's own future; Trust this channel approves the call and puts the whole channel on Trust. A card decided elsewhere is updated in place and its buttons go.
  • Approval mode from the channel. The kickoff gains an owner-only Approval mode select below Agent for this channel, preselected with the session's mode, and /kirocrew approval normal|reads|trust joins /kirocrew agent (bare /kirocrew approval shows the mode). Trust this channel and the Approval mode select each carry a Block Kit confirm saying the channel's agent and its running workers will run tools without asking (Slack confirms a select as a whole); Approve and Reject stay one click. Both reuse commit 1's authorize, kickoff_blocks and sub-command parse. YOLO: a pick is never "unchanged" while the override is on, so Normal ends the grant; the kickoff carries a line saying tools run without asking. Known limit: the select shows the mode as of the last redraw (a dashboard change or restart does not redraw it).
  • Slack entities. Code-channel cards mrkdwn-escape the footer and the tool arguments; a literal triple backtick in a tool's input cannot end the code block.

Files: slack/code_channels/approval_picker.py and worker_approvals.py (new), slack/handler_runtime/approvals.py, slack/interactions.py, dashboard/chat_runner.py, dashboard/chat_turn/permission_prompt.py, dashboard/chat_api/slot_approval.py, docs/system-specs/modules/slack-gateway.md.

Running workers follow the channel's mode (commit 2)

  • Propagation. approval_picker.set_channel_mode (the Trust button on either card, the kickoff select, /kirocrew approval) changes the channel's session through apply_approval_mode, whose creator-mode cascade (fix(dashboard): workers follow their conductor's approval mode after dispatch #25866, approval_inheritance) carries the change to the workers that inherited it. That cascade is the only way a raise reaches a worker. This feature adds lowering only, where the cascade does not reach: workers a person raised on the dashboard and the whole _created_by tree (a worker's own workers, Slack-linked ones). Each change writes the dashboard's audit row plus a slack.code_channel.approval_mode row naming the worker. A worker the change could not lower is named in the reply.
  • Commit-time fence. Each worker lowering passes a still_live predicate: the exact worker object is still registered, still in the channel's lineage, and the mode still lowers it. Any change but to Normal re-runs commit 1's gate checks (agent_picker._still_admitted after taking the channel lock, _sync_gates at each grant's commit, which include the per-channel governance ceiling), Trust to Reads included, because a slot put on Reads hands Reads to inheriting sessions on Normal. A worker lowering to Reads that a closed gate refuses falls back to Normal (not while YOLO is on, since a Normal write ends it everywhere). Every slot's window is loaded off the loop first, and a Trust raise whose descendant window cannot load changes nothing. Normal, and a Reject, are never held back.
  • Pending prompts. A raise to Trust answers the channel's and the workers' waiting tool prompts through that call's own slot-scoped sweep. Each card says "Ran under Trust" in place only if its exact future was still waiting and was approved after the grant's last fence. Person-only ask_question cards are never answered.
  • Command once. A card shows a JSON input's command in its own code block, other arguments only when there are any; decoded parts are redacted again, and an input with control or format characters is shown raw.
  • Cancellation. A cancelled change drops the cards it kept and releases the worker cards it claimed.

Premise (for the maintainer override)

Approval mode (#21997). First Principles blocked an earlier #21997 head because per-channel mode changes contradicted its old ## Not a goal ("No per-channel override") and because the worker relay, live-worker propagation and top-level cards were outside its stated Goal. Kyle ruled (2026-10-23) to amend the Goal rather than split, and the Goal above owns all of it:

  • the kickoff select, /kirocrew approval and Trust this channel are the Goal's per-channel mode changes, owner-only, through apply_approval_mode, with no approval store of their own;
  • the worker approval relay and live-worker propagation came from Kyle's live tests of builds 3 and 5 (a worker's prompt was invisible in Slack, and channel Trust did not reach a running worker);
  • approval cards post top-level in the channel by Kyle's request;
  • the earlier "Trust excluded in group channels" decision is reversed for code channels by Kyle's approval of all three modes there.

One PR for both. The approval-mode work was squash-merged into this branch by a maintainer, so this PR now carries both; they share the kickoff, authorize and the /kirocrew sub-command parse, and the second builds on the first's gate re-checks.

Trust from Slack follows the dashboard's creator-mode rules. On this base, a channel's Trust reaches a worker only through main's creator-mode cascade (#25866), exactly as a dashboard Trust on the same conductor would; #21997's own per-worker raise is removed rather than kept as a second copy of those rules (Sensitive change below). This narrows #21997 as reviewed; it widens nothing.

The override is the maintainer's to post; nothing here posts it.

Sensitive change

Head commit: 52f9789151e5fb349e6846ab7dab7d4ebefa1357

No Sensitive Change Review watched path is touched (security_posture*.py, exfil.py, security/, sandbox_*, gate_tiers.py, governance.py). The behaviour below is security-relevant, so it is spelled out for review. Every change narrows what a Slack Trust raise can reach.

  • Trust raise gating.
    • Before: a channel's Trust raised every direct, unlinked worker whose _created_by named the channel's session, through apply_approval_mode as a person's pick. That included an edge read back from an editable file after a restart, a worker linked to another session (whose other slots were raised with it), and a crewmate's worker.
    • After: this feature raises no worker itself. The channel session's own apply_approval_mode raises its workers through main's creator-mode cascade (approval_inheritance.plan_descendant_postures via slot_approval._apply_inherited_postures), under its rules: inherited posture only, never a crewmate's worker, only along a gateway-written creation edge (never a linked session), only to a slot alone on its session. On a channel already on Trust nothing is raised; a worker card's Trust this channel there approves only that one call. Lowering stays this feature's own, and reaches every worker above the channel.
    • Worst case / undo: a worker the owner expected to follow a Slack Trust stays on its own mode and keeps asking (the safe side); the owner trusts it on the dashboard. Reverting this commit restores feat(slack): start code-channel sessions in a configured approval mode #21997's wider raise.
  • Per-channel governance ceiling.
    • Before: the agent select, the Approval mode select, Trust this channel and the worker cards' Approve / Reject / Trust checked only the member-level channels gate, not the per-channel allowed_channel_ids ceiling, so a channel the policy had since refused could still be switched to Trust, have its pending calls approved, or have its agent switched.
    • After (each guard has its own test that fails with only it removed): interactions.dispatch's agent-select branch and worker_approvals.dispatch_card_click apply channel_refusal before any side effect, as the Archive, OPTIONS and tool-approval branches do; agent_picker.authorize refuses on it silently (audited; nothing is written into the refused channel, and the live SlackClient refuses writes there anyway via require_channel); and agent_picker._sync_gates includes it, so every commit-time fence (the agent switch's still_permitted, a raise's grant fence, a worker card's re-check after its awaits) re-reads it. Only a change to Normal is never held back by it.
    • Worst case / undo: a refused channel's owner must change its mode or agent on the dashboard.
  • Card claim order.
    • Before: each worker's relayed card was claimed inside that worker's own grant.
    • After: the channel's own grant now raises inheriting workers and sweeps their prompts (the cascade), so their cards are claimed before it, recorded at its fence, and settled afterwards: "Ran under Trust" only for a prompt that grant approved; anything answered elsewhere says how it ended; a cancel releases the claims.
    • Worst case / undo: a card shows a less specific line ("approved in the dashboard"); no approval changes.
  • Dashboard-set workers.
    • Before: a worker a person set to Normal on the dashboard was raised by a Slack Trust anyway.
    • After: it is never raised from Slack (the cascade skips a mode a person set) and is still lowered with the channel. The seed (seed_slot_approval) marks the mode it sets as the slot's own, as main's crewmate seed does.
    • Worst case / undo: that worker keeps asking until its owner changes it.

Review round on 5c546bc597 (each fix with a test that fails without it): UX blocked the one-click Trust this channel, now behind a confirmation, as is the Approval mode select; normal is the command word shown for Normal; the Settings preview row reads Approval mode like its field; and the hint points at the channel's first message or /kirocrew approval. GPT blocked three test awaits that depended on a cancellation with no deadline; they are bounded with kiro_crew.testing.wait and drained in finally. Neither change touches the Trust-raise gating above.

Review round on 906b367369: GPT and Opus (security-class) found the missing per-channel ceiling, fixed above; First Principles found the per-worker raise duplicating main's cascade, removed above. Tests (each fails without its fix, checked in scratch worktrees): a restored, unverified edge; a linked worker and its session's other slot; a crewmate's worker; a worker sharing its session; a person-set worker; a worker that turns ineligible while the raise awaits; worker cards say "Ran under Trust" and a worker card's Trust click is answered as approved; a dashboard lowering after a Slack raise still reaches the worker; on a channel already on Trust no worker is raised and a worker card's Trust approves only its own call; and a channel the policy refuses changes nothing from the agent select, /kirocrew agent, the Approval mode path, the Trust card or a worker card, including when the policy narrows mid-switch or mid-raise.

Review round on 528648ee73: Opus found each cascade-swept worker card written twice, the second time without its header (the channel's own-card rewrite now gets only the channel's cards); GPT found a descendant window that failed to load ignored before a Trust raise (now refused before anything changes). The fresh-context review's should-fixes are fixed with fail-first tests: Trust to Reads is gated (channel and worker fences), apply_approval_mode's Reads branch re-checks its fence after its awaited trust-scope ending, a policy refusal posts nothing into the channel, and each policy guard (dispatcher card and agent-select branches, authorize, _sync_gates) has its own test, mutation-checked one guard at a time. First Principles' block on the remaining Slack-only lowering pass is a premise call, left for the owner.

Channel-policy audit of every Slack handler this PR adds (each refuses a channel allowed_channel_ids refuses before any side effect and again at its commit, each pinned by a refused-channel test and mutation-checked): the kickoff agent select and /kirocrew agent (dispatcher or /kirocrew gate, then authorize; commit _sync_gates in the switch), /kirocrew approval and the Approval mode select (authorize; set_channel_mode's grant fence), "Trust this channel" (authorize; the grant fence, then _sync_gates before its hand answer), a worker card's Approve / Reject / Trust (dispatch_card_click, authorize; the policy at the commit for every button, Reject included), and the worker card relay (the policy right before it posts). The session's starting approval mode is not seeded on a channel the policy refuses. These guard points are listed in surface.policy_gated_handlers() beside #21429's. A change to Normal is the one deliberate exemption at the commit: it only takes grants away, and its entry checks still refuse.

Worker lineage: a worker card is relayed, and answered from Slack, only for a creation edge the gateway minted or the crew log records (approval_inheritance._verified_child, the check the creator-mode cascade uses; a linked session never qualifies), never for a _created_by read back from an editable transcript. It is checked when the card is relayed, again right before it posts, when a click arrives, after authorize, inside the Trust button's own grant fence and before its own answer. Lowering still reaches a worker that cannot be verified (it only takes a grant away, and a real worker restored after a restart must not be left on Trust); the reply then names it only as "a session". Code-channel text reaches Slack and the dashboard through the shared display_safe_for sink (surface.display_text), not direct redactor calls; the wrap-up post delegates to it too. Right before a worker card posts, the relay re-reads lineage, the channel's egress (mirror pause, origin, Slack Stop) and the channel policy, with no await between those reads and the post. Lowering a worker only ever takes grants away: the shared mutation's creator-mode cascade runs lower-only for it (apply_approval_mode(cascade_may_raise=False)), a raise anywhere in that cascade now needs every edge above it gateway-authored, not just the last (approval_inheritance.plan_descendant_postures), and a lowering to Reads that would raise another slot sharing the worker's session lands on Normal instead. A deny-override prompt is never relayed to the channel: like the linked mirror, it is answered on the dashboard alone, since a Slack Approve on it would be read as a decline under a card saying "Approved". Every owner control (the agent select and /kirocrew agent, the Approval mode select, confirm and command, both Trust buttons) acts on the channel's session only while it is still the one the binding recorded (binding.channel_session): the slot's key is the binding's session_key and it carries no linked_session_key, since a code channel's session is never linked and a link read back from its transcript names some other session. It is checked at entry and again at each commit fence. A worker card also names the call's proven MCP server and tool (MCP tool: *server* / *tool*) exactly as the linked card does: the runner passes the event's mcp_server_name, tool_name and mcp_identity_trusted through the relay, and an unproven identity is not shown.

Owner-only, by identity (owner decision). Every control that changes a code channel's approval mode or agent (the kickoff selects, the private confirmation, /kirocrew approval, /kirocrew agent, Trust this channel, a worker card's Trust) checks the clicking or sending user with is_owner, at entry (agent_picker.authorize) and again at each commit fence (agent_picker._sync_gates), never the widenable is_allowed_user allow-list, being in the channel or a value in the payload; anyone else is refused privately and audited. The dashboard route already requires the owner's own request (deny_non_dashboard_caller). Recorded in the Slack Code RFC §3.4 and slack-gateway.md as the one exception to the group-channel no-Trust rule.

Confirmation race (GPT). A Reads/Trust confirmation is checked and spent with no await in between, after authorize, and carries the channel's request number: any later mode request voids it, and a raise commits only while it is the channel's latest request and the mode it started from still holds (a dashboard change meanwhile voids it). The by-hand answers of Trust this channel and a worker card's Trust also require the channel to still be on Trust, so a revoke during their awaits approves nothing.

Backwards compatibility

Compatible, with one change of meaning: in a bound code channel, /kirocrew agent <name> now switches only that channel's session. It no longer reaches events_slash._handle_agent there, so it no longer sets the app's global default agent. Outside a code channel /kirocrew agent is the app's own command, as before. Pinned by test_kirocrew_agent_name_switches_the_channel and test_kirocrew_agent_outside_a_code_channel_is_the_apps_own_command.

The new approval_mode key is optional and defaults to today's behaviour (ask); an existing config without it, or with any other value, keeps every new code channel asking. SlotAgentSwitchCaller.still_permitted and apply_approval_mode's still_live default to None, so every existing caller is unchanged. The crewmate seed's behaviour is unchanged (test/test_member_approval_default.py passes as is).

Removes nothing: _seed_member_approval keeps its name, signature and outcome and only delegates its body; src/kiro_crew/dashboard/slack_code_settings.py's agent list and its tests are the base's.

Tests

Commit 1:

  • test/test_slack_code_channel_agent_picker.py (new): the kickoff select and its preselection (zero config, card default, folder default); the 100-option and 75-character label caps; the owner's pick through switch_slot_agent and the redraw; non-owner refusals in the handler and through interactions.dispatch; a pick during a turn and while sub-agents run; /kirocrew agent switch, unknown name, non-owner, bare listing, pass-through outside code channels; the code channel's own activation; the app scope; list parity with _choosable_agent_names().
  • Hardening (each fails without its fix): the off-loop window load before the switch and the announcement; a failed load refusing before anything commits; every gate closing during the pre-commit awaits (activation off/review, archived in-process and stored, Slack denied, feature off, owner removed, workspace denied); every synchronous gate closing inside the transaction (caller_not_permitted); a rebind during the awaits; a cancel before the commit; a switch that raises; a redacted refusal reason; the workspace checked before any side effect; a stale kickoff; a forged typed name.
  • test/test_agent_slash_command.py::test_a_caller_whose_gate_closes_before_the_commit_is_refused: the real switch_slot_agent reads still_permitted at its commit.

Commit 2 (#21997):

  • test/test_slack_code_channel_approval_mode.py: config parse and round-trip; resolution; Settings GET/PUT; the runtime seed with the real create_bound_session (flags, policy, exactly one SEL record; ask untouched; retracted session records nothing; YOLO untouched).
  • test/test_slack_code_channel_approval_select.py (27), test/test_slack_code_channel_trust_from_slack.py and test/test_slack_code_channel_worker_approvals.py (49), test/test_slack_code_channel_mode_reaches_workers.py (27), test/test_slack_code_channel_approval_prepush.py (54): the select and command, Trust this channel, the worker relay, propagation and its fences, as described above. Each new gate was mutation-checked.
  • website/src/test/SettingsSlackCodePanel.test.tsx, website/src/test/settingsCoverage.test.ts, test/test_slack_code_settings.py: the Settings picker and its warning.

Manual verification

There is no live pilot workspace, so the Slack side is verified only against fakes and recorded payloads. The Slack frames below are drawn from the exact Block Kit JSON the code emits, in a Slack-style page: a mock, not a Slack client capture. The Settings frames were captured from the built SPA with canned API responses.

Review history (commit 1): a fresh-context adversarial review found one Critical (/kirocrew agent was captured outside code channels) plus Medium/Low issues; all fixed with regression tests. First Principles then blocked on the widened agent list (restored to the _choosable roster) and the held mid-turn pick (deleted; a mid-turn pick answers turn_in_flight). Opus found a double transcript row per switch: fixed with notice=False; First Principles item 8 (delete _announce instead) answered by keeping it, the house pattern for a caller writing its own /agent line, which also marks a pick made before the first message. GPT 6.1 then blocked at 09bfe4f79e (no-blocking-call-on-event-loop): fixed for the whole path with the off-loop window load, and the gate re-check class closed end to end with still_permitted, after two more fresh-context reviews.

Why both /kirocrew agent and the in-turn @bot /agent (crew-pr-reviewer r113): Kyle asked for both doors. They are one switch; the slash command posts nothing to the channel, answers ephemerally, and a bare /kirocrew agent lists the agents a person may pick.

Screenshots / video

Trust copy and resolved cards (current head). Both Trust confirmations now say who can undo Trust and how (only Kiro Crew's owner, by picking Normal in the first message; helper sessions follow). The two cards after Trust are shown: the channel card resolved by Trust this channel, and a helper session's card that ran under Trust. The override note leads with what it does and names YOLO after it. Settings describes Reads and Trust for new code channels. Slack frames are rendered from the exact Block Kit JSON the code emits, in a Slack-style page: a mock, not a Slack client capture. Frames that showed older copy were removed.

Channel approval card after Trust this channel succeeds:
Channel card resolved by Trust, light
Channel card resolved by Trust, dark
Helper session's card after the Trust sweep approved its call:
Worker card ran under Trust, light
Worker card ran under Trust, dark
"Trust this channel?" confirm, now saying who can undo it and how:
Trust this channel confirm, light
Trust this channel confirm, dark
Kickoff select, private "Switch to Trust" confirm, same undo line:
Switch to Trust, light
Switch to Trust, dark
Kickoff while the all-sessions override is on, leading with what it does:
Override on, light
Override on, dark
Settings → Code channels: Reads and Trust described for new channels, not "this chat":
Settings, Reads picked
Settings, Trust picked

The warning line after a switch to Trust (unchanged):
Trust warning, light
Trust warning, dark

Agent picker (current head). Each option leads with a plain role and the name (Team lead (kirocrew-team-lead)), and its description line says what that shipped agent is best for, written to fit uncut, so no two options read alike. Only an agent Kiro Crew doesn't ship shows its own description, cut at a word. Drawn from the exact Block Kit JSON the code emits, with the real shipped agents:

agent picker opened: each shipped agent with its own uncut best-for line

Earlier round. /kirocrew agent lists one line per agent with its description. The approval command is named after the mode (/kirocrew approval normal|reads|trust); the /kirocrew trust spelling and the ask/all words never reached main and are gone (each is now refused as unknown). The YOLO line leads with the effect (every tool runs without asking, in every session, whatever the select shows), then what turns it off. Settings keeps Trust's description, with the warning below it. Trust this channel? confirms with a red (danger) button on both cards, the same colour as the select's Switch to Trust, and on a worker's card the dialog says it approves the worker's call and puts the whole channel on Trust. The docs (slack-setup.md, the Slack gateway spec) teach approval normal|reads|trust, with trust … only as an alias. Frames 1-5 and 7-8 are rendered from the code's own Block Kit JSON with the shipped agents' real descriptions; frame 6 is the real built SPA with fixture API data.

3 /kirocrew agent reply, one line per agent
4 /kirocrew approval reply names the command after the mode

UX review round. The button keeps the label Trust this channel: it is the name Kyle approved in his 2026-10-23 rulings. What it does is spelled out where it is pressed: the button opens a "Trust this channel?" confirm saying it approves this call and puts the whole channel on Trust, and a Reads or Trust pick in the Approval mode select asks privately, naming the mode. The frames below show both dialogs, the select opened (kickoff and Settings), the shipped Trust warning (/kirocrew trust normal) and the current Settings hint; frames whose text changed since were replaced. The worker card header now says whose worker it is ("A worker this channel started (…)"). The "no picker" frame is the state where the agent list could not be read, not a non-owner view: Slack shows one message to everyone, and a non-owner's pick is refused privately ("Non-owner refused"). Each mode is now explained where it is picked: the kickoff carries a line under the Approval mode select ("Normal asks before every tool · Reads runs read-only shell commands on its own and asks for the rest · Trust runs everything without asking"; Block Kit options cannot carry a description), and Settings shows the picked mode's description (the dashboard picker's own text) under the field, with Trust's channel warning in its place on Trust. The select carries no dialog: Block Kit confirms a select as a whole, so its dialog could never name the pick. Picking Reads or Trust changes nothing and replies privately with what the mode does and a button that names it ("Switch to Reads" / "Switch to Trust"; one click, pinned to the channel's session, good for 10 minutes); Normal applies at once. Someone other than Kiro Crew's owner is told who can change it. Settings gives Normal a source note too ("Built-in default").

Kickoff with the modes line

Approval mode select open

Settings: Approval mode select open

Kickoff with the agent picker on the default, kirocrew-conductor:

Kickoff with agent picker

The picker open, listing the _choosable roster:

Picker open

After a pick:

After a pick

/kirocrew agent, with an unknown name and then a valid one:

/kirocrew agent

Kickoff with both selects:

Kickoff modes line, dark

Approval cards in the channel:

Code channel card: Approve, Trust this channel, Reject

Settings → Code channels, default (Normal):

Settings: Normal, Built-in default

Pick during a turn, text fallback, non-owner refusal, dark and light themes

Pick during a turn refused

Fallback: no picker

Non-owner refused

Code channel card, dark

Related Issues

Builds on #21429 (merged). Carries #21997 (merged into this branch). #22001 stacks on this PR.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (docs/guides/slack-setup.md: "Choosing each code channel's agent", "Approval mode for code channels")
  • No secrets, credentials, or internal references in the diff

@kyleseaman
kyleseaman requested review from a team and KiroCrewCaptain as code owners October 19, 2026 00:15
@kyleseaman
kyleseaman requested review from chenmingwei23 and removed request for a team October 19, 2026 00:15
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

No blocker. The reader understood every primary control; it held back only on the Trust confirmations, which are red danger buttons and correctly read as risky.

Notes

  • About half the 40 screenshots show older wording. Examples: the green confirm button (shots 23–25), "Normal asks before every tool" (08, 16), /kirocrew trust normal (32), and the Settings hints "In this chat…" and "read-only shell commands" (13, 17). The reader found these contradictory. None shows the current Settings text "In each new code channel and the sessions it starts…". Replace the stale images with shots of the current build.
  • NOT_ALLOWED_TEXT ("⛔ You can't change this channel's agent." / "…approval mode."): the reader said "It doesn't say why, or who can change it." Add "Only Kiro Crew's owner can." to both.
  • MODES_NOTE / the "Reads" label: the reader asked "why a mode called 'Reads' is about searching memory and past chats." In the note, start Reads with what it adds, e.g. "Reads also reads memory, past chats, skills and knowledge on its own".

[UX-REVIEWED] 52f9789

Description read

[DESCRIPTION-READ] 1e60397595520f35b38ccbfc785059eeb9bb871fb89264c5e7285928c6ae5a99

That sha256 names everything this verdict read: the PR description, plus the 43 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 added the readiness: checking Automated validation is still running label Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: both pickers reuse the dashboard's audited transactions, and the approval-inheritance change only tightens raises.

Notes

  • When a code channel is on Trust, every allow-listed member's message drives a session that approves all its tools, not just the owner's messages. The owner-only gate covers who can change the mode, not who can prompt the agent. The §3.4 decision record should say this outright, since the decision is still waiting on the owner.
  • plan_descendant_postures now needs every edge above a raise to be gateway-authored, not just the last one. That changes behaviour for every dashboard creator-mode cascade, not only Slack, yet the description's visible text only mentions narrowing to fix(dashboard): workers follow their conductor's approval mode after dispatch #25866. Name it as its own change in the description.

[DESIGN-REVIEWED] 52f9789

Description read

[DESCRIPTION-READ] 955505d8d7cdf0d1e1786df597df6621f2e8c52a93eec053367a7f7887f3a28f

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ human override accepted

@kyleseaman overrode this lane for 52f9789151e5fb349e6846ab7dab7d4ebefa1357 via /ai-review override (this commit only).

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 52f9789151e5fb349e6846ab7dab7d4ebefa1357 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 52f9789

Verdict parsed from the review's SHA-scoped output markers for commit 52f9789151e5fb349e6846ab7dab7d4ebefa1357.

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

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 52f9789151e5fb349e6846ab7dab7d4ebefa1357 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 52f9789

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

@kyleseaman
kyleseaman force-pushed the feat/slack-code-channels-agent-surface branch from c9289e3 to e6a8146 Compare October 19, 2026 00:31
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

  • No sensitive path changed; nothing to check.

@kyleseaman
kyleseaman force-pushed the feat/slack-code-channel-agent-select branch 2 times, most recently from 7d192f9 to b7c23f8 Compare October 19, 2026 00:40
@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 19, 2026
@kyleseaman
kyleseaman force-pushed the feat/slack-code-channels-agent-surface branch from e6a8146 to 408d621 Compare October 19, 2026 13:03
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 19, 2026
@kyleseaman
kyleseaman force-pushed the feat/slack-code-channels-agent-surface branch from 408d621 to 90250b1 Compare October 19, 2026 13:41
@kyleseaman
kyleseaman force-pushed the feat/slack-code-channel-agent-select branch from 2a7700d to 9312e70 Compare October 19, 2026 14:20
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 19, 2026
@kyleseaman
kyleseaman force-pushed the feat/slack-code-channel-agent-select branch from 9312e70 to 5137e5a Compare October 19, 2026 16:53
@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 readiness: checking Automated validation is still running labels Oct 19, 2026
@kyleseaman

Copy link
Copy Markdown
Contributor Author

UX evidence for the mode explanations (current head). Slack frames: rendered from the exact Block Kit JSON the code emits, in a Slack-style page (a mock, not a Slack client capture). Settings frames: the real built SPA with fixture API answers.

Kickoff: the line under the Approval mode select now says what Normal, Reads and Trust each do. Settings → Code channels: the picked mode's description shows under the field (Normal, Reads); on Trust the channel warning stands in its place.

Kickoff: what each mode does

Kickoff modes line, dark

Settings: Normal explained

Settings: Reads explained

Settings: Reads, dark

Settings: Trust and its warning

@kyleseaman

Copy link
Copy Markdown
Contributor Author

UX evidence for the current head. Slack frames are rendered from the exact Block Kit JSON the code emits, in a Slack-style page (a mock, not a Slack client capture). Settings frames are the real built SPA with fixture API answers.

The Approval mode select no longer carries a fixed dialog (Block Kit confirms a select as a whole, so it could never name the pick). Picking Reads or Trust now changes nothing and replies privately with what that mode does and a button that names it ("Switch to Reads" / "Switch to Trust", one click, 10 minutes). Normal applies at once. Also shown: the line under the select saying what each mode does, the YOLO line, and Settings with Reads explained and Normal's source as "Built-in default".

Kickoff with the modes line

Approval mode select open

Private confirm: Switch to Reads

Private confirm: Switch to Trust

Switch to Trust, dark

Kickoff with the YOLO line

After Trust: warning line

Settings: Normal, Built-in default

Settings: Reads explained

Settings Reads, dark

@kyleseaman

Copy link
Copy Markdown
Contributor Author

UX evidence for the agent picker and approval copy fixes (rendered from the code's own Block Kit JSON and the shipped agents' spec descriptions; the Settings frame is the real built SPA with fixture API data).

  1. Kickoff: each agent option carries what it does.
  2. Agent select opened.
  3. /kirocrew agent: one line per agent, with what it does.
  4. /kirocrew approval: the help names the command after the mode.
  5. YOLO on: says it covers the whole gateway and how to turn it off.
  6. Settings, Trust picked: Trust keeps its description, with the warning below it.

1 kickoff
2 agent select opened
3 /kirocrew agent reply
4 /kirocrew approval reply
5 YOLO note
6 Settings Trust picked

@kyleseaman

Copy link
Copy Markdown
Contributor Author

UX evidence for the Trust confirmation and YOLO line (rendered from the code's own Block Kit JSON).

7 channel card: Trust this channel? confirms in red
8 worker card: the dialog says it approves the worker's call, confirms in red
9 YOLO on: leads with the effect

@kyleseaman

Copy link
Copy Markdown
Contributor Author

UX evidence for the agent picker (rendered from the code's own Block Kit JSON with the shipped agents' real spec descriptions; headless Playwright, a Slack-style mock): each option has a plain label that tells it apart and is never cut, and what the agent does on the option's own description line.

agent picker opened: plain labels, description lines

@Zedmor

Zedmor commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Code change approver recommendation: A person should decide

Automated, not a person, and not a review: a maintainer still decides.

decider-v3c@217fe607 · p_defect 0.72 · router R0 (approves only when p_defect <= 0.12, on changes of at most 400 changed lines) · head a3ab6ce49b · 10264 changed lines

Why: the decider flagged 1 possible problem (p_defect 0.72); a person should check it.

This PR adds the code-channel agent picker and approval mode. I'm requesting changes. The new worker approval relay builds its Slack card without the event's trusted MCP identity. Owners can approve a worker's MCP call, or put the whole channel on Trust from that card, without seeing which server runs it. Every other Slack approval card, including the linked card in the same function, shows that line. No test checks the identity line on worker cards. Separately, the product decision for Trust in group channels has no recorded owner override yet.

Things to check (the decider's concerns; it is right less than half the time):

  • [data_loss_or_fail_open/medium] The new worker approval relay is a new Slack approval surface, and it drops the proven MCP server/tool line. The owner approves a worker's call, or presses "Trust this channel", which puts the whole channel on Trust, based on the title the model chose plus the raw input. The card never says which MC (src/kiro_crew/slack/code_channels/worker_approvals.py)

If this recommendation is wrong, reply here; the replies are how the approver is evaluated.

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

Request changes at f932d40, for one point.

Blocking: a new regex in product code. slack/code_channels/approval_picker.py adds _COMMAND_NAME = re.compile(r"[a-z0-9_-]{1,32}"), and _command() uses it with fullmatch to decide whether a configured slash-command name may be echoed into a channel. We don't take new regex in product code. An exact character check does the same job and is easier to read:

_COMMAND_CHARS = frozenset(string.ascii_lowercase + string.digits + "_-")

def _is_command_name(name: str) -> bool:
    return 1 <= len(name) <= 32 and all(ch in _COMMAND_CHARS for ch in name)

Use it in _command() in place of _COMMAND_NAME.fullmatch(routed) and drop import re. A small test for a name that is too long, has an upper-case letter, or has a space would pin it. The rest of the added product code has no regex.

What I read and found sound:

  • approval_picker.py in full: owner-only authorize before any change, and every raise re-checks the gates at its commit. Normal is never held back. Trust is said in the channel. The confirmations are single-use, tied to the session, the latest intent and a 10-minute TTL. Every decision writes a SEL row.
  • worker_approvals.py: the relay posts only for a verified direct child of the channel's current session, and re-checks the egress gates past each await. Answers go through the slot-scoped resolve_slot_approval pinned to the card's future.
  • The agent_picker.py switch: iamwhatever's two-rows point is fixed. _switch now builds the caller with notice=False, and _announce writes the one row.
  • Small pieces:
    • binding.channel_session refuses a slot whose transcript-read link names another session.
    • slot_approval_seed.py is the crewmate seed moved out, with its behaviour unchanged.
    • still_live / still_permitted / cascade_may_raise only apply when the new Slack callers pass them.
  • approval_inheritance: a raise now needs every edge above it to be gateway-verified, not only the last one. That applies the cascade's existing verified-edge rule to the deeper walk it skipped, so I read it as restoring main's boundary, not adding strictness.

CI: the 5 cancelled runs each have a newer success on this head. Everything else is green.

iamwhatever
iamwhatever previously approved these changes 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.

Follow-up to my request-changes, after reading the rest of the product diff at f932d40 (the rest of agent_picker.py, wrapup.py, enterprise.py, events_slash.py, features.py, format.py, handler_runtime/approvals.py, interactions.py and the Settings page). There's one more small thing, so you can do it in the same round:

  • Unrelated reformat of slack/enterprise.py. The PR drops it from .github/black-baseline.txt and reflows it. That's out of scope here, and the reflow leaves implicit string concatenations where two literals used to sit on separate lines: "Failed to read slack.allowed_enterprise_ids; failing closed " "with no origin admitted", and "Enterprise validation: auth.test unavailable; " "continuing default-open". Please either revert the enterprise.py and baseline change and leave it to its own PR, or join each pair into one literal.

Everything else in that part reads fine:

  • The app-command routing (events_slash now hands the app's own slash command to handle_slash) returns False before any gate or side effect unless the text is agent or approval in a bound code channel.
  • The "Trust this channel" button and the command-once card rendering are only added under channel_trust, with mrkdwn and code-fence escaping on the agent-authored parts. Decoded JSON parts are redacted again, and command_and_rest refuses input whose decode would surface hidden characters.
  • The owner-refusal audit rows in interactions.dispatch match the pickers' own.
  • The agent pick goes through the channels policy plus channel_refusal pair before handle_select.
  • The Settings field stores ask as unset, the same way the backend validator does.

The _COMMAND_NAME regex in my review above is still the one blocker.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

@bolichen97 thanks, both fixed in a3ab6ce49b5b0195026d0bd5eb7232d7eb666440 (still 2 commits, rebased on main), re: your review:

  1. No new regex. approval_picker._command() now checks the name with _is_command_name (1 to 32 characters, each in frozenset(string.ascii_lowercase + string.digits + "_-")); _COMMAND_NAME and import re are gone. New tests refuse an empty name, 33 characters, upper case, a space, a trailing \\n and a non-ASCII letter, and accept 1 and 32 characters. No other code this PR adds uses re.
  2. Out-of-scope reformat reverted. src/kiro_crew/slack/enterprise.py and .github/black-baseline.txt are back to main's versions and no longer in the PR's diff. The black gate passes without pruning, as it does on main.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

UX evidence for 69beb755de4e9f814abd4d152330fe9ec8b60de8: the Trust copy no longer says "running workers". Every Trust text now names them as any helper sessions it starts, including ones already running, and the worker card says "A helper session this channel started (…)". Rendered from the exact Block Kit JSON the code emits, in a Slack-style page: a mock, not a Slack client capture. The confirm button is red (style: danger), as the code sets it.

Channel card, "Trust this channel?" confirm:
Trust this channel confirm, light
Trust this channel confirm, dark

Kickoff select, private "Switch to Trust" confirm:
Switch to Trust, light
Switch to Trust, dark

The warning line after a switch to Trust:
Trust warning, light
Trust warning, dark

…irocrew agent

The kickoff carries a static_select of the choosable agents (the same roster as Settings' default-agent picker), preselected with the resolved default (card default > folder default_agent > kirocrew-conductor). /kirocrew agent <name> in a code channel switches that channel too. Both run the dashboard's switch_slot_agent as a non-owner caller with notice=False (the picker writes its own /agent line), are owner-only and SEL-audited, and refuse a pick made during a turn with turn_in_flight ("try again when this turn ends").

Also: harden the code-channel agent switch against stalls, closed gates and failures

Load a restored slot's transcript window off the event loop before the
switch transaction and the announcement (notice=False skipped the built-in
notice's load). Re-check the code-channel gates after the pre-commit awaits,
and pass the synchronous ones into switch_slot_agent as the new optional
SlotAgentSwitchCaller.still_permitted, read at its commit, so a gate that
closes mid-switch refuses (caller_not_permitted) instead of committing.

A switch that raises is answered, audited and redrawn; a cancel before the
commit redraws the kickoff; sub-agents get a try-again reply; the refusal
reason is redacted; a pick checks the workspace before any side effect; a
stale or rebound kickoff points at the live one; and a typed value that
can't be an agent name is shown and audited as <invalid>.
#21997)

* feat(slack): start code-channel sessions in a configured approval mode

A code channel's session starts in the approval mode set on the Code
channels card (Normal / Reads / Trust). The channel's owner can change it
from the kickoff message's Approval mode menu, with
/kirocrew trust ask|reads|all, or with "Trust this channel" on an
approval card. Every change goes through apply_approval_mode, the same
audited path as the dashboard picker, and ends a live YOLO grant on Ask.

Approval cards for a code channel post top-level in the channel. Workers
started by the channel's own session relay their approval cards into the
channel; only the owner can answer them, and each click settles only that
worker's waiting call. A mode change reaches the channel session's own
running workers (raise and lower, capped at the channel's mode), and a
raise to Trust approves their waiting prompts the way a mid-wait
dashboard switch does. Person-only question cards are never answered
automatically.

* fix(slack): fence code-channel mode changes and worker cards at the mutation

A lowering reaches every session that inherited the channel's grant (a worker's workers, linked ones) and the reply names any it could not change. Each grant re-checks, right before it applies, that the channel is not archived here, the feature is on and the channel session is the one the caller authorized against. A cancelled change releases the cards it claimed. Worker cards keep the UNVERIFIED warning and post only where the channel's own prompt would. A literal code fence cannot end a code-channel card's code block, and a hand-edited command name is never echoed into the channel.

---------

Co-authored-by: Kyle Seaman <kseam@dev-dsk-kseam-1b-55230d27.us-east-1.amazon.com>

Also folded in: the seam fixes between the agent and approval pickers, and the reconciliation with creator-mode inheritance (#25866): the seed marks its mode as the slot's own, a channel change keeps a worker following its channel, and a raise to Trust reaches a worker only under the creator-mode rules, with its relayed card claimed before the cascade sweep.
@kyleseaman

Copy link
Copy Markdown
Contributor Author

UX evidence for 52f9789151e5fb349e6846ab7dab7d4ebefa1357. Slack frames are rendered from the exact Block Kit JSON the code emits, in a Slack-style page: a mock, not a Slack client capture. Settings frames are the real built SPA with fixture API replies.

Channel approval card after Trust this channel succeeds:
Channel card resolved by Trust, light
Channel card resolved by Trust, dark

Helper session's card after the Trust sweep approved its call:
Worker card ran under Trust, light
Worker card ran under Trust, dark

"Trust this channel?" confirm, now saying who can undo it and how:
Trust this channel confirm, light
Trust this channel confirm, dark

Kickoff select, private "Switch to Trust" confirm, same undo line:
Switch to Trust, light
Switch to Trust, dark

Kickoff while the all-sessions override is on, leading with what it does:
Override on, light
Override on, dark

Settings → Code channels: Reads and Trust described for new channels, not "this chat":
Settings, Reads picked
Settings, Trust picked

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Owner decision: Trust stays available in code channels, owner-only to change. A Slack Code channel's own session offers an owner-only "Trust this channel" on its approval cards, an intentional exception to the group-channel no-Trust rule in slack-gateway.md. Only Kiro Crew's owner, checked by identity (or a user I explicitly authorize), can raise or lower a code channel's approval mode, from the picker, its confirmation, /kirocrew approval or the dashboard. Anyone else, shared users included, is refused and audited. This is recorded in docs/request-for-change/rfc-slack-code-channels.md §3.4 Approval modes in code channels.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles 52f9789 owner-decision: Trust stays available in code channels, owner-only to change; recorded in the RFC. #21991 (comment)

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@kyleseaman recorded a owner-decision release (class owner-decision) for the first-principles AI finding on 52f9789151e5fb349e6846ab7dab7d4ebefa1357.

Trust stays available in code channels, owner-only to change; recorded in the RFC. #21991 (comment)

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

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

Approving at 52f9789, without auto since you hold auto-merge. Thank you: both points from my reviews at f932d40 are done.

  1. The regex is gone. approval_picker.py drops import re and _COMMAND_NAME. It now uses _COMMAND_CHARS plus _is_command_name() (length 1 to 32, each character in the set), and _command() calls it. I searched the saved diff for _COMMAND_NAME, re.compile, the other re. calls, new RegExp and /.../ literals in product code, and found none. The new parametrized tests cover empty, 33 characters, upper case, a space, a newline and a non-ASCII letter, plus the accepted shapes.
  2. The slack/enterprise.py reflow and its baseline change are no longer in the PR.

The rest of the change since f932d40, read in full:

  • The relayed worker approval card now carries the permission event's MCP identity (mcp_server_name, tool_name, mcp_identity_trusted) through relay and start, so it names the proven server and tool like the linked card does. An unproven identity is left out. Both have tests.
  • Trust texts now say "helper sessions it starts, including ones already running", and each raise says only the owner can undo it by picking Normal. YOLO is described before it is named. The test pins those and keeps the confirm texts under Slack's 300-character limit.
  • The concurrency test now freezes the picker's clock and bounds every wait.
  • No new refusals, and no regex in product code.

The newest run of every check on this head is green; the cancelled GPT 6.1 entry has a newer passing run.

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

This changes behaviour users already rely on, so it needs a design sign-off from a maintainer before it can merge. A maintainer will post the decision here.

To propose a design, follow the request-for-change process in CONTRIBUTING.md (docs/request-for-change/).

Review result on head 52f9789: no blocking code defect was found. The review traced each owner-only control to the is_owner gate and to the commit-time re-checks in apply_approval_mode and switch_slot_agent. Those controls are the agent select, the approval select and its confirmation, the "Trust this channel" button and the worker cards. In the review run, the 13 touched backend test files passed on this head. Done well: every change made from Slack goes through the dashboard's own audited mutations. No second store holds approval state.

These decisions stay with the maintainers:

  • The author overrode the First Principles block on this head himself. That block covers a change that lets a group (code) channel run on Trust, which main refuses. A maintainer other than the author needs to confirm it.
  • The diff widens what the approval gate allows in group channels. A maintainer decides that widening.
  • The CHANGES_REQUESTED review from bolichen97 on f932d40 still stands. Its two items look fixed on this head, so it needs a re-review or a dismissal.

For the security review:

  • Code-channel Trust: once a channel is on Trust, every allow-listed user who talks to the bot there drives an agent and its workers, and their tools run without a prompt. The Settings warning says so. No entry in docs/decisions records this exception.
  • plan_descendant_postures in approval_inheritance.py now raises a slot only when every edge above it is gateway-authored. This tightens a dashboard-wide behaviour. session-control.md still says one edge is enough, and the change is not listed under Backwards compatibility.
  • The worker lowering pass in approval_picker.py (_follows_channel) marks a worker that a person set on the dashboard as inherited. A later channel Trust can then raise that worker past the mode the person chose.

Optional:

  • The typed approval trust sub-command raises the channel to Trust with no confirmation step. The select and the card button both confirm first (approval_picker.py handle_command).
  • dispatch_card_click in worker_approvals.py returns True even when the feature is off and the handler refused. The click then gets no reply.
  • The "Permissions" bullet for the agent picker in the PR body names is_allowed_user, but the code checks is_owner.

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.

5 participants