Repository navigation
feat(slack): answer /kirocrew-<alias> and apply slack.command without a restart - #38938
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: Slack delivers only the commands an app registered, so answering every manifest-shaped name removes the restart step without widening who can run commands. The owner gate and SEL audit still run. Notes
[DESIGN-REVIEWED] d15c4f2 Description read[DESCRIPTION-READ] 8846a244a4c5c4110fb430bc682433b38a15ec2758d8da7ceeeb0713bd51ebe3 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. One note: Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: let a Slack app answer its own
[FIRST-PRINCIPLES-REVIEWED] d15c4f2 Description read[DESCRIPTION-READ] 9743d25d041a87b8d53d50c9f41ab01693b0fa1c9dee1c9d1294ebb8256684ad That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
781cc70 to
f67266c
Compare
|
Head
CodeQL |
f67266c to
72330bb
Compare
72330bb to
ae9f81e
Compare
|
Head |
ae9f81e to
73dc4b9
Compare
… a restart Slack delivers only slash commands the app registered, so the gateway now answers /kirocrew and any /kirocrew-<alias> the bundled manifest renders, whatever slack.command says, in both the main router and the code-channel router. Once the owner gate passes, the typed name becomes orch.slack_command, so usage replies, help, the Home tab and the code-channel pickers name a command this app registered. slack.command loses restart=True: the Slack config applier refreshes orch.slack_command, which the Home tab, usage strings and code-channel pickers read. The 'run config set, then restart' wording is gone from kirocrew manifest, the scope-probe reinstall hint, the settings-save comment, the setup guide and the specs. Refs #38901
73dc4b9 to
d15c4f2
Compare
|
Head |
Code change approver recommendation: A person should decideWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 416 lines, more than the 400 it may approve on its own. Both Slack slash routers now use a shared check, Tier: 2, held for a person: security-sensitive path. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. Checks on head d15c4f2:
- Both routers (events_slash.py and code_channels/commands.py) now answer through one predicate,
slack_manifest.is_app_command. - The applier sets the shown name live. The config baseline and the restart-leaf table drop
slack.commandin step with the removed restart mark. - The three ride-along spec files (config.md, messaging.md, slack-gateway.md) match the code.
- The six touched test files pass. Restoring the old routing check and making the applier a no-op reds 5 tests, so the body's red-first claim is accurate.
Security: Gate 3b flagged the change because it touches the manifest module. The risk it guards against does not occur here. Slash payloads arrive only over the Socket Mode listener, so Slack sends only commands this app registered. The owner check and the SEL audit still run before any newly accepted name is handled. The typed name is adopted only after authorization, and a test pins that a refused caller renames nothing in the main router. The adopted name must fully match the manifest pattern or equal an already configured name, so it is safe to echo. The old reply that echoed the name into a shell line is gone.
Well done: the old mismatch reply is replaced by a single predicate, and the matching pattern now sits next to the code that generates the manifest names.
Optional:
- The website and one docstring still describe
slack.commandas restart-only. The affected spots are the comment at SlackPanel.tsx:602-605, the now-unreachableslash_command_needs_restarthint, and the SettingsSlackPanelCoverage.test.tsx fixture, which still asserts a restart badge from a mocked schema. The same applies to theapi_slack_config_savedocstring in slack_settings.py:125-128. - In code_channels/commands.py:474 the adoption of the typed name is not pinned behind
picker.authorize. A test where a non-owner sends an alias in a code channel would lock in that order, as its twin in events_slash.py already is. - In test_slack_manifest_command.py, the
_slashhelper always resetsorch.slack_commandtokirocrew. As a result,test_a_custom_command_still_runs_after_an_alias_was_adoptednever routes while the adopted alias is the shown name. Setting the default only for a fresh mock fixes that.
Partial revert of #38837 (merge 5c68161). The owner decided only the web UI drops emoji; Slack messages and the gateway's console lines keep them. Reverted: every slack/ file outside gateway_runtime/, and in gateway_runtime/ the console prints (channel_lifecycle, exit_path, install_repair, process_entry, service_boot, update_schedule), the Slack approval card (turn_approvals), the Slack-only cron and heartbeat headers (cron_delivery, result_egress) and the subagent status log line (subagent_wiring). Kept plain, because the dashboard shows them: cron_exec, cron_failure, cron_fire, cron_turn, cron_verdict, heartbeat_turns, the dashboard lines of cron_delivery and the heartbeat chat title in result_egress. Conflicts in events_slash, interactions and renderer keep main's later code (#38938, #30760, #39112); only #38837's own emoji come back. Tests that #30760 and #38938 wrote against the plain words now expect the restored glyphs. Refs #38837 Closes #39225
Partial revert of #38837 (merge 5c68161). The owner decided only the web UI drops emoji; Slack messages and the gateway's console lines keep them. Reverted: every slack/ file outside gateway_runtime/, and in gateway_runtime/ the console prints (channel_lifecycle, exit_path, install_repair, process_entry, service_boot, update_schedule), the Slack approval card (turn_approvals), the Slack-only cron and heartbeat headers (cron_delivery, result_egress) and the subagent status log line (subagent_wiring). Kept plain, because the dashboard shows them: cron_exec, cron_failure, cron_fire, cron_turn, cron_verdict, heartbeat_turns, the dashboard lines of cron_delivery and the heartbeat chat title in result_egress. Conflicts in events_slash, interactions and renderer keep main's later code (#38938, #30760, #39112); only #38837's own emoji come back. Tests that #30760 and #38938 wrote against the plain words now expect the restored glyphs. Refs #38837 Closes #39225
Problem / Motivation
Goal: A Slack app whose slash command is
/kirocrew-<alias>works the moment it is installed, and changingslack.commandtakes effect without restarting the gateway.kirocrew manifest(and re-importing the bundled manifest into an older app) registers/kirocrew-<alias>since #18550, but the gateway answers only/{slack.command}. Until the person runskirocrew config set slack.command kirocrew-<alias>and restarts the gateway, typing the command only gets a "run config set and restart" reply.slack.commandis markedrestart=Trueand read once at boot (orchestrator_init.py).Why it matters
Every new CLI-created app, and every older app updated from the bundled manifest, hits this extra config step plus a restart before its own command does anything. It is one of the two restarts in the current Slack setup flow, and the planned settings-page wizard (which names apps after the alias) depends on the alias command working with no restart.
Not a goal
SlackPanel.tsx, and locale strings (separate PR).kirocrew setup --slackdefault (kirocrew, or the configured command).What changed (motivation → approach → change)
Symptom → cause: the router compared the incoming command to
slack.commandonly, and that value could not change in-process. But Slack delivers to an app only the slash commands that app's manifest registered, so a/kirocrewor/kirocrew-<alias>that reaches the gateway is already this app's own command; the comparison added nothing but a manual step.Change:
slack_manifest.MANIFEST_COMMAND_RE(moved fromevents_slash.py, same pattern):/kirocrewor/kirocrew-[a-z0-9_-]+.slack_manifest.is_app_command(command, *names): true for a regex match or/<name>of a given name.events_slash._handle_slashand the code-channel router both call it with the liveslack.command(read throughslack_cfg/live_config) and the shownorch.slack_command, so a custom command stays answered after the shown name changes; the mismatch reply is gone. Owner gating and the allowed/denied SEL audit are unchanged and run for every answered name. Once the owner gate passes, the typed name becomesorch.slack_command, so sub-command usage replies (dashboard,yolo), the fallback help, the Home tab and the code-channel pickers name a command this app registered even whileslack.commandis the default.code_channels/commands.handle_slashtreats the same set as the app's own command (agent/approvalsub-commands) and, once the picker authorizes the owner, adopts the typed name the same way (passed torun_commandasapp_command).events.pydrops the unused_MANIFEST_COMMAND_REre-export; callers useslack_manifest.MANIFEST_COMMAND_RE.sections_slack.SlackConfig.commandlosesrestart=True; its help says it is the name help text shows.channel_lifecycle._on_slack_config_changesetsorch.slack_commandon a change instead of warning about a restart. So the Home tab (events_home_tab.py, no payload, readsorch.slack_command), the usage strings and the code-channel pickers show a new value live.orchestrator_init.pycomment notes it is only the boot value now.kirocrew manifestand the scope-probe reinstall hint still printkirocrew config set slack.command kirocrew-<alias>, now with no restart:GET /api/slack/manifestwith no alias renders from the savedslack.command, so saving it keeps a later manifest update from renaming the command back to/kirocrew.slack_settings.pysave comment,slack_workspace.pydocstring,docs/guides/slack-setup.md, bundledslack-integration.md, and the specs (slack-gateway.md,messaging.mdrestart exception list,config.mdboot-read list).config-baseline.jsonregenerated.Not a product-shape change of a default:
slack.command's default stayskirocrew, and every command answered before is still answered.Backwards compatibility
Compatible: every command answered before (
/{slack.command}) is still answered; additionally/kirocrewand/kirocrew-<alias>are answered instead of getting a mismatch hint.Reader: src/kiro_crew/slack/events_slash.py:_handle_slash -- entry: chat (Slack) -- mismatch reply removed; that name now runs the command (test
TestAnyManifestCommandIsAnswered)Reader: src/kiro_crew/config/sections_slack.py:SlackConfig.command restart flag -- entry: crew page (Settings → Slack restart badge via schema) -- badge reads
requiresRestartfrom schema, now false, so no restart is promised (testTestSlackCommandIsLive::test_the_settings_page_promises_no_restart)Reader: src/kiro_crew/dashboard/messaging_api/slack_settings.py:api_slack_config_save restart_required -- entry: crew page -- now false for a command change (test
test_restart_required_only_on_actual_change)Reader: test/test_channel_boot_keys_contract.py:GATEWAY_RESTART_LEAVES -- entry: release -- Slack entry removed, matches
messaging.mdexception listTests
test/test_slack_manifest_command.py::TestAnyManifestCommandIsAnswered:/kirocrew-aliceruns whileslack.commandiskirocrewand its help names/kirocrew-alice;/kirocrew-alice dashboard badanswersUsage: /kirocrew-alice dashboard ...; non-owner refused, audited denied, and renames nothing; a customslack.command(/crew) still runs after/kirocrew-alicewas adopted;/other,/kirocrew-x;id,/kirocrewxdropped with no audit; reinstall notice keeps theconfig setline and drops the restart. CLI hint tests expect theconfig setline and no restart.test/test_slack_code_channel_agent_picker.py:/kirocrew-alice agent builderswitches a code channel and the pickers name/kirocrew-alicefrom then on;/crewstill reaches the picker after the shown name moved to the alias;/kirocrewxis not the app's command.test/test_slack_home_tab.py::TestHomeTabCommandName: Home tab names the liveorch.slack_command.test/test_channel_boot_hot_reload.py::TestSlackCommandIsLive: applier setsorch.slack_command, no restart warning;channel_restart_required("slack", ["command"])is false. Restart-marked examples moved towhatsapp.db_path.test/test_slack_config_handlers.py: a command save reportsrestart_required: false.Red-first: with the production hunks reverted, the alias-command tests and the applier test fail.
Local: black / isort / flake8 / mypy clean on changed files;
test/test_slack*.py,test/test_channel_boot*.py,test/test_cli_setup*.py,test/test_slash*.py, config/schema/docs suites pass.Manual verification
N/A: no live Slack app or token was used. Slack's per-app command routing is the documented behavior this relies on.
Related Issues
Fixes #38901
Checklist
Contribution License Agreement
Contributed under the project's Apache-2.0 license.