Skip to content

[ENG-11880] Fixed missed email sends - #11912

Open
ihorsokhanexoft wants to merge 3 commits into
CenterForOpenScience:feature/pbs-26-19from
ihorsokhanexoft:fix/ENG-11880
Open

ihorsokhanexoft wants to merge 3 commits into
CenterForOpenScience:feature/pbs-26-19from
ihorsokhanexoft:fix/ENG-11880

Conversation

@ihorsokhanexoft

@ihorsokhanexoft ihorsokhanexoft commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Ticket

https://openscience.atlassian.net/browse/ENG-11880

Purpose

Initial approval emails are not sent for usual and embargoed registrations
node_pending_embargo_admin and node_pending_registration_admin emails are not sent.

Changes

ACTUAL APPROACH:

Use retry to avoid race condition

PREVIOUS APPROACH:

According to sentry, we have multiple different issues with the archiving process. This PR fixes the error that caused NoneType.root attribute access issue.
Two changes made:

  1. Use the previous approach with a Django signal and pass registration object to the signal instead of its guid and convert callback task back to signal
  2. Return a group of chains of [archive_addon, make_copy_request] tasks so that we follow the initial fix that caused this issue: waterbutler call must be made after addons are archived. So this group is run as a part of the whole archiving flow

https://sentry3.cos.io/organizations/cos/discover/results/?cursor=0%3A100%3A0&field=title&field=release&field=environment&field=user.display&field=timestamp&field=celery_task_id&field=dist&name=AttributeError%3A+%27NoneType%27+object+has+no+attribute+%27root%27&project=2&query=issue%3APROD-OSF-BE-5Z8D&sort=-timestamp&statsPeriod=90d&yAxis=count%28%29

For the reported registration my9kp, there is the same issue (guid saved in Additional Data section) that caused successful archiving but no emails sent.
https://sentry3.cos.io/organizations/cos/issues/214086/events/b9d4781d876e4483a5f3c747ef7e1b0d/?project=2

Despite the error was found for the reported registration (used registration creation date to find the following issue in sentry), I was not able to find the same sentry error for the other registrations

Side notes

Even though this change will fix one bug with the archiving process, sentry says there are a few more issues with archiving that potentially can lead to failed registration archiving, so my recommendations are:

  1. Would be nice to refactor archiver a bit as it's confusing and hard to support/debug. Making it run with chains/groups, etc makes it difficult to debug and may cause some unforeseen race conditions and so on. We can make the main celery task to run archiving of nodes/addons/files, etc step by step that will help us to avoid different issues
  2. Standardize sentry/logger errors to make sentry much more useful. We can create a helper that logs an error in logs and sentry. Object guid must be required and error message. In this way we can easily find errors related to a specific object because now sentry displays guids in Additional Data section that makes it difficult to find these errors as per sentry docs additional data is not indexed, thus cannot be found via sentry search.

@ihorsokhanexoft ihorsokhanexoft changed the title [ENG-11880] Fixed empty generator with admins on approval [ENG-11880] Fixed missed email sends Sep 16, 2026
Comment thread osf/models/registrations.py Outdated
self.registration_approval.add_authorizer(admin, node=node)
self.registration_approval.save() # Save approval's approval_state
try:
self.registration_approval.ask(admins)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  1. So if we ask() here and in archive_success() we ask again, doesn't that mean the user will receive two identical emails of the same notification?
  2. If we send the notification here, that means it is possible that the user will approve the registration before archiving is done. What happens then if archiving fails?

@ihorsokhanexoft
ihorsokhanexoft force-pushed the fix/ENG-11880 branch 2 times, most recently from b96c7f6 to 3103fc3 Compare September 30, 2026 05:59
@brianjgeiger
brianjgeiger changed the base branch from feature/pbs-26-18 to feature/pbs-26-19 October 1, 2026 12:37
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.

3 participants