Skip to content

fix(slack): name the slash command after the alias to avoid Grid collisions - #11398

Closed
DcXiaoBing wants to merge 1 commit into
kirodotdev:mainfrom
DcXiaoBing:fix/slack-slash-command-alias
Closed

DcXiaoBing wants to merge 1 commit into
kirodotdev:mainfrom
DcXiaoBing:fix/slack-slash-command-alias

Conversation

@DcXiaoBing

@DcXiaoBing DcXiaoBing commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

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 with invalid_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

  • Accepting deep links rendered from an earlier manifest template in the exfil carve-out
  • Renaming the command of an already-installed app automatically

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_MAX is what Slack's 32-character command limit leaves after the kirocrew- prefix (23), so every alias valid_alias admits renders a command Slack accepts.

Where Change
src/kiro_crew/slack-manifest.yaml, slack_manifest.py the template registers /kirocrew-{{ALIAS}}; slash_command(alias) is the one source of the matching slack.command value; ALIAS_MAX = SLASH_COMMAND_MAX - len(SLASH_COMMAND_PREFIX) is the single length rule, and ALIAS_RE / ALIAS_PATTERN derive from it
slack_manifest.shortened_alias, cli_setup._detect_alias a detected login of 24-32 characters is cut to ALIAS_MAX (23) with a one-line notice naming the result and --alias as the override; an explicit over-long --alias still exits 1
cli_setup.py kirocrew manifest prints the exact kirocrew config set slack.command ... line; kirocrew setup --slack offers kirocrew-<alias> only when no Slack tokens were stored before the run and no slack.command is set. Both rely on valid_alias alone for length
dashboard/handlers/messaging.py, website/src/api/client.ts GET /api/slack/manifest requires ?alias= (empty or missing is 400 alias required; no server-side default), validates it with valid_alias, and returns command
slack/events.py a slash payload whose command is not slack.command is logged at WARNING naming both, instead of being dropped without a trace
security/exfil.py comment names the 23-character alias bound the derived deep-link pattern now carries
website/src/pages/settings/SlackPanel.tsx the credentials card gains an Alias field. Once typing pauses (useDebouncedValue, 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, in text-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 in text-danger: a disallowed character, or too long. The line carries an id the input's aria-describedby points at (SettingsInput passes aria-describedby through). Create, Copy and the copy handler read one derived value, manifest, which is the query result only while its alias equals 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-side MANIFEST_ALIAS_RE bound is pinned equal to ALIAS_MAX by a backend test
slack/handler.py, slack/handler_runtime/commands.py, dashboard/server_runtime/safety_grants.py the bang-command deprecation notice (_BANG_TO_SLASH), the unknown-command reply and the override-expiry DM read slack.command instead of naming /kirocrew
website/src/i18n/locales/*.json, settingsRegistry.gen.ts, src/kiro_crew/docs/settings-registry.generated.json seven new slackPanel strings in every catalog (the description names the 23-character cap; alias_required_hint, alias_invalid_chars and alias_too_long are the three help texts; command_follows_alias is the Slash command notice), in each locale's informal register; the registry files are regenerated with npm run gen:settings and npm run i18n:pseudo
docs/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/* every Slack /kirocrew <sub> example uses the /<command> placeholder or /kirocrew-<alias>; the setup guide explains invalid_service and warns that importing a re-rendered manifest into an existing app renames its command, so slack.command must be updated to match. The feature map names the Alias control and the matching manifest command response. Telegram's and Webex's own /kirocrew dashboard bot command is not this command and keeps its name
.github/black-baseline.txt drops test/test_restart_command.py, which is black-clean once its one-line assertion shortens

Accepted tradeoff: the Slack app-create deep-link exemption is bound to the bundled manifest template by design. _slack_manifest_payload_re is 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 via kirocrew manifest --url.

Not a product-shape change: the default slack.command config 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 whatever slack.command names, 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 --alias of 24-32 characters used to render a manifest and now exits 1, because Slack's 32-character command limit minus the 9-character kirocrew- prefix leaves 23. A detected login of that length is truncated to 23 with a notice instead of exiting 1. GET /api/slack/manifest without ?alias= used to render a manifest for kirocrew and now answers 400; its only caller, the dashboard, always sends the alias.

Tests

  • test_slack_manifest_scopes.py: shortened_alias cuts an over-long valid login to ALIAS_MAX and returns None for an in-bound, empty, or invalid-charset alias.
  • test_slack_manifest_scopes.py: the manifest contract renders command: /kirocrew-<alias>; slash_command() matches it; the longest valid alias renders a command exactly at SLASH_COMMAND_MAX and one more character fails valid_alias; the dashboard MANIFEST_ALIAS_RE bound equals ALIAS_MAX.
  • test_cli.py TestDetectAlias: 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 manifest prints the config set hint; an alias over ALIAS_MAX exits 1 with the invalid-alias message naming the cap; the setup wizard passes fresh_install through.
  • test_cli_setup_cov80.py: setup --slack offers kirocrew-<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 returns command; a 23-character alias yields a 32-character command and a 24-character one is a 400 invalid alias; a missing, empty or blank alias is a 400 alias required.
  • test_slack_events_coverage.py: a delivered command that is not slack.command logs a WARNING naming the received and configured commands and writes no audit entry.
  • test_restart_command.py: _BANG_TO_SLASH holds subcommands.
  • test_slack_handler_composition_contract.py, test_security.py: the golden-transcript config fixture carries slack.command for the slack_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 carries aria-disabled, tabindex=-1, opacity-30 cursor-not-allowed and its click is prevented, and all of that lifts once a valid alias resolves; typing one sets and saves kirocrew-<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 shows text-danger help 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's aria-describedby resolves 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_REF set).

Manual verification

Reproduced the bug and the fix on a real Enterprise Grid sandbox: /kirocrew → invalid_service from 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> dashboard works.

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:

Settings → Slack, credentials card, empty Alias field with the hint line, light theme

After typing wwd — the manifest is for KiroCrew-wwd and the Slash command field follows it:

Settings → Slack, credentials card with alias wwd

Settings → Slack, Slash command field prefilled with kirocrew-wwd and the notice that it follows the alias

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:

Settings → Slack, alias too long, red help text, create and copy both greyed

An alias with a space — the help text names the disallowed character instead, in the same fault colour:

Settings → Slack, alias with a disallowed character, red help text

Slash command typed by hand (kirocrew-mine), then the alias changed to second — the edited field keeps its value:

Settings → Slack, Slash command field keeps the hand-typed value after an alias change

Captured with scripted Playwright against the built SPA with stubbed /api/slack/* fixtures (repo website/scripts/lib harness 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • 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

@DcXiaoBing
DcXiaoBing requested review from a team and chenmingwei23 September 16, 2026 23:12
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention fork Pull request from a fork (external contributor) labels Sep 16, 2026
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 871774bd1a0a53b2374ceed98b53f73b67bf4f2c via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify the compat claim that a 24–32-char alias never imported: the old ALIAS_MAX = 32 comment said it matched Slack's app-name budget.

[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 .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 readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 16, 2026
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — 🟡 CONCERNS

Premise-level review of 871774bd1a0a53b2374ceed98b53f73b67bf4f2c via the fork AI-review pipeline — 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/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The fix leaves the endpoint's no-alias fallback rendering the colliding /kirocrew-kirocrew, and the 24–32-char compat claim contradicts the comment this diff deletes.

Not justified as shipped

  • Item 3 — inherited: the description's "a 24–32 character alias never produced a manifest Slack would import" is unverified and contradicts the deleted base comment's own words, "32 also matches the Slack app-name budget the manifest spends it on" — if 24–26-char aliases did import, their explicit --alias now exits 1 with no acknowledged loser.
    Clears when: confirmed against Slack that an app named KiroCrew-<24–26-char alias> fails manifest import, or the compat loser is named.
  • Item 6 — zero consumers: alias = request.query.get("alias", "").strip() or "kirocrew" (messaging.py:4962) survives, and under the new template it renders a manifest registering /kirocrew-kirocrew — the shared-name shape this PR removes; its only real consumer (the dashboard's bare getSlackManifest()) is deleted in this same diff (grep getSlackManifest|/api/slack/manifest: 1 consumer, now alias-passing).
    Subtraction: delete the or "kirocrew" fallback and return the endpoint's existing 400 on a missing alias.
    Clears when: the fallback is removed, or a remaining no-alias consumer is counted.

What this change ships

Inventory (10 items) — 8 justified

Intent: FIX — each KiroCrew install gets a unique Slack slash command so Enterprise Grid users stop hitting invalid_service. (More than 10 differences; the 10 most noticeable kept — doc placeholder rewrites folded into 9.)

  1. A fresh manifest registers /kirocrew-<alias> instead of the shared /kirocrew — justified
  2. Alias cap drops 32→23; an over-long detected login truncates with a notice — justified
  3. An explicit --alias of 24–32 characters now exits 1 — inherited: rests on an unverified Slack-import claim the deleted comment contradicts
  4. kirocrew manifest prints the matching config set slack.command line — justified
  5. setup --slack offers kirocrew-<alias> only on a fresh install — justified
  6. Manifest endpoint returns command; its no-alias fallback keeps rendering the colliding name — zero consumers: the fallback branch's one caller is removed by this diff
  7. Settings → Slack gains an Alias field; manifest, Create and Copy wait for it — justified
  8. A slash payload not matching slack.command is WARNING-logged instead of silently dropped — justified
  9. Deprecation notices, unknown-command reply and override-expiry DM name the configured command — justified
  10. _orch_cfg test-isolation restore and test_restart_command.py reformat/baseline drop — rides along

[FIRST-PRINCIPLES-REVIEWED] 871774b

Description read

[DESCRIPTION-READ] b0a00c4d4a95c1a796c556be20ff471244b867edc9208770f351a457a367bb1b

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 Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — 🟡 CONCERNS

UX-level review of 871774bd1a0a53b2374ceed98b53f73b67bf4f2c via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

  • Config-rewrite at a distance: on a configured install, typing an alias (e.g. just to re-copy the manifest) makes the effect setDraft(d => ({ ...d, command: m.command })) replace a working kirocrew-mine in the Behavior card, likely off-screen; a Save for any other reason then breaks the live command. Low frequency × high impact × persists until diagnosed. Smallest fix: an inline notice beside the Slash command field (or next to the alias) the moment the value is auto-changed.
  • Error states wear the neutral style: alias_too_long / alias_invalid_chars render in the same text-muted 12px as alias_required_hint (attachments 4–5), so "your input is wrong" looks identical to "waiting for input". Frequent during typing, mild impact. Give the fault strings a warning tone.
  • Return-visit excise: the alias is never persisted, so every visit to a fully configured panel starts with Create/Copy disabled and the required-hint showing — the previous build prefilled the server-detected login. Rare visits, small friction; consider prefilling the detected login the CLI path already uses.
  • No blind read has run on this fork, so first-time comprehension of "Alias" and the hint copy is unverified; a maintainer wanting that check can push the branch to this repository.

Suggestions

  • alias_required_hint: "Type an alias to render the manifest and enable these." → name the outcomes: "Enter an alias to enable Create Slack app and Copy manifest YAML." ("render the manifest" + bare "these" is mechanism talk.)

[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 .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 Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — 🔴 changes requested (blocking)

Reviewed 871774bd1a0a53b2374ceed98b53f73b67bf4f2c via the fork AI-review pipeline; updated in place on each push.

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
tabIndex={manifestQ.data ? undefined : -1}
Alias A loaded → type B and immediately create A → response B updates saved command → Slack commands are ignored.
Anchor: residual/crash-data-loss-corruption
Fix: Enable Create and Copy only when manifestQ.data?.alias === alias.
[BLOCK-MERGE] 871774b
[GPT-REVIEWED] 871774b

Adjudication (Opus 5) — is blocking on each finding proportionate?

MEDIUM — the consequence is a slack.command that disagrees with the created app, so slash commands are dropped; the Slash command field stays visible and editable with nothing persisted until Save (website/src/pages/settings/SlackPanel.tsx:489-491), and the same PR makes the mismatch loud by logging both values at src/kiro_crew/slack/events.py:1547.
Conditions confirmed: a manifest must already have resolved for a different alias (per-alias queryKey/enabled, SlackPanel.tsx:214-216) and no placeholderData/keepPreviousData default exists (website/src/api/queryClient.ts:65-74), so manifestQ.data drops to undefined the moment settledAlias moves and the controls go inert again (SlackPanel.tsx:392-395, 331 base → new 399); the stale-but-live span is therefore only the trailing-edge debounce (ALIAS_DEBOUNCE_MS = 250, SlackPanel.tsx:30; website/src/apps/file-explorer/hooks.ts:5-8) — the user must activate Create/Copy mid-edit of the new alias, while the card prose beside it already reads the new alias (SlackPanel.tsx:372) and the Slack page it opens names the old app.
Real fix cost is small (one manifestQ.data?.alias === alias predicate), but the harm is a recoverable, logged misconfiguration rather than credential, privilege or irreversible-loss exposure — the overwrite itself requires the new alias's own manifest (SlackPanel.tsx:265) and an explicit Save.

[ADJUDICATION] 871774b total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] 871774b

[ADJUDICATION-FENCED] 871774b fenced=1 flagged=1
FLAG F1 website/src/pages/settings/SlackPanel.tsx:395 -- Real, but the stale link is live only for the 250ms trailing-edge debounce after an alias edit (no keepPreviousData, so the key change blanks the data), the user must click Create/Copy mid-edit, and the outcome is a logged, one-field-editable command mismatch rather than credential, privilege or irreversible loss.
[GPT-ADJUDICATED-FENCED] 871774b

🏷️ Fenced finding(s) machine-flagged as likely edge case

The 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.)

  • F1 website/src/pages/settings/SlackPanel.tsx:395 — Real, but the stale link is live only for the 250ms trailing-edge debounce after an alias edit (no keepPreviousData, so the key change blanks the data), the user must click Create/Copy mid-edit, and the outcome is a logged, one-field-editable command mismatch rather than credential, privilege or irreversible loss.

@DcXiaoBing
DcXiaoBing force-pushed the fix/slack-slash-command-alias branch from 12fec66 to b8a3bcb Compare September 16, 2026 23:29
@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 Sep 16, 2026
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — ✅ no blocking findings

Reviewed 871774bd1a0a53b2374ceed98b53f73b67bf4f2c via the fork AI-review pipeline; updated in place on each push.

Review details

Nothing blocks; one advisory — the new Alias field silently rewrites an already-working slack.command.

FINDING — website/src/pages/settings/SlackPanel.tsx:265 — the follow-the-alias effect guards only on commandTouched.current || data?.read_only, with no install-state condition, so an operator whose app already registered /kirocrew and who types an alias (now the only way to render the manifest from the dashboard — enabled: MANIFEST_ALIAS_RE.test(settledAlias)) has draft.command rewritten to kirocrew-<alias> and persisted by the next Save (command: draft.command.trim()), after which the gateway answers only /kirocrew-<alias> and every real slash command hits the new _handle_slash mismatch return; the same one-way write also leaves draft.command at kirocrew-<alias> after the alias is cleared, since m.alias !== alias then returns early → Fix: add the install-state signal the CLI's fresh_install uses to the guard — if (!m || m.alias !== alias || commandTouched.current || data?.read_only || data.bot_token_set || data.app_token_set) return.

[OPUS-REVIEWED] 871774b

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 16, 2026
@DcXiaoBing
DcXiaoBing force-pushed the fix/slack-slash-command-alias branch from b8a3bcb to fa880b6 Compare September 17, 2026 00:18
@DcXiaoBing

Copy link
Copy Markdown
Contributor Author
  • Dashboard fresh install prefills kirocrew-kirocrew

fixed in fa880b6: the credentials card gains an Alias field; the manifest, the Create link and the Slash command value are all rendered for the alias the user types.
No default alias: nothing is fetched or prefilled until a valid alias is entered, so the doubled name cannot be produced.
Evidence: three screenshots of the fresh-install state (before/after alias) are now in the PR body.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author
  • Explicit default commands are misclassified as fresh installs

fixed in fa880b6: command_configured is removed from the config GET and the panel; there is no install-state heuristic left.
The Slash command now changes only when the user types an alias in the credentials card (an explicit act), and only the draft changes until Save.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author
  • CLI and dashboard use different freshness predicates

fixed in fa880b6: _setup_slash_command(fresh_install=...) receives "no Slack tokens were stored before this run" from the wizard; a tokened install with the default command is offered kirocrew, pinned by a new test.
The dashboard no longer has a freshness predicate at all (see the UX disposition), so the two paths can no longer diverge.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author
  • Land the check-bundle-size.mjs ceiling bump as its own chore PR

fixed in fa880b6: the bump is removed from this PR and lands as #11406 with the measurement and reproduce command.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author
  • The rename is half-propagated: 10 hardcoded /kirocrew spellings

fixed in fa880b6: _BANG_TO_SLASH holds subcommands and the deprecation notice, the unknown-command reply and the override-expiry DM all format /{slack.command} ...; docs lines 359-360 and 401 use the /<command> placeholder.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author
  • Bundle-gate bump rides along on an unverifiable measurement

fixed in fa880b6: removed from this PR; #11406 carries the ceiling change with the measurement and the command a maintainer can run to reproduce it.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 17, 2026
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 25, 2026
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review (fork) — 🔴 BLOCK (blocking)

Which legitimate operations does 871774bd1a0a53b2374ceed98b53f73b67bf4f2c newly refuse? Model proposes, scripts/deny_diff.py decides — updated in place on each push. A script-confirmed regression blocks PR readiness.

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 (security/exfil.py::_slack_manifest_payload_re, built from slack_manifest.ALIAS_PATTERN and the bundled template) got stricter in two coupled ways: ALIAS_MAX drops 32 → 23 (ALIAS_MAX = SLASH_COMMAND_MAX - len(SLASH_COMMAND_PREFIX)), narrowing the one caller-controlled span the exemption admits, and the bundled template's command line changes (- command: /kirocrew → - command: /kirocrew-{{ALIAS}}), changing the exact payload the carve-out accepts. The ONE threat it refuses is a credential smuggled in the alias slot of the exempted deep link — quoting the hunk: "the alias slot accepted 64 chars of [A-Za-z0-9_-], which is wide enough for a 40-char alphanumeric secret … slack_manifest.ALIAS_MAX (23) now makes such a run impossible AND the surviving span is still scanned".

ADJUDICATED: 8 candidates, 0 confirmed newly-refused
No classifier verdicts were handed back before this review was captured; the deterministic fold reports each leg's results after it. One narrowing I can argue but not confirm, encoded as rows 1–3 rather than asserted: the carve-out validates a link's payload against the CURRENT bundled template, and this PR edits that template, so every deep link the previous release emitted (any alias — the exact strings kirocrew manifest --url and GET /api/slack/manifest printed, saved in runbooks and setup DMs) may stop matching at head and fall back to the ~1.9 KB query-length heuristic, resurrecting the [REDACTED: suspicious URL to api.slack.com] failure the carve-out exists to prevent. Row 3 separately isolates the 24-character-alias width the bound retires.

PLATFORM COVERAGE: posix — echo carrier for the base-emitted deep link and a /tmp --output path, covering the posix tokenizer and path-fence spelling; windows — Start-Process carrier for the same link and a drive-letter --output path, covering the other tokenizer and separator; any — kirocrew manifest --url, kirocrew config set slack.command kirocrew-alice, kirocrew setup --slack, which carry no path, separator, or platform-bound executable name. The tightened guard itself is a platform-neutral URL-string pattern and the diff adds no path, interpreter, or argv-shape assumption to any adjudicated tier, so no assumed platform spelling went unprobed. The alias auto-detection reads $USER/os.getlogin(), an environment assumption, but it lives in setup UX rather than in any guard the composite runs, so no candidate spelling exists for it. Per-leg verdicts are the fold's to report, not mine.

UNADJUDICATED: the alias-width validator itself lives outside the shell composite, so no verdict is available for it. The guard is slack_manifest.valid_alias (bound now 23 via ALIAS_RE). Call paths: (1) kirocrew manifest --alias <a> → cli_setup._manifest → valid_alias → sys.exit(1) — an explicit --alias of 24–32 characters was accepted at base and now hard-fails, and the new shortened_alias auto-cut applies only to the auto-detected login in _detect_alias, never to --alias; (2) GET /api/slack/manifest?alias=<a> → api_slack_manifest → valid_alias → 400 where base returned 200; (3) the dashboard's client-side gate MANIFEST_ALIAS_RE = /^[A-Za-z0-9_-]{1,23}$/ in SlackPanel.tsx, which disables Create/Copy for a 24–32-character alias, and the panel now renders no manifest at all until an alias is typed, where base rendered one immediately for the default. Candidate legitimate inputs I would have submitted: --alias platform-engineering-bot (24 characters, a real team-account naming shape) at the CLI, and the same value through the settings panel and the manifest endpoint. The classifier cannot adjudicate any of these — the command strings pass the deny composite at both refs and the refusal happens in-process — so this half earns CONCERNS rather than a pass asserted over an empty adjudicated set.

[SCOPE-REVIEWED] 871774b

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Sep 25, 2026
@DcXiaoBing
DcXiaoBing force-pushed the fix/slack-slash-command-alias branch from 833d7d9 to e8b3de2 Compare September 29, 2026 19:11
@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=a123c027843e

  • uppercase aliases pass "[A-Za-z0-9_-]" but produce slash commands Slack rejects -- rebutted

Slack documents no case rule for a slash command. The app-manifest reference (docs.slack.dev/reference/app-manifest, features.slash_commands[].command) states only "Maximum length is 32 characters, and should include the leading /"; the slash-commands guide (api.slack.com/interactivity/slash-commands, "Naming your slash command") adds uniqueness advice and no charset or case constraint.
valid_alias keeps the documented shape; forcing lowercase would silently rename a login such as JDoe and desynchronise the rendered manifest from what the user typed, with no documented rejection to justify it.
If a maintainer can point at a documented lowercase rule, the change is one line in _ALIAS_CHAR plus .lower() in _detect_alias; not done on an undocumented premise.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=9a3c6ec6ce6d

  • "disabled={ro}" prevents remote users from entering an alias, permanently disabling the previously available manifest actions -- fixed

SlackPanel.tsx: the Alias SettingsInput no longer takes disabled={ro}; it is not persisted, so a read-only session types it, gets the manifest, the Create link and Copy. The follow-the-field effect skips data.read_only, so the disabled Slash command field keeps its stored value instead of showing a value the session cannot save.
Test still renders the manifest for a typed alias while read-only (SettingsSlackPanelCoverage.test.tsx) fails with disabled={ro} restored and fails again with the read_only guard removed (both mutations run).

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=7a3cd3f1b63f

  • the manifest query is keyed on the raw alias input, so every keystroke costs a full server-side manifest render -- fixed

SlackPanel.tsx: settledAlias = useDebouncedValue(alias, 250) (the existing apps/file-explorer/hooks hook) is what enters queryKey, queryFn and enabled; the follow effect still checks m.alias === alias so only the command of the alias currently in the field is written.
Test renders the manifest once typing pauses, not once per keystroke: six prefixes typed 100 ms apart yield zero requests and an unchanged Slash command until the pause, then exactly one getSlackManifest('tester'); it fails when the debounce is bypassed (mutation run).

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=701677936316

  • Attachment-01 contradicts the description's "Create and Copy are inert" -- fixed

The attachments were stale, as the review noted: on this head the inert Create link already wears border-border bg-transparent text-text opacity-30 cursor-not-allowed, the exact classes a disabled Btn wears, in every no-manifest state including no alias (greys the create link out like the copy button while the alias is invalid pins the class set).
The light-theme screenshots in the description are retaken at this head with the repo's serveDist + stubDashboardApi harness: fresh install (Create and Copy fade alike), too-long alias, disallowed-character alias.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=5e465ce4f92d

  • Fork lane: no blind reader has cold-read "Alias" or its follow-the-field behavior -- rebutted

A fork-lane limitation by the review's own wording ("lane limitation, not the author's gap"); no code or copy change can satisfy it from a fork.
The copy a cold reader meets is in the description's attachments: the Alias description names the app, the /kirocrew-<alias> command and the follow-the-field rule in one sentence, and the help text names the rule an invalid alias breaks.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=0b6134aa182e

  • alias_invalid restates the sentence visible two lines above in alias_description -- fixed

alias_invalid is replaced by two catalog strings in all 13 locales plus the pseudolocale: alias_invalid_chars ("Only letters, digits, - and _ are allowed.") and alias_too_long ("Too long: 23 characters at most."); aliasFault() in SlackPanel.tsx picks charset first, since fixing it may also fix the length.
Test names the rule the alias breaks as muted help text, charset before length fails when the order is swapped (mutation run); the 13 src/i18n/style/*Style.test.ts files pass on the new strings.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

Re Security Scope Review on 00c113a:
(1) Detected logins of 24-32 characters: fixed -- _detect_alias truncates to ALIAS_MAX (23) with a one-line notice naming the result and --alias as the override; an explicit over-long --alias still exits 1 (slack_manifest.shortened_alias, TestDetectAlias).
(2) Pre-change deep links: not fixing. The exemption is intentionally bound to the current bundled template (accepting two template generations would widen the only caller-controlled span inside an exempted link); a pre-change link renders redacted only in an old transcript, and a fresh one is regenerated on demand in Settings -> Slack / kirocrew manifest. Recorded as an accepted tradeoff in the description.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=94da71513bfe

  • attachment-01: alias empty → both buttons greyed, but aliasFault('') returns null so the hint slot renders nothing -- fixed

SlackPanel.tsx: while alias === '' the help slot renders alias_required_hint ("Type an alias to render the manifest and enable these.") in the same muted <p> the fault hints use; the key is in all 13 catalogs, en-XA regenerated.
SettingsSlackPanelCoverage.test.tsx "requests no manifest and disables create + copy until an alias is typed" asserts the hint, its classes, that it is outside role="alert", and that it disappears once typing starts; removing the empty branch fails it (mutation-checked).

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=439849d4ee81

  • The fault hint (alias_too_long / alias_invalid_chars) is a bare <p> — no aria-describedby -- fixed

SettingsInput gains an aria-describedby pass-through; SlackPanel.tsx gives the one rendered help line (useId) an id and sets it on the Alias input while a hint is shown, clearing the attribute when the alias is valid. Fault and empty hints share the id since only one renders at a time.
SettingsSlackPanelCoverage.test.tsx "names the rule the alias breaks as muted help text" asserts aria-describedby === hint.id, toHaveAccessibleDescription(hint text), and no attribute once valid; dropping the attribute fails both hint tests (mutation-checked).

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=28d7591e1144

  • attachment-02's help text predates the shipped alias_description; refresh it -- fixed

Re-captured against the built SPA at this head (light theme, stubbed /api/slack/*): attachment-02 now shows the shipped alias_description copy with alias wwd and both controls enabled.
Attachment-01 was also re-captured so the empty-alias state evidences the new hint line; both URLs replaced in ## Screenshots / video.

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

Copy link
Copy Markdown
Contributor Author

span=507c0c2b247b

  • Stale manifest remains actionable after the alias changes -- fixed

SlackPanel.tsx: one derived value manifest = manifestQ.data?.alias === alias ? manifestQ.data : undefined now feeds the Create href/aria-disabled/tabIndex/onClick/className, the Copy disabled, copyManifest and the follow-the-alias effect; nothing else reads manifestQ.data.
During the 250 ms trailing-edge debounce after typing B, A's manifest is on hand but alias reads B, so both controls are inert until B's own response lands.
Test disables create + copy while the manifest on hand is the previous alias's (SettingsSlackPanelCoverage.test.tsx): A resolves, B typed, Create is aria-disabled and Copy disabled before the debounce settles, both re-enable with B's manifest. Reverting the predicate to manifestQ.data fails it.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=aa62157b6fe3

  • Config-rewrite at a distance -- fixed

SlackPanel.tsx: when the follow effect writes draft.command, a muted line under the Slash command field (command_follows_alias, 13 locales + en-XA) says the value follows the alias and is saved only with Save Slack settings; it clears the moment the user edits that field.
Tests: says under the slash command that the alias wrote it, until the field is edited and shows no follow notice when the slash command was typed by hand; removing setCommandFollowed(true), or the clear on edit, fails them.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=568de2b308a0

  • Error states wear the neutral style -- fixed

SlackPanel.tsx: the hint <p> is text-danger while aliasFaultKind !== null (alias_too_long / alias_invalid_chars) and stays text-muted for alias_required_hint, the 12px fault treatment the repo already uses.
Test names the rule the alias breaks in the fault colour, charset before length asserts text-danger and not text-muted on both fault strings; forcing text-muted fails it. Screenshots in the body replaced.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=c158b6515f31

  • Return-visit excise -- rebutted

The alias names the app being created; it is not a setting, and the frozen Not a goal / design keeps it unpersisted: a configured install has nothing to render a manifest for.
Prefilling the detected login would need a server endpoint handing the host account name to every authenticated client, which is the $USER default this PR deletes (it is now a 400); the CLI path reads it locally, not over HTTP.
Cost is one short field per visit on the one card whose only purpose is creating an app.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=16f7cb0360f0

  • No blind read has run on this fork -- rebutted

Lane limitation on fork heads, not a change this PR can make; the hint copy now follows the lane's own suggestion and names the two controls it enables.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=8bd5c3ffcabb

  • alias_required_hint names the outcomes -- fixed

en: "Enter an alias to enable Create Slack app and Copy manifest YAML."; the other 12 locales re-translated naming their own button labels, fr/ru/bn/hi in the informal register (I18N_BASE_REF style tests pass), en-XA regenerated.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=e8f99443dc67

  • Item 3 — inherited -- fixed

## Backwards compatibility no longer claims what Slack did or did not import: it states that an explicit --alias of 24-32 characters used to render a manifest and now exits 1, because the 32-character command limit minus the 9-character kirocrew- prefix leaves 23, and that a detected login of that length is truncated with a notice. The compat loser is named.

@DcXiaoBing

Copy link
Copy Markdown
Contributor Author

span=81cb59a51f51

  • Item 6 — zero consumers -- fixed

messaging.py api_slack_manifest: the or "kirocrew" fallback and the $USER comment are gone; an empty or missing alias answers 400 {"error": "alias required"}.
grep -rn "api/slack/manifest|getSlackManifest" website/src src/kiro_crew finds one caller, SlackPanel.tsx via api.getSlackManifest(settledAlias), which always sends the alias.
Tests: test_manifest_endpoint_requires_an_alias (missing / empty / blank) and TestSlackManifest.test_400_without_an_alias; restoring the fallback fails 4 tests.

@iamwhatever

Copy link
Copy Markdown
Contributor

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 /kirocrew-<alias>, kirocrew manifest prints the matching slack.command, and the setup wizard offers it on a first Slack setup. You are credited as co-author on that commit.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack manifest: make slash command name unique per install (Enterprise Grid collisions)

4 participants