|
83 | 83 | from sentry.seer.autofix.utils import ( |
84 | 84 | AutofixTriggerSource, |
85 | 85 | get_project_seer_preferences, |
| 86 | + read_preference_from_sentry_db, |
86 | 87 | resolve_repository_ids, |
87 | 88 | write_preference_to_sentry_db, |
88 | 89 | ) |
@@ -613,17 +614,23 @@ def trigger_coding_agent_launch( |
613 | 614 | }, |
614 | 615 | ) |
615 | 616 | try: |
616 | | - project = Project.objects.get_from_cache(id=project_id) |
617 | 617 | organization = Organization.objects.get_from_cache(id=organization_id) |
618 | 618 | if features.has("organizations:seer-project-settings-dual-write", organization): |
619 | | - preference_response = get_project_seer_preferences(project.id) |
620 | | - if preference_response and preference_response.preference: |
621 | | - updated_preference = preference_response.preference.copy( |
622 | | - update={"automation_handoff": None} |
623 | | - ) |
624 | | - validated_pref = SeerProjectPreference.validate(updated_preference) |
625 | | - resolved_pref = resolve_repository_ids(organization.id, [validated_pref]) |
626 | | - write_preference_to_sentry_db(project, resolved_pref[0]) |
| 619 | + project = Project.objects.get_from_cache(id=project_id) |
| 620 | + |
| 621 | + if features.has( |
| 622 | + "organizations:seer-project-settings-read-from-sentry", organization |
| 623 | + ): |
| 624 | + preference = read_preference_from_sentry_db(project) |
| 625 | + else: |
| 626 | + preference = get_project_seer_preferences(project.id).preference |
| 627 | + |
| 628 | + if preference: |
| 629 | + updated_preference = preference.copy(update={"automation_handoff": None}) |
| 630 | + resolved_pref = resolve_repository_ids( |
| 631 | + organization.id, [SeerProjectPreference.validate(updated_preference)] |
| 632 | + )[0] |
| 633 | + write_preference_to_sentry_db(project, resolved_pref) |
627 | 634 | except Exception: |
628 | 635 | logger.exception( |
629 | 636 | "coding_agent.clear_handoff_preference_failed", |
|
0 commit comments