Skip to content

ref(seer): Return SeerRun from start_run to drop a re-query#117025

Merged
trevor-e merged 3 commits into
masterfrom
telkins/start-run-returns-seer-run
Jun 5, 2026
Merged

ref(seer): Return SeerRun from start_run to drop a re-query#117025
trevor-e merged 3 commits into
masterfrom
telkins/start-run-returns-seer-run

Conversation

@trevor-e

@trevor-e trevor-e commented Jun 5, 2026

Copy link
Copy Markdown
Member

SeerAgentClient.start_run now returns the SeerRun it creates instead of just seer_run_state_id.

This lets the night-shift agentic_triage path use the run directly and drop a redundant SeerRun.objects.filter(seer_run_state_id=...).first() lookup (which also silently left SeerNightShiftRun.seer_run unset on a miss).

Wire-facing callers and trigger_autofix_agent read .seer_run_state_id, so the API run_id response is unchanged. continue_run still returns an int.

trevor-e and others added 2 commits June 4, 2026 20:55
Graduate the SeerRun mirror rollout: remove the organizations:seer-run-mirror,
seer-run-mirror-explorer, and seer-run-mirror-autofix feature flags so the
outbox-based double-write always runs for explorer and assisted-query starts.
The direct-HTTP fallbacks are now dead and removed.

Delete the legacy non-agent autofix scaffolding (SeerRunType.AUTOFIX, the
receiver's AUTOFIX dispatch arm, and make_autofix_start_request). Agent-based
autofix runs through SeerAgentClient.start_run, so nothing created AUTOFIX
rows; the path was removed with legacy autofix.

Bump last_triggered_at in continue_run to mirror Seer's mark_triggered() so an
actively-continued run reflects recent activity for the recency indexes and TTL
cleanup, rather than only its first-trigger time.

Co-Authored-By: Claude <noreply@anthropic.com>
SeerAgentClient.start_run now returns the SeerRun it creates instead of
just its seer_run_state_id. The night-shift agentic_triage path uses the
returned run directly, removing a redundant
SeerRun.objects.filter(seer_run_state_id=...).first() lookup along with the
silent-None path it carried (a missed mirror left the run FK unset).

Wire-facing callers (agent chat, dashboard) and trigger_autofix_agent read
.seer_run_state_id off the returned run, so the API run_id contract is
unchanged. continue_run still returns an int since it creates no run.

Co-Authored-By: Claude <noreply@anthropic.com>
@trevor-e trevor-e requested review from a team as code owners June 5, 2026 20:39
@trevor-e trevor-e marked this pull request as draft June 5, 2026 20:39
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 5, 2026
…eturns-seer-run

# Conflicts:
#	src/sentry/seer/agent/client.py
#	tests/sentry/seer/endpoints/test_organization_seer_agent_chat.py
Comment thread src/sentry/seer/agent/client.py
@trevor-e trevor-e marked this pull request as ready for review June 5, 2026 21:01
@trevor-e trevor-e merged commit ee0437c into master Jun 5, 2026
66 checks passed
@trevor-e trevor-e deleted the telkins/start-run-returns-seer-run branch June 5, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants