Skip to content

feat(incidents): Add skip-paging option for self-handled P0/P1 incidents#254

Open
rgibert wants to merge 5 commits into
mainfrom
rgibert/skip-paging-option
Open

feat(incidents): Add skip-paging option for self-handled P0/P1 incidents#254
rgibert wants to merge 5 commits into
mainfrom
rgibert/skip-paging-option

Conversation

@rgibert

@rgibert rgibert commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a "Skip paging on-call responders" checkbox to the /inc new Slack modal, grouped with the private incident toggle in a single Options block
  • Checkbox appears only for P0/P1 severity (dynamically via views.update on severity change) and defaults to checked
  • When selected, suppresses both PagerDuty paging and on-call channel invites at creation time
  • Implemented as a transient flag threaded through serializer context -- no model or migration changes

Agent transcript: https://claudescope.sentry.dev/share/eReflyKHOjlxj3XHUR_WogKuafhwOofLe6_a9YdDSIA

Adds a "Skip paging on-call responders" checkbox to the /inc new modal
that appears (and defaults to checked) when severity is P0 or P1. When
selected, both PagerDuty paging and on-call channel invites are skipped.

The flag is transient -- it threads from the Slack modal through serializer
context to the incident hooks at creation time, with no model changes.

The severity select now uses dispatch_action to dynamically show/hide the
skip-paging option via views.update when the user changes severity.

Closes RELENG-833

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/_VGnoulIKkldtN9n9qeKgA1BrEzRNdYIUxYb9B11C2o
@rgibert rgibert requested a review from a team as a code owner June 12, 2026 15:08
@linear-code

linear-code Bot commented Jun 12, 2026

Copy link
Copy Markdown

RELENG-833

@rgibert rgibert self-assigned this Jun 12, 2026
Comment thread src/firetower/slack_app/handlers/new_incident.py
The serializer test expected on_incident_created(incident) without the
new skip_paging kwarg. The two new handler tests needed HOOKS_ENABLED=True
to reach the on_incident_created call path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/uOhBQs8tSIs_BIgGrBMKGlxijRPYmS3xP0YXebZtObc
Comment thread src/firetower/incidents/serializers.py
Comment thread src/firetower/slack_app/tests/handlers/test_new_incident.py
Comment thread src/firetower/slack_app/tests/handlers/test_new_incident.py
When a user changes severity in the modal, handle_severity_action now
reads the current options_block selections from view state and threads
them through to _build_options_block so initial_options reflects the
user's prior choices (e.g. private) rather than resetting them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/08Y9vY0PBATSmZuY5L6EAGyLKxFKk0sRIBUBbK-jk5U
Comment thread src/firetower/incidents/hooks.py
When a user first selects P0/P1, skip_paging was not in the prior
selections (it did not exist at the previous severity), so
_build_options_block received an empty set and skipped the default-on
branch. Now handle_severity_action injects skip_paging into the
selected values when the new severity is high and skip_paging is not
already present, ensuring it renders checked on first appearance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/ADzF8zl8QmltQGscnYCK808rg5r0ERyZGJtS2FN9m4M

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3f893ef. Configure here.

selected_values = {opt.get("value") for opt in prior_selections}

if severity in HIGH_SEVERITIES and "skip_paging" not in selected_values:
selected_values.add("skip_paging")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity change rechecks skip paging

Medium Severity

In handle_severity_action, when severity is P0/P1 the code adds skip_paging to selected_values whenever it is missing. That runs on every severity change, so a user who unchecked “Skip paging on-call responders” to allow paging can have the option forced back on when they switch between high severities, suppressing PagerDuty and on-call invites contrary to their choice.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3f893ef. Configure here.

Comment on lines +276 to +277
if severity in HIGH_SEVERITIES and "skip_paging" not in selected_values:
selected_values.add("skip_paging")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The "Skip paging" checkbox is incorrectly re-checked if a user unchecks it, changes to a non-high severity, and then changes back to a high severity.
Severity: MEDIUM

Suggested Fix

Modify the handle_severity_action handler to preserve the user's choice for skip_paging across severity changes. The logic should not automatically re-add the skip_paging default if the user has previously interacted with the incident creation form. This could involve checking the prior state more carefully before injecting default values.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/firetower/slack_app/handlers/new_incident.py#L276-L277

Potential issue: When a user creates a high-severity incident (P0/P1), explicitly
unchecks the "Skip paging on-call responders" option, changes the severity to a non-high
level (e.g., P2), and then changes it back to a high severity, the "Skip paging" option
is incorrectly re-checked. This happens because the logic at `handle_severity_action`
re-injects the `skip_paging` default when it's not found in the view's state. The state
is cleared of this option when switching to a non-high severity, causing the system to
forget the user's explicit choice to uncheck the box, leading to unwanted PagerDuty
pages.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment thread src/firetower/slack_app/bolt.py
handle_severity_action now extracts user_id from the action body and
passes it to _build_new_incident_modal so the captain block retains its
initial_user when views.update rebuilds the modal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/Qeq8_btcFr1qAGYpHcYenuDZuFQwAdU2EoYfA3V5dnI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant