feat(seer): Mirror last_triggered_at to SeerRun on autofix triggers#115611
Open
trevor-e wants to merge 4 commits into
Open
feat(seer): Mirror last_triggered_at to SeerRun on autofix triggers#115611trevor-e wants to merge 4 commits into
trevor-e wants to merge 4 commits into
Conversation
Dual-write the last-triggered timestamp to SeerRun alongside the existing Group cache columns (seer_autofix_last_triggered, seer_explorer_autofix_last_triggered) so SeerRun.last_triggered_at stays accurate during the SeerRun/SeerAgentRun mirror rollout. Reads continue to come from the Group columns; this only keeps the new model in sync so we can shift reads later without backfill gaps. Each pair of writes is wrapped in transaction.atomic(using=...) so the Group and SeerRun timestamps land together. When the matching SeerRun row hasn't been mirrored yet, the filter().update() is a silent no-op. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit acf644f. Configure here.
_call_autofix can return None (run.seer_run_state_id is nullable, and the response.json() fallback path may not include run_id). Without an isinstance(run_id, int) guard, filter(seer_run_state_id=None) generates WHERE seer_run_state_id IS NULL and could update unrelated mirror rows that haven't been backfilled yet. Mirrors the guard already in place in group_autofix_update.py. Co-Authored-By: Claude <noreply@anthropic.com>
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.

Dual-write the last-triggered timestamp to
SeerRunat the three existing sites that stamp theGroup.seer_autofix_last_triggered/Group.seer_explorer_autofix_last_triggeredcache columns:seer/autofix/autofix.py— autofix triggerseer/endpoints/group_autofix_update.py— autofix update endpointseer/autofix/on_completion_hook.py— agent-based autofix step completionPart of the ongoing
SeerRun/SeerAgentRunmirror rollout. Reads still come from the Group cache columns — this PR only keepsSeerRun.last_triggered_atin sync so we can shift the read paths later without a backfill gap.Each pair of writes is wrapped in
transaction.atomic(using=router.db_for_write(Group))so the two timestamps land together; both models are@cell_silo_modeland resolve to the same DB. When the matchingSeerRunrow hasn't been mirrored yet (mirror isn't at 100%), thefilter().update()is a silent no-op.The update endpoint uses
request.data.get("run_id")and guards withisinstance(run_id, int)so a missing/malformed run_id doesn't accidentallyfilter(seer_run_state_id=None)and update unrelated rows (the column isnull=True).