Skip to content

feat(seer): Nightly user-feedback summary as a second night shift kind#114794

Draft
trevor-e wants to merge 3 commits intotelkins/night-shift-column-deletionfrom
telkins/night-shift-feedback-summary-feature
Draft

feat(seer): Nightly user-feedback summary as a second night shift kind#114794
trevor-e wants to merge 3 commits intotelkins/night-shift-column-deletionfrom
telkins/night-shift-feedback-summary-feature

Conversation

@trevor-e
Copy link
Copy Markdown
Member

@trevor-e trevor-e commented May 4, 2026

Stacked on #114828 (which is itself stacked on #114790). Review and land the lower PRs first.

Adds feedback_summary as a second night-shift kind on top of the genericized result table.

  • New agentic_feedback_summary_strategy mirrors agentic_triage: SeerAgentClient run with custom feedback list/details tools, pydantic FeedbackSummaryArtifact, per-org IDOR scoping, short-circuits below 10 unresolved feedbacks in the last 24h.
  • cron.py threads kinds through schedule → run-for-org → execution. Per-kind feature gates: triage keeps organizations:seer-night-shift; feedback summary requires the new organizations:seer-night-shift-feedback-summary. Universal gen-ai-features and seat-based-seer-enabled still apply.
  • Per-kind state on the shared parent run lives under extras["kinds"][<kind>] and is updated via select_for_update so concurrent kind branches don't clobber each other.
  • Admin trigger endpoint accepts an optional kinds body param.
  • Serializer adds a kinds response key for per-kind state.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 4, 2026
Comment thread src/sentry/tasks/seer/night_shift/cron.py
Comment thread src/sentry/tasks/seer/night_shift/cron.py
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 990a9ef. Configure here.

Comment thread src/sentry/tasks/seer/night_shift/feedback_summary.py
Comment thread src/sentry/seer/endpoints/admin_night_shift_trigger.py
Comment thread src/sentry/tasks/seer/night_shift/cron.py
trevor-e added 3 commits May 4, 2026 22:06
… kind

Layers a new "feedback_summary" kind on top of the genericized result
table. Each org's nightly run now creates one parent row that fans out
into one execution branch per enabled kind, with per-kind state tracked
under run.extras["kinds"][<kind>].

- New agentic_feedback_summary_strategy (mirrors agentic_triage's
  shape): SeerAgentClient run with custom feedback list/details tools,
  pydantic FeedbackSummaryArtifact schema, per-org IDOR scoping, short-
  circuits when fewer than MIN_FEEDBACKS_TO_SUMMARIZE feedbacks in the
  last 24h.
- cron.py threads `kinds` through schedule → run_for_org → run_execution.
  Per-kind feature gating: agentic_triage requires
  organizations:seer-night-shift, feedback_summary requires
  organizations:seer-night-shift-feedback-summary; both still require
  the universal gen-ai-features and seat-based-seer-enabled flags.
- _update_kind_state uses select_for_update to avoid clobbering between
  concurrent kind branches sharing the same parent row.
- Admin trigger endpoint accepts an optional `kinds` body param.
- NightShiftRunResultKind enum gains FEEDBACK_SUMMARY.
- Serializer surfaces the per-kind state under a new `kinds` key and
  picks the most-recent triage error for the legacy errorMessage alias.
1. agentic_triage no longer does run.update(extras=...) after start_run.
   That call read a stale in-memory snapshot of run.extras and wrote the
   whole column back, clobbering any concurrent _update_kind_state writes
   from the feedback_summary branch. The agent_run_id is already
   persisted via cron's _update_kind_state on the success path.

2. feedback_summary now raises RuntimeError when the agent finishes
   without producing an artifact, instead of returning the agent_run_id.
   Cron's existing exception handler then correctly marks the kind as
   "failed" rather than "succeeded".
Mypy now narrows `k` to NightShiftKind via the membership check against
ALL_NIGHT_SHIFT_KINDS, so the type: ignore is no longer needed.
@trevor-e trevor-e force-pushed the telkins/night-shift-feedback-summary-feature branch from 990a9ef to 48a7347 Compare May 5, 2026 02:07
@trevor-e trevor-e changed the base branch from telkins/night-shift-feedback-summary to telkins/night-shift-column-deletion May 5, 2026 02:07
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.

1 participant