ref(seer): Unify Seer project settings update helper and add tuning and auto_create_pr fields#116352
Merged
Merged
Conversation
srest2021
commented
May 27, 2026
| automation_tuning = serializers.ChoiceField( | ||
| choices=[AutofixAutomationTuningSettings.OFF, AutofixAutomationTuningSettings.MEDIUM], | ||
| required=False, | ||
| ) |
Member
Author
There was a problem hiding this comment.
It's easier to keep stopping point and tuning as independent fields, so that we can support legacy seer which allows other tuning values besides "off" and "medium".
srest2021
commented
May 27, 2026
| # Keep stopping point in sync with handoff auto_create_pr. | ||
| if "stopping_point" in data and "auto_create_pr" not in data: | ||
| data["auto_create_pr"] = data["stopping_point"] == AutofixStoppingPoint.OPEN_PR | ||
|
|
Member
Author
There was a problem hiding this comment.
Here we keep auto_create_pr in sync with the stopping point before we pass the serializer data to update_seer_project_settings.
JoshFerge
reviewed
May 28, 2026
Member
JoshFerge
left a comment
There was a problem hiding this comment.
I'm finding it a bit difficult to review, as there are a few threads to follow in this PR
- Consolidate update_seer_project_settings and bulk_update_seer_project_settings into a single function
- Strip seat-based business logic
- add tuning and auto_create_pr as update fields
- SeerProjectSettingsUpdate uses snake_case keys via CamelSnakeSerializer.
- Add tuning to the project settings endpoints serializers (as opposed to consolidating tuning="off" into stopping_point="off"), again to make it easier to support legacy seer.
- Endpoint returns autoCreatePr and automationTuning in response.
- Stopping point syncs auto_create_pr automatically.
Could this PR be broken down further, or do all these changes need to go in together?
…taking project_ids
…er with auto_create_pr sync
dc236fb to
f682313
Compare
JoshFerge
reviewed
May 28, 2026
JoshFerge
reviewed
May 28, 2026
JoshFerge
approved these changes
May 28, 2026
Member
JoshFerge
left a comment
There was a problem hiding this comment.
looks great! appreciate breaking it out by commit, super easy to review! just a couple minor comments
srest2021
added a commit
that referenced
this pull request
May 29, 2026
…ndpoint (#115962) Depends on #116352 and #116356. Add legacy usage-based Seer support to the project settings endpoints by branching on `is_seer_seat_based_tier_enabled`. **Serializer split:** - Extract `_BaseProjectSettingsUpdateSerializer` with shared validation (agent, integration_id, cross-field checks) - `ProjectSettingsUpdateSerializer` (seat-based): restricted tuning choices (off/medium), stopping_point validation via `get_valid_automated_run_stopping_points`, auto_create_pr synced from stopping_point - `LegacyProjectSettingsUpdateSerializer` (usage-based): accepts all tuning values, direct `auto_create_pr` field, no stopping_point restrictions ### Example payloads **Set tuning to a granular value:** ```json PUT /api/0/projects/{org}/{project}/seer/settings/ {"automationTuning": "high"} ``` **Set stopping point (frontend sends agent=seer to clear any external handoff):** ```json PUT /api/0/projects/{org}/{project}/seer/settings/ {"stoppingPoint": "code_changes", "agent": "seer"} ``` This clears handoff keys (target, point, integration_id) but preserves `auto_create_pr` so switching back to an external agent restores the previous toggle value. **Switch to external agent with auto_create_pr:** ```json PUT /api/0/projects/{org}/{project}/seer/settings/ {"agent": "cursor_background_agent", "integrationId": 1, "autoCreatePr": true} ``` **Toggle auto_create_pr on an existing external agent:** ```json PUT /api/0/projects/{org}/{project}/seer/settings/ {"autoCreatePr": false} ``` **Turn off automation:** ```json PUT /api/0/projects/{org}/{project}/seer/settings/ {"automationTuning": "off"} ``` GET response will show `stoppingPoint: "off"`, but the stored stopping point is unchanged — re-enabling restores it.
srest2021
added a commit
that referenced
this pull request
May 29, 2026
…t need to update the full Seer project preference (#116356) Followup to #116352. Reroute existing callsites that modify seer project settings (`_write_preferences_to_sentry_db`, `configure_seer_for_existing_org`, `set_default_project_seer_preferences`) to the unified `update_seer_project_settings` helper. This ensures handoff options are cleared/added atomically and skips unnecessary connected repo operations. Also remove `Project` row locks from `_write_preferences_to_sentry_db` and `clear_preference_automation_handoff` — no longer needed since handoff options are all either cleared or added atomically, and the other update fields may be updated independently of each other.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consolidate
update_seer_project_settingsandbulk_update_seer_project_settingsinto a single functionthat bulk deletes/creates project options across 1+ project ids. Also, strip seat-based business logic (stopping point → auto_create_pr syncing, tuning validation) out of the update helper and add tuning and auto_create_pr as update fields, so it becomes a pure write layer and can be used by other callsites.
Followups: #116356, #115962
Why:
By moving business logic out, other callsites can do updates without hidden side effects.
_write_preferences_to_sentry_db,configure_seer_for_existing_org,set_default_project_seer_preferences) to the update helper to ensure that handoff options are either cleared or added atomically AND to skip unnecessary connected repo operations. It also removesProjectrow locks and simplifiesclear_preference_automation_handoff.Other cleanups:
SeerProjectSettingsUpdateuses snake_case keys viaCamelSnakeSerializer.autoCreatePrandautomationTuningin response.auto_create_prautomatically.