feat(slack): Add list command to show active and mitigated incidents#194
Open
rgibert wants to merge 17 commits into
Open
feat(slack): Add list command to show active and mitigated incidents#194rgibert wants to merge 17 commits into
list command to show active and mitigated incidents#194rgibert wants to merge 17 commits into
Conversation
Add handle_list_command that responds with active and mitigated incidents grouped by status, excluding private and terminal-state incidents. Includes 8 test cases covering empty state, grouping, ordering, privacy filtering, and link formatting. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/rvyzwlSQ329ffIavjmsM6NVgHwtd802c79Fm0rGkXQ4
Wire handle_list_command into the command dispatcher for both "list" and "ls" subcommands, add them to KNOWN_SUBCOMMANDS for metrics tracking, and include the command in help output. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/DjJ6t8ZO_sqbk6IHmrGQiPmWd6h3xiPjb_UJw1ZZOYs
Calls users.info to check is_restricted/is_ultra_restricted before returning incident data. Fails open on API errors to avoid blocking legitimate users. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/xcbdzP6-Bc8Zwpwt0cbJLk-Ux2yggnJtRBcgrkBPa2A
Title and captain name are interpolated into Slack mrkdwn without escaping, allowing crafted titles like <http://evil|click> to inject clickable links. Uses the existing escape_slack_text helper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/RQcgU1pYf87GRjczZdGrgFmHpHz6XbChAMuHshP78PY
…al responses Captain displays as a Slack mention (<@SLACK_ID>) when the user has a Slack external profile, and falls back to the plain name otherwise. Incident number (INC-XXXX) links to the incident's Slack channel. All responses are now ephemeral (only visible to the requesting user). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/A8PX9kGW-TK67VAjrWjl2sgD3Kywk09wP5ETMV5xX58
The incident number is already a clickable link to the Slack channel, so the separate "Slack" link is unnecessary. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/ZS6pf4OC9_5JcyynSS5fkTZ_GVpLQv7gVNYnmuilA_Y
list command to show active and mitigated incidents
spalmurray
reviewed
May 22, 2026
spalmurray
reviewed
May 22, 2026
| ack() | ||
|
|
||
| user_id = body.get("user_id", "") | ||
| if client and user_id and _is_slack_guest(client, user_id): |
Contributor
There was a problem hiding this comment.
how did you even think of this edge case?? 😂 I would have missed this 10 times out of 10
Member
Author
There was a problem hiding this comment.
All the bots and I are like this 🤞🏻
Move is_slack_guest to slack service module, use get_full_name() for captain display fallback instead of manual name concatenation, and add proper None guards for captain_id and captain lookups. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/UW4oiAwxt8AaiqmO0WMGbIp1yE6uAKyOQCUH3ZF6Lu4
… name Condense the incident list display to a more scannable format using lowercase incident tags, bracketed severity, and IC label for captain. Co-Authored-By: Claude <noreply@anthropic.com>
… name Condense the incident list display to a more scannable format using lowercase incident tags, bracketed severity, and IC label for captain. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/CbeokUpMjZnvEAgxv5ACiHS8oyvqzOrXPb-EmOkopEU
…etower into rgibert/slack-list-command
Replace plain-text space-aligned help output with Slack Block Kit section fields for proper two-column layout in proportional fonts. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/uI4hHgeuAXoTs7IgBuaTGHgLwMRifvSF3JBOdMzbD4w
This reverts commit 4d0aafb.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 80aaf1f. Configure here.
Return False instead of True when the Slack API is unreachable so non-guest users are not blocked by transient API failures. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/XVBZMCxvTAN6rXml1HFtCbw8mT8Y5zeZIwy3GcO80Gs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add a
/ft list(alias/ft ls) slash command that shows all non-private active and mitigated incidents grouped by status. Usable from any channel or DM -- unlike other/ftsubcommands, this is a read-only cross-cutting query rather than an action on a specific incident channel.Output is grouped into Active then Mitigated sections, newest first within each group. Each line shows severity, incident number, title, captain, and a link to the Slack channel.
The query uses
select_related("captain")andprefetch_related("external_links")to avoid N+1 queries. Private incidents are excluded entirely since Slack command context does not carry an authenticated Django user.Agent transcript: https://claudescope.sentry.dev/share/LMXluTDxc8O5rC063_tQKM7h_nJvlTD5Ei9Ype98AyE