Repository navigation
fix(slack): name the slash command after the alias to avoid Grid collisions - #11398
DcXiaoBing wants to merge 1 commit into
Conversation
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the compat claim that a 24–32-char alias never imported: the old [DESIGN-REVIEWED] 871774b Description read[DESCRIPTION-READ] 891415b4de78c49208e6d5f6c8153b45b87f5d56c7aef83996088f05c651e32b 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 (Fable 5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The fix leaves the endpoint's no-alias fallback rendering the colliding Not justified as shipped
What this change shipsInventory (10 items) — 8 justifiedIntent: FIX — each KiroCrew install gets a unique Slack slash command so Enterprise Grid users stop hitting
[FIRST-PRINCIPLES-REVIEWED] 871774b Description read[DESCRIPTION-READ] b0a00c4d4a95c1a796c556be20ff471244b867edc9208770f351a457a367bb1b That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Fable 5, fork) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS Typing an alias silently rewrites the distant Slash command field; Save then persists a name the installed app never registered, killing every slash command. Watch
Suggestions
[UX-REVIEWED] 871774b Description read[DESCRIPTION-READ] addc3e813eff1ef1e6814228b08771621ad013d755d435d291ed7ee5bbc92c8c That sha256 names everything this verdict read: the PR description, plus the 9 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 |
GPT 5.6 Review (fork) — 🔴 changes requested (blocking)Reviewed 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands. BLOCKING -- website/src/pages/settings/SlackPanel.tsx:395 -- Stale manifest remains actionable after the alias changes Adjudication (Opus 5) — is blocking on each finding proportionate?MEDIUM — the consequence is a [ADJUDICATION] 871774b total=0 uphold=0 downgrade=0 [ADJUDICATION-FENCED] 871774b fenced=1 flagged=1 🏷️ Fenced finding(s) machine-flagged as likely edge caseThe security fence keeps these findings blocking regardless of adjudication; the only clearance path is a human override recorded by a repository writer, who must independently verify a rationale before recording it — it is machine-authored, and a wrong override on a security-class finding ships exactly the class the fence exists to stop. (This lane's comment deliberately carries no override command.)
|
12fec66 to
b8a3bcb
Compare
Opus 5 Review (fork) — ✅ no blocking findingsReviewed Review detailsNothing blocks; one advisory — the new Alias field silently rewrites an already-working FINDING — website/src/pages/settings/SlackPanel.tsx:265 — the follow-the-alias effect guards only on [OPUS-REVIEWED] 871774b |
b8a3bcb to
fa880b6
Compare
|
|
|
|
Security Scope Review (fork) — 🔴 BLOCK (blocking)Which legitimate operations does no leg reported, and this was not the nothing-to-adjudicate short circuit Scope-Verdict: CONCERNS TIGHTENING: the exfil-shape tier's carve-out for KiroCrew's own Slack app-create deep link ( ADJUDICATED: 8 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix — UNADJUDICATED: the alias-width validator itself lives outside the shell composite, so no verdict is available for it. The guard is [SCOPE-REVIEWED] 871774b |
833d7d9 to
e8b3de2
Compare
|
span=a123c027843e
|
|
span=9a3c6ec6ce6d
|
|
span=7a3cd3f1b63f
|
|
span=701677936316
|
|
span=5e465ce4f92d
|
|
span=0b6134aa182e
|
|
Re Security Scope Review on 00c113a: |
|
span=94da71513bfe
|
|
span=439849d4ee81
|
|
span=28d7591e1144
|
Derive each Slack manifest command from its app alias so Enterprise Grid installs do not collide. Keep setup, the dashboard, documentation, and validation feedback aligned with the generated command. A detected login longer than the alias bound is cut to that bound so auto-detection still yields a command Slack accepts; an explicit --alias over the bound remains an error. The manifest endpoint requires the alias and answers 400 without one. The dashboard Alias field says why Create and Copy wait on it while it is empty, names a broken rule in the fault colour, and offers the manifest only for the alias the field holds now. The Slash command field says when the alias wrote its value.
|
span=507c0c2b247b
|
|
span=aa62157b6fe3
|
|
span=568de2b308a0
|
|
span=c158b6515f31
|
|
span=16f7cb0360f0
|
|
span=8bd5c3ffcabb
|
|
span=e8f99443dc67
|
|
span=81cb59a51f51
|
|
Thanks @DcXiaoBing for this fix. The branch had drifted into conflicts across 51 files, so the core of it is carried forward in #18550: the manifest names the slash command #18550 leaves out the dashboard alias field and the UI/i18n changes to keep the review small; those can follow once maintainers sign off on the default. Please follow #18550 for the outcome. |
Problem / Motivation
Goal: Give every KiroCrew install its own Slack slash command so Enterprise Grid users stop hitting invalid_service.
In a Slack Enterprise Grid, every user who installs their own KiroCrew app from the manifest registers the same slash command,
/kirocrew. Slack resolves the name org-wide, lands on another workspace's app, and rejects the command before dispatch withinvalid_service. Nothing reaches the gateway, so logs and the security event log stay empty while Socket Mode DMs keep working.Why it matters
The failure looks like a gateway or token problem and is very hard to diagnose (tokens, Socket Mode, reinstall, org-level install, duplicate socket clients and admin approval were all ruled out before finding it). Any Grid user who follows the documented setup ends up with a dead slash command.
Not a goal
What changed (motivation → approach → change)
The slash command is named after the alias, so each install registers a unique one. One bound covers the alias everywhere:
ALIAS_MAXis what Slack's 32-character command limit leaves after thekirocrew-prefix (23), so every aliasvalid_aliasadmits renders a command Slack accepts.src/kiro_crew/slack-manifest.yaml,slack_manifest.py/kirocrew-{{ALIAS}};slash_command(alias)is the one source of the matchingslack.commandvalue;ALIAS_MAX = SLASH_COMMAND_MAX - len(SLASH_COMMAND_PREFIX)is the single length rule, andALIAS_RE/ALIAS_PATTERNderive from itslack_manifest.shortened_alias,cli_setup._detect_aliasALIAS_MAX(23) with a one-line notice naming the result and--aliasas the override; an explicit over-long--aliasstill exits 1cli_setup.pykirocrew manifestprints the exactkirocrew config set slack.command ...line;kirocrew setup --slackofferskirocrew-<alias>only when no Slack tokens were stored before the run and noslack.commandis set. Both rely onvalid_aliasalone for lengthdashboard/handlers/messaging.py,website/src/api/client.tsGET /api/slack/manifestrequires?alias=(empty or missing is400 alias required; no server-side default), validates it withvalid_alias, and returnscommandslack/events.pycommandis notslack.commandis logged at WARNING naming both, instead of being dropped without a tracesecurity/exfil.pywebsite/src/pages/settings/SlackPanel.tsxuseDebouncedValue, 250 ms) the manifest and the Create link render for that alias, and the Slash command field is filled with the command that manifest registers, but only while the user has not typed in that field themselves (commandTouched); a response for an alias the user has since replaced is dropped. The Alias field is never read-only, since it is not persisted: a remote session can still render the manifest, and there the stored Slash command is left as it is. One help line sits under the field: while the alias is empty it says, intext-muted, that Create Slack app and Copy manifest YAML wait on it (alias_required_hint); while the alias is invalid it names the rule it breaks intext-danger: a disallowed character, or too long. The line carries an id the input'saria-describedbypoints at (SettingsInputpassesaria-describedbythrough). Create, Copy and the copy handler read one derived value,manifest, which is the query result only while itsaliasequals the field's current value: between a keystroke and the settled render the previous alias's manifest is on hand and both controls are inert. While the manifest is unavailable the Create Slack app link wears the same disabled treatment as the Copy button (aria-disabled,tabIndex=-1,opacity-30 cursor-not-allowed, click prevented). Under the Slash command field a muted line (command_follows_alias) says the value follows the alias and is saved only with Save Slack settings; it appears when the alias wrote the field and disappears once the user edits it. The client-sideMANIFEST_ALIAS_REbound is pinned equal toALIAS_MAXby a backend testslack/handler.py,slack/handler_runtime/commands.py,dashboard/server_runtime/safety_grants.py_BANG_TO_SLASH), the unknown-command reply and the override-expiry DM readslack.commandinstead of naming/kirocrewwebsite/src/i18n/locales/*.json,settingsRegistry.gen.ts,src/kiro_crew/docs/settings-registry.generated.jsonslackPanelstrings in every catalog (the description names the 23-character cap;alias_required_hint,alias_invalid_charsandalias_too_longare the three help texts;command_follows_aliasis the Slash command notice), in each locale's informal register; the registry files are regenerated withnpm run gen:settingsandnpm run i18n:pseudodocs/guides/slack-setup.md,src/kiro_crew/docs/slack-integration.md,telegram-integration.md,docs/guides/remote-and-mobile.md,docs/reference/kiro-cli/chat/voice.md,docs/architecture/*,docs/feature-map/README.md,docs/system-specs/modules/*/kirocrew <sub>example uses the/<command>placeholder or/kirocrew-<alias>; the setup guide explainsinvalid_serviceand warns that importing a re-rendered manifest into an existing app renames its command, soslack.commandmust be updated to match. The feature map names the Alias control and the matching manifest command response. Telegram's and Webex's own/kirocrew dashboardbot command is not this command and keeps its name.github/black-baseline.txttest/test_restart_command.py, which is black-clean once its one-line assertion shortensAccepted tradeoff: the Slack app-create deep-link exemption is bound to the bundled manifest template by design.
_slack_manifest_payload_reis derived from the template bytes shipped with this version, so only a link rendered from that template is exempt. A deep link generated before this change shows as redacted only when an old transcript re-renders; nothing operational depends on it. A fresh link is regenerated on demand in Settings -> Slack or viakirocrew manifest --url.Not a product-shape change: the default
slack.commandconfig value is unchanged; only the manifest the user imports into Slack, and the value setup offers for a fresh install, are derived from the alias.Backwards compatibility
Compatible: an installed app keeps its registered command and its configured
slack.command; the gateway answers whateverslack.commandnames, as before. Only a manifest rendered from now on registers the alias-suffixed name, and a re-import into an existing app is documented as a rename. The alias bound tightens from 32 to 23 characters: an explicit--aliasof 24-32 characters used to render a manifest and now exits 1, because Slack's 32-character command limit minus the 9-characterkirocrew-prefix leaves 23. A detected login of that length is truncated to 23 with a notice instead of exiting 1.GET /api/slack/manifestwithout?alias=used to render a manifest forkirocrewand now answers 400; its only caller, the dashboard, always sends the alias.Tests
test_slack_manifest_scopes.py:shortened_aliascuts an over-long valid login toALIAS_MAXand returns None for an in-bound, empty, or invalid-charset alias.test_slack_manifest_scopes.py: the manifest contract renderscommand: /kirocrew-<alias>;slash_command()matches it; the longest valid alias renders a command exactly atSLASH_COMMAND_MAXand one more character failsvalid_alias; the dashboardMANIFEST_ALIAS_REbound equalsALIAS_MAX.test_cli.pyTestDetectAlias: a 24-32 character login is truncated to 23 with the notice; a login with an invalid character is not shortened.test_cli.py:kirocrew manifestprints theconfig sethint; an alias overALIAS_MAXexits 1 with the invalid-alias message naming the cap; the setup wizard passesfresh_installthrough.test_cli_setup_cov80.py:setup --slackofferskirocrew-<alias>on a fresh install, the plain name on a tokened install or an unusable/over-long alias, and never replaces a configured name.test_slack_config_handlers.py,test_handlers_messaging_coverage.py: the manifest endpoint returnscommand; a 23-character alias yields a 32-character command and a 24-character one is a 400invalid alias; a missing, empty or blank alias is a 400alias required.test_slack_events_coverage.py: a delivered command that is notslack.commandlogs a WARNING naming the received and configured commands and writes no audit entry.test_restart_command.py:_BANG_TO_SLASHholds subcommands.test_slack_handler_composition_contract.py,test_security.py: the golden-transcript config fixture carriesslack.commandfor theslack_cfg()read in the deprecation hint; the renamed command in the exempted deep link and the credential-shaped aliases fit the 23-character bound.SettingsSlackPanelCoverage.test.tsx: no manifest request and disabled Create/Copy until a valid alias is typed; while the alias is invalid the Create link carriesaria-disabled,tabindex=-1,opacity-30 cursor-not-allowedand its click is prevented, and all of that lifts once a valid alias resolves; typing one sets and saveskirocrew-<alias>; six keystrokes in quick succession cost one manifest request and the Slash command never shows a prefix; a Slash command typed while the manifest is still loading survives the response; an edited Slash command stops following later aliases; an empty alias shows the muted hint that Create Slack app and Copy manifest YAML wait on it; an invalid alias showstext-dangerhelp text outside an alert naming the broken rule (charset before length); after alias A resolves, typing B disables Create and Copy before the debounce settles and re-enables them with B's manifest; the Slash command notice appears when the alias wrote the field, disappears once the field is edited, and never appears when the field was typed by hand; in both states the Alias input'saria-describedbyresolves to the rendered hint, and a valid alias clears the hint and the attribute; a configured command is left alone; a read-only session keeps the Alias field enabled, renders the manifest and leaves its stored Slash command alone; manifest unavailable keeps the card inert.src/i18n/style/*Style.test.ts: the changed catalog values address the reader in the informal register (I18N_BASE_REFset).Manual verification
Reproduced the bug and the fix on a real Enterprise Grid sandbox:
/kirocrew→invalid_servicefrom both a channel and the bot DM with a healthy Socket Mode connection; after renaming the command to/kirocrew-<alias>, reinstalling,kirocrew config set slack.command kirocrew-<alias>and a restart,/kirocrew-<alias> dashboardworks.Screenshots / video
Fresh install, light theme, before an alias is typed — the hint under the field names the two controls that wait on it, and both fade alike:
After typing
wwd— the manifest is forKiroCrew-wwdand the Slash command field follows it:A 24-character alias — the help text names the rule it breaks in the fault colour; Create Slack app and Copy manifest YAML are greyed out alike:
An alias with a space — the help text names the disallowed character instead, in the same fault colour:
Slash command typed by hand (
kirocrew-mine), then the alias changed tosecond— the edited field keeps its value:Captured with scripted Playwright against the built SPA with stubbed
/api/slack/*fixtures (repowebsite/scripts/libharness pattern).Related Issues
Fixes #11386
Pattern harvest
Rule candidate: review-prompt
Pattern: a per-install identifier (alias) is templated into some names in a manifest but not all; any name registered in a shared namespace (Slack Grid slash commands) must carry the install-unique suffix, and its length bound is derived once from that namespace's limit rather than re-checked at each emitter.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)