Skip to content

🐛 Bug: send_email_notification silently drops emails (task reports success) when the Redis origin key is missing #9354

Description

@cosmic-fire-eng

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

send_email_notification in apps/api/plane/bgtasks/email_notification_task.py silently drops all email notifications for an issue whenever its Redis origin key is missing:

base_api = ri.get(str(issue_id)).decode() if ri.get(str(issue_id)) else None
...
if not base_api:
    return

The early return emits no log and raises no exception, so the Celery task reports success while sending nothing.

The key is only written by issue_activity (ri.set(str(issue_id), origin, ex=600)) when an origin kwarg is passed, with a 600s TTL. So the key is absent — and emails are silently dropped — whenever:

  • Redis restarts or evicts the key between the activity and the (debounced/delayed) email task,
  • more than 10 minutes elapse before the email task reads it, or
  • the activity was queued without origin at all (the public REST API paths do this — see 🐛 Bug: Issues created or updated via REST API send no notifications or emails #9306, which this bug also masks: the in-app notification bug there is at least visible, but the email half fails with a "successful" task).

Expected behavior

If the cached origin is unavailable, the task should fall back to the configured WEB_URL (settings) for link construction — and at minimum log a WARNING — instead of silently discarding the notification batch while reporting success.

Suggested fix

In send_email_notification, replace the bare return with a fallback to settings.WEB_URL plus a log.warning when the Redis key is missing. (Two small changes; happy to detail.)

Steps to reproduce

  1. SMTP configured; user B has email notifications enabled.
  2. User A assigns user B to an issue in the web UI (this queues issue_activity with origin, then the debounced email task).
  3. Before the email task runs, restart/flush Redis (or wait past the 600s TTL under a delayed worker).
  4. Email task runs, returns early, reports SUCCESS; user B receives nothing; no log line indicates a drop.

Environment

Production

Variant

Self-hosted

Version

v1.3.1 (Community); code path unchanged on current default branch as of 2026-06-19

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions