Skip to content

fix(sentry_apps): Treat missing servicehook as halt, not error - #123709

Closed
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/sentry-app-missing-servicehook-halt
Closed

fix(sentry_apps): Treat missing servicehook as halt, not error#123709
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/sentry-app-missing-servicehook-halt

Conversation

@sentry

@sentry sentry Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Previously, sentry.sentry_apps.tasks.sentry_apps.send_webhooks would raise a SentryAppSentryError(MISSING_SERVICEHOOK) when no ServiceHook was found for an installation. This was incorrectly treated as a runtime failure, generating a high volume of noisy Sentry issues (~783k events).

This change reclassifies a missing ServiceHook as an expected halt condition, similar to APP_DISABLED.

Changes:

  • Added MISSING_SERVICEHOOK to SentryAppWebhookHaltReason enum.
  • Modified send_webhooks to call lifecycle.record_halt(halt_reason=SentryAppWebhookHaltReason.MISSING_SERVICEHOOK) and return, instead of raising an error.
  • Updated the corresponding unit test (test_does_not_send_if_no_service_hook_exists) to assert for a halt outcome instead of a failure.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes SENTRY-5HA0

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 6, 2026
@sentaur-athena
sentaur-athena marked this pull request as ready for review September 9, 2026 18:30
@sentaur-athena
sentaur-athena requested review from a team as code owners September 9, 2026 18:30
@sentaur-athena sentaur-athena added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Sep 9, 2026
@sentaur-athena

Copy link
Copy Markdown
Member

Discussed with Christina offline. They shouldn't be halt and she put up a fix here: #123920

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on 8192554 in this run:

tests/sentry/sentry_apps/tasks/test_sentry_apps.py::TestWorkflowNotification::test_does_not_send_if_no_service_hook_existslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/sentry_apps/tasks/test_sentry_apps.py:1661: in test_does_not_send_if_no_service_hook_exists
    workflow_notification(install.id, self.issue.id, "assigned", self.user.id)
src/sentry/silo/base.py:157: in override
    return original_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.13/site-packages/taskbroker_client/task.py:142: in __call__
    return self._func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/sentry_apps/tasks/sentry_apps.py:616: in workflow_notification
    send_webhooks(installation=install, event=event, data=data, actor=user)
src/sentry/sentry_apps/tasks/sentry_apps.py:869: in send_webhooks
    raise SentryAppSentryError(
E   sentry.sentry_apps.utils.errors.SentryAppSentryError
tests/sentry/sentry_apps/tasks/test_sentry_apps.py::TestWorkflowNotification::test_does_not_repair_when_multiple_hooks_missing_organization_idlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/sentry_apps/tasks/test_sentry_apps.py:1736: in test_does_not_repair_when_multiple_hooks_missing_organization_id
    with pytest.raises(SentryAppSentryError):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   Failed: DID NOT RAISE <class 'sentry.sentry_apps.utils.errors.SentryAppSentryError'>
tests/sentry/sentry_apps/tasks/test_sentry_apps.py::TestWorkflowNotification::test_does_not_repair_hook_belonging_to_another_organizationlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/sentry_apps/tasks/test_sentry_apps.py:1754: in test_does_not_repair_hook_belonging_to_another_organization
    with pytest.raises(SentryAppSentryError):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   Failed: DID NOT RAISE <class 'sentry.sentry_apps.utils.errors.SentryAppSentryError'>

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

Labels

Scope: Backend Automatically applied to PRs that change backend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant