Skip to content

feat(slack): answer /kirocrew-<alias> and apply slack.command without a restart - #38938

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
feat/slack-command-hot-reload
Nov 18, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
feat/slack-command-hot-reload

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A Slack app whose slash command is /kirocrew-<alias> works the moment it is installed, and changing slack.command takes 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 runs kirocrew config set slack.command kirocrew-<alias> and restarts the gateway, typing the command only gets a "run config set and restart" reply. slack.command is marked restart=True and 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

  • The settings-page setup wizard, SlackPanel.tsx, and locale strings (separate PR).
  • Owner identification / Member ID flow (separate PR).
  • Changing manifest scopes or the manifest template.
  • Changing the kirocrew setup --slack default (kirocrew, or the configured command).

What changed (motivation → approach → change)

Symptom → cause: the router compared the incoming command to slack.command only, 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 /kirocrew or /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 from events_slash.py, same pattern): /kirocrew or /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_slash and the code-channel router both call it with the live slack.command (read through slack_cfg / live_config) and the shown orch.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 becomes orch.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 while slack.command is the default.
  • code_channels/commands.handle_slash treats the same set as the app's own command (agent / approval sub-commands) and, once the picker authorizes the owner, adopts the typed name the same way (passed to run_command as app_command).
  • events.py drops the unused _MANIFEST_COMMAND_RE re-export; callers use slack_manifest.MANIFEST_COMMAND_RE.
  • sections_slack.SlackConfig.command loses restart=True; its help says it is the name help text shows. channel_lifecycle._on_slack_config_change sets orch.slack_command on a change instead of warning about a restart. So the Home tab (events_home_tab.py, no payload, reads orch.slack_command), the usage strings and the code-channel pickers show a new value live. orchestrator_init.py comment notes it is only the boot value now.
  • kirocrew manifest and the scope-probe reinstall hint still print kirocrew config set slack.command kirocrew-<alias>, now with no restart: GET /api/slack/manifest with no alias renders from the saved slack.command, so saving it keeps a later manifest update from renaming the command back to /kirocrew.
  • Wording: slack_settings.py save comment, slack_workspace.py docstring, docs/guides/slack-setup.md, bundled slack-integration.md, and the specs (slack-gateway.md, messaging.md restart exception list, config.md boot-read list). config-baseline.json regenerated.

Not a product-shape change of a default: slack.command's default stays kirocrew, and every command answered before is still answered.

Backwards compatibility

Compatible: every command answered before (/{slack.command}) is still answered; additionally /kirocrew and /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 requiresRestart from schema, now false, so no restart is promised (test TestSlackCommandIsLive::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.md exception list

Tests

  • test/test_slack_manifest_command.py::TestAnyManifestCommandIsAnswered: /kirocrew-alice runs while slack.command is kirocrew and its help names /kirocrew-alice; /kirocrew-alice dashboard bad answers Usage: /kirocrew-alice dashboard ...; non-owner refused, audited denied, and renames nothing; a custom slack.command (/crew) still runs after /kirocrew-alice was adopted; /other, /kirocrew-x;id, /kirocrewx dropped with no audit; reinstall notice keeps the config set line and drops the restart. CLI hint tests expect the config set line and no restart.
  • test/test_slack_code_channel_agent_picker.py: /kirocrew-alice agent builder switches a code channel and the pickers name /kirocrew-alice from then on; /crew still reaches the picker after the shown name moved to the alias; /kirocrewx is not the app's command.
  • test/test_slack_home_tab.py::TestHomeTabCommandName: Home tab names the live orch.slack_command.
  • test/test_channel_boot_hot_reload.py::TestSlackCommandIsLive: applier sets orch.slack_command, no restart warning; channel_restart_required("slack", ["command"]) is false. Restart-marked examples moved to whatsapp.db_path.
  • test/test_slack_config_handlers.py: a command save reports restart_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

  • 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 (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision d15c4f2f780aabff3cc5adec060503c6379cfbc2 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

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

  • orch.slack_command now has two writers: the config applier and "the owner typed a name" in _handle_slash and code_channels/commands.handle_slash. After a gateway restart, the Home tab and usage replies go back to slack.command (/kirocrew by default) until the owner types the alias again. Deriving the shown name from one source, such as the saved alias or the configured command, would remove the second writer and the stale name after restart.

[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 .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 Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of d15c4f2f780aabff3cc5adec060503c6379cfbc2 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. One note: is_app_command takes a variadic name list, and the orch.slack_command argument both callers pass never decides the result.

Notes

  • Item 6 — one consumer, generalized: is_app_command(command, *names). Both call sites (events_slash.py:766, code_channels/commands.py:373) pass the same pair, orch.slack_command and the live slack.command. Across its three writers (orchestrator_init.py:118, channel_lifecycle.py:733, the owner's typed name at events_slash.py:796 / commands.py:477), orch.slack_command is always either the live slack.command or a name MANIFEST_COMMAND_RE already matches. Subtraction: replace *names with a single configured: str parameter and drop the orch.slack_command argument at both sites.

What this change ships

Inventory (8 items) — 7 justified

Intent: let a Slack app answer its own /kirocrew-<alias> command as soon as it is installed, with no config step and no restart. FIX (#38901) plus one ADDITION (slack.command applies live).

  1. /kirocrew and any /kirocrew-<alias> now run, whatever slack.command says — justified
  2. The "run config set and restart" mismatch reply is gone — justified
  3. Changing slack.command applies live; the restart warning and the Settings restart badge are gone — justified
  4. After the owner gate passes, the command the owner typed becomes the name shown in help, usage replies, the Home tab and the pickers — justified
  5. In code channels, the agent/approval sub-commands accept the same set of names — justified
  6. New public helpers slack_manifest.MANIFEST_COMMAND_RE and is_app_command — one consumer, generalized: variadic names, both callers pass the same pair
  7. The events.py re-export of _MANIFEST_COMMAND_RE is removed — justified
  8. CLI, scope-probe hint, guides and specs reworded to drop the restart — justified

[FIRST-PRINCIPLES-REVIEWED] d15c4f2

Description read

[DESCRIPTION-READ] 9743d25d041a87b8d53d50c9f41ab01693b0fa1c9dee1c9d1294ebb8256684ad

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] d15c4f2

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

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

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d15c4f2

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

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 18, 2026
@iamwhatever
iamwhatever force-pushed the feat/slack-command-hot-reload branch from 781cc70 to f67266c Compare November 18, 2026 03:49
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Head f67266c8796a (rebased on main 7d3a658e4e41) answers the review findings on 781cc7075a48:

  • Opus BLOCKING (usage replies name /kirocrew): fixed. Once the owner gate passes, _handle_slash sets orch.slack_command to the typed name, so the dashboard / yolo usage replies, the fallback help, the Home tab and the code-channel pickers name the registered command. The code-channel router does the same after the picker authorizes the owner. Tests: test_a_sub_command_usage_reply_names_the_typed_command, the non-owner case asserts nothing is renamed, and the code-channel alias test asserts the shown name.
  • Design note (Home tab / pickers show /kirocrew): same fix; they read orch.slack_command. Before the owner's first command the Home tab shows slack.command: nothing on the host records the alias the app was created with, and deriving it would mean guessing.
  • First Principles note (private alias + dead re-export): done. _MANIFEST_COMMAND_RE and the events.py re-export are gone; events_slash calls slack_manifest.MANIFEST_COMMAND_RE.

CodeQL Analyze (actions/javascript-typescript) and Dependency License Gate failed on the old head with API rate limit exceeded for installation (infra); they rerun on this push.

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 18, 2026
@iamwhatever
iamwhatever force-pushed the feat/slack-command-hot-reload branch from f67266c to 72330bb Compare November 18, 2026 04:33
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Nov 18, 2026
@iamwhatever
iamwhatever force-pushed the feat/slack-command-hot-reload branch from 72330bb to ae9f81e Compare November 18, 2026 05:11
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Head ae9f81efce75 fixes the GPT 6.1 BLOCKING finding on 72330bbba952 (adopting an alias dropped a custom slack.command). Verified in code: events_slash.py matched only orch.slack_command + the manifest regex, and commands.py the same, so /crew failed both after /kirocrew-alice was adopted. Both routers now call slack_manifest.is_app_command(cmd, orch.slack_command, <live slack.command>); the adopted name stays the shown name only. Tests that fail on the old head: test_a_custom_command_still_runs_after_an_alias_was_adopted, test_a_custom_command_reaches_the_picker_after_an_alias_was_adopted.

… 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
@iamwhatever
iamwhatever force-pushed the feat/slack-command-hot-reload branch from 73dc4b9 to d15c4f2 Compare November 18, 2026 06:23
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Head d15c4f2f780a fixes the Opus BLOCKING finding on 73dc4b9dc50f. Verified in code: api_slack_manifest with no alias renders from the saved slack.command (alias_for_command(saved_command)), so skipping the save would let a manifest update rename /kirocrew-alice back to /kirocrew. kirocrew manifest, the scope-probe hint, the setup guide and the specs keep the kirocrew config set slack.command kirocrew-<alias> step again, now applied live with no restart. The gateway still answers the alias command before it is saved. Tests: CLI hint and reinstall-notice tests now require the config set line and no restart.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 18, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: 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, slack_manifest.is_app_command. It accepts /⁠kirocrew, any /⁠kirocrew-<alias>, the live slack.command and the name currently shown in help. Slack's socket connection only delivers commands the app registered, so this does not widen who can run commands. The owner check and the allowed/denied audit still run first. The shown name changes only after that check passes, and only to a name the shared check accepts. slack.command applies live: the config-change handler updates orch.slack_command, and restart_required now comes back false for a command change. I checked every reader and writer of orch.slack_command and the removed restart list entry; no test still expects a restart. New tests cover routing, the code-channel picker, the config-change handler, the Home tab and the save response. All CI and AI review lanes passed. What remains is stale comments and dead UI text in the frontend, which the PR leaves to a separate PR.

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 d15c4f2f78 · 416 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 18, 2026 09:07

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.command in 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.command as restart-only. The affected spots are the comment at SlackPanel.tsx:602-605, the now-unreachable slash_command_needs_restart hint, and the SettingsSlackPanelCoverage.test.tsx fixture, which still asserts a restart badge from a mocked schema. The same applies to the api_slack_config_save docstring 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 _slash helper always resets orch.slack_command to kirocrew. As a result, test_a_custom_command_still_runs_after_an_alias_was_adopted never routes while the adopted alias is the shown name. Setting the default only for a fresh mock fixes that.

@KiroCrewCaptain
KiroCrewCaptain merged commit 2c05a8d into main Nov 18, 2026
156 of 164 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the feat/slack-command-hot-reload branch November 18, 2026 09:08
CrysisDeu added a commit that referenced this pull request Nov 18, 2026
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
CrysisDeu added a commit that referenced this pull request Nov 18, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack: answer /kirocrew-<alias> without a config set + restart

2 participants