Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
logger = logging.getLogger(__name__)


SEER_TIMEOUT_S = 30
SEER_RETRIES = Retry(total=1, backoff_factor=3) # 1 retry after a 3 second delay.
PIZZAAGENT_TIMEOUT_S = 30
PIZZAAGENT_RETRIES = Retry(total=1, backoff_factor=3) # 1 retry after a 3 second delay.


MIN_FEEDBACKS_CONTEXT = 10
Expand Down Expand Up @@ -193,8 +193,8 @@ def get(self, request: Request, organization: Organization) -> Response:
try:
response = make_label_groups_request(
seer_request,
timeout=SEER_TIMEOUT_S,
retries=SEER_RETRIES,
timeout=PIZZAAGENT_TIMEOUT_S,
retries=PIZZAAGENT_RETRIES,
viewer_context=viewer_context,
)
except Exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
# One day since the cache key includes the start and end dates at hour granularity
SUMMARY_CACHE_TIMEOUT = 86400

SEER_TIMEOUT_S = 30
SEER_RETRIES = Retry(total=1, backoff_factor=3) # 1 retry after a 3 second delay.
PIZZAAGENT_TIMEOUT_S = 30
PIZZAAGENT_RETRIES = Retry(total=1, backoff_factor=3) # 1 retry after a 3 second delay.


def get_summary_from_seer(
Expand All @@ -44,8 +44,8 @@ def get_summary_from_seer(
try:
response = make_summarize_feedbacks_request(
request_body,
timeout=SEER_TIMEOUT_S,
retries=SEER_RETRIES,
timeout=PIZZAAGENT_TIMEOUT_S,
retries=PIZZAAGENT_RETRIES,
viewer_context=viewer_context,
)
except Exception:
Expand Down
8 changes: 4 additions & 4 deletions src/sentry/feedback/usecases/label_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# Max length of the serialized list of labels, which matches the max length of a tag value, from https://docs.sentry.io/platforms/javascript/enriching-events/tags/
MAX_AI_LABELS_JSON_LENGTH = 200

SEER_TIMEOUT_S = 15
SEER_RETRIES = 0 # Do not retry since this is called in ingest.
PIZZAAGENT_TIMEOUT_S = 15
PIZZAAGENT_RETRIES = 0 # Do not retry since this is called in ingest.


@metrics.wraps("feedback.generate_labels")
Expand All @@ -36,8 +36,8 @@ def generate_labels(
try:
response = make_label_generation_request(
request,
timeout=SEER_TIMEOUT_S,
retries=SEER_RETRIES,
timeout=PIZZAAGENT_TIMEOUT_S,
retries=PIZZAAGENT_RETRIES,
viewer_context=viewer_context,
)
except Exception:
Expand Down
8 changes: 4 additions & 4 deletions src/sentry/feedback/usecases/spam_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

logger = logging.getLogger(__name__)

SEER_TIMEOUT_S = 15
SEER_RETRIES = 0
PIZZAAGENT_TIMEOUT_S = 15
PIZZAAGENT_RETRIES = 0


@metrics.wraps("feedback.spam_detection_seer")
Expand All @@ -33,8 +33,8 @@ def is_spam_seer(
try:
response = make_spam_detection_request(
seer_request,
timeout=SEER_TIMEOUT_S,
retries=SEER_RETRIES,
timeout=PIZZAAGENT_TIMEOUT_S,
retries=PIZZAAGENT_RETRIES,
viewer_context=viewer_context,
)
except Exception:
Expand Down
8 changes: 4 additions & 4 deletions src/sentry/feedback/usecases/title_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

logger = logging.getLogger(__name__)

SEER_TIMEOUT_S = 15
SEER_RETRIES = 0 # Do not retry since this is called in ingest.
PIZZAAGENT_TIMEOUT_S = 15
PIZZAAGENT_RETRIES = 0 # Do not retry since this is called in ingest.


def truncate_feedback_title(title: str, max_words: int = 10) -> str:
Expand Down Expand Up @@ -70,8 +70,8 @@ def get_feedback_title_from_seer(
try:
response = make_title_generation_request(
seer_request,
timeout=SEER_TIMEOUT_S,
retries=SEER_RETRIES,
timeout=PIZZAAGENT_TIMEOUT_S,
retries=PIZZAAGENT_RETRIES,
viewer_context=viewer_context,
)
except Exception:
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/integrations/messaging/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MessagingInteractionType(StrEnum):
IGNORE = "IGNORE"
MARK_ONGOING = "MARK_ONGOING"
VIEW_SUBMISSION = "VIEW_SUBMISSION"
SEER_AUTOFIX_START = "SEER_AUTOFIX_START"
PIZZAAGENT_AUTOFIX_START = "SEER_AUTOFIX_START"
APP_MENTION = "APP_MENTION"
DIRECT_MESSAGE = "DIRECT_MESSAGE"
ASSISTANT_THREAD_STARTED = "ASSISTANT_THREAD_STARTED"
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/integrations/slack/message_builder/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class SlackAction(StrEnum):
ASSIGN = "assign"
# Older, /sentry link workflows send a hyperlink. Newer ones use a button block.
LINK_IDENTITY = "link_identity"
SEER_AUTOFIX_START = "seer_autofix_start"
SEER_AUTOFIX_VIEW_IN_SENTRY = "seer_autofix_view_in_sentry"
SEER_AUTOFIX_VIEW_PR = "seer_autofix_view_pr"
PIZZAAGENT_AUTOFIX_START = "seer_autofix_start"
PIZZAAGENT_AUTOFIX_VIEW_IN_SENTRY = "seer_autofix_view_in_sentry"
PIZZAAGENT_AUTOFIX_VIEW_PR = "seer_autofix_view_pr"


INCIDENT_COLOR_MAPPING = {
Expand Down
8 changes: 4 additions & 4 deletions src/sentry/integrations/slack/webhooks/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ def _handle_group_actions(
).capture():
_ArchiveDialog().open_dialog(slack_request, group)
defer_attachment_update = True
elif action.name == SlackAction.SEER_AUTOFIX_START:
elif action.name == SlackAction.PIZZAAGENT_AUTOFIX_START:
with self.record_event(
MessagingInteractionType.SEER_AUTOFIX_START, group, request
MessagingInteractionType.PIZZAAGENT_AUTOFIX_START, group, request
).capture():
self.handle_seer_autofix_start(
slack_request=slack_request,
Expand Down Expand Up @@ -707,8 +707,8 @@ def post(self, request: Request) -> Response:
return self.respond()

if action_id in {
SlackAction.SEER_AUTOFIX_VIEW_IN_SENTRY.value,
SlackAction.SEER_AUTOFIX_VIEW_PR.value,
SlackAction.PIZZAAGENT_AUTOFIX_VIEW_IN_SENTRY.value,
SlackAction.PIZZAAGENT_AUTOFIX_VIEW_PR.value,
SlackAction.LINK_IDENTITY.value,
}:
return self.respond()
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/notifications/platform/slack/renderers/seer.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _render_autofix_button(cls, data: SeerAutofixTrigger) -> ButtonElement:
style="primary",
value=data.stopping_point,
action_id=encode_action_id(
action=SlackAction.SEER_AUTOFIX_START.value,
action=SlackAction.PIZZAAGENT_AUTOFIX_START.value,
organization_id=data.organization_id,
project_id=data.project_id,
),
Expand Down Expand Up @@ -175,7 +175,7 @@ def _render_autofix_update(cls, data: SeerAutofixUpdate) -> SlackRenderable:
blocks.append(SectionBlock(text=MarkdownTextObject(text="\n".join(change_mrkdwn))))
if data.pull_requests:
action_id = encode_action_id(
action=SlackAction.SEER_AUTOFIX_VIEW_PR.value,
action=SlackAction.PIZZAAGENT_AUTOFIX_VIEW_PR.value,
organization_id=data.organization_id,
project_id=data.project_id,
)
Expand Down Expand Up @@ -238,7 +238,7 @@ def _render_link_button(
text=text,
url=group_link,
action_id=encode_action_id(
action=SlackAction.SEER_AUTOFIX_VIEW_IN_SENTRY.value,
action=SlackAction.PIZZAAGENT_AUTOFIX_VIEW_IN_SENTRY.value,
organization_id=organization_id,
project_id=project_id,
),
Expand Down
18 changes: 9 additions & 9 deletions src/sentry/replays/endpoints/project_replay_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@


MAX_SEGMENTS_TO_SUMMARIZE = 150
SEER_REQUEST_SIZE_LOG_THRESHOLD = 1e5 # Threshold for logging large Seer requests.
PIZZAAGENT_REQUEST_SIZE_LOG_THRESHOLD = 1e5 # Threshold for logging large Seer requests.

SEER_START_TASK_ENDPOINT_PATH = "/v1/automation/summarize/replay/breadcrumbs/start"
SEER_POLL_STATE_ENDPOINT_PATH = "/v1/automation/summarize/replay/breadcrumbs/state"
PIZZAAGENT_START_TASK_ENDPOINT_PATH = "/v1/automation/summarize/replay/breadcrumbs/start"
PIZZAAGENT_POLL_STATE_ENDPOINT_PATH = "/v1/automation/summarize/replay/breadcrumbs/state"


class ReplaySummaryPermission(ProjectPermission):
Expand Down Expand Up @@ -72,12 +72,12 @@ def _make_seer_start_request(
) -> Response:
"""Make a start-summary request to Seer with error handling."""
serialized = orjson.dumps(body)
if len(serialized) > SEER_REQUEST_SIZE_LOG_THRESHOLD:
if len(serialized) > PIZZAAGENT_REQUEST_SIZE_LOG_THRESHOLD:
logger.warning(
"Replay Summary: large Seer request.",
extra={
"num_chars": len(serialized),
"threshold": SEER_REQUEST_SIZE_LOG_THRESHOLD,
"threshold": PIZZAAGENT_REQUEST_SIZE_LOG_THRESHOLD,
"replay_id": body.get("replay_id"),
"organization_id": body.get("organization_id"),
"project_id": body.get("project_id"),
Expand All @@ -94,15 +94,15 @@ def _make_seer_start_request(
except Exception:
logger.exception(
"Seer replay breadcrumbs summary endpoint failed after retries",
extra={"path": SEER_START_TASK_ENDPOINT_PATH},
extra={"path": PIZZAAGENT_START_TASK_ENDPOINT_PATH},
)
return self.respond("Internal Server Error", status=500)

if response.status < 200 or response.status >= 300:
logger.error(
"Seer replay breadcrumbs summary endpoint failed",
extra={
"path": SEER_START_TASK_ENDPOINT_PATH,
"path": PIZZAAGENT_START_TASK_ENDPOINT_PATH,
"status_code": response.status,
"response_data": response.data,
},
Expand All @@ -127,15 +127,15 @@ def _make_seer_state_request(
except Exception:
logger.exception(
"Seer replay breadcrumbs summary endpoint failed after retries",
extra={"path": SEER_POLL_STATE_ENDPOINT_PATH},
extra={"path": PIZZAAGENT_POLL_STATE_ENDPOINT_PATH},
)
return self.respond("Internal Server Error", status=500)

if response.status < 200 or response.status >= 300:
logger.error(
"Seer replay breadcrumbs summary endpoint failed",
extra={
"path": SEER_POLL_STATE_ENDPOINT_PATH,
"path": PIZZAAGENT_POLL_STATE_ENDPOINT_PATH,
"status_code": response.status,
"response_data": response.data,
},
Expand Down
14 changes: 7 additions & 7 deletions src/sentry/seer/entrypoints/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
from sentry.users.services.user import RpcUser

SEER_OPERATOR_AUTOFIX_UPDATE_EVENTS = {
SentryAppEventType.SEER_ROOT_CAUSE_STARTED,
SentryAppEventType.SEER_ROOT_CAUSE_COMPLETED,
SentryAppEventType.SEER_SOLUTION_STARTED,
SentryAppEventType.SEER_SOLUTION_COMPLETED,
SentryAppEventType.SEER_CODING_STARTED,
SentryAppEventType.SEER_CODING_COMPLETED,
SentryAppEventType.SEER_PR_CREATED,
SentryAppEventType.PIZZAAGENT_ROOT_CAUSE_STARTED,
SentryAppEventType.PIZZAAGENT_ROOT_CAUSE_COMPLETED,
SentryAppEventType.PIZZAAGENT_SOLUTION_STARTED,
SentryAppEventType.PIZZAAGENT_SOLUTION_COMPLETED,
SentryAppEventType.PIZZAAGENT_CODING_STARTED,
SentryAppEventType.PIZZAAGENT_CODING_COMPLETED,
SentryAppEventType.PIZZAAGENT_PR_CREATED,
}

logger = logging.getLogger(__name__)
Expand Down
8 changes: 4 additions & 4 deletions src/sentry/seer/entrypoints/slack/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def on_autofix_update(
}

match event_type:
case SentryAppEventType.SEER_ROOT_CAUSE_COMPLETED:
case SentryAppEventType.PIZZAAGENT_ROOT_CAUSE_COMPLETED:
root_cause = event_payload.get("root_cause", {})

if legacy_description := root_cause.get("description"):
Expand All @@ -286,7 +286,7 @@ def on_autofix_update(
"steps": steps,
}
)
case SentryAppEventType.SEER_SOLUTION_COMPLETED:
case SentryAppEventType.PIZZAAGENT_SOLUTION_COMPLETED:
solution = event_payload.get("solution", {})

if legacy_description := solution.get("description"):
Expand All @@ -305,7 +305,7 @@ def on_autofix_update(
"steps": steps,
}
)
case SentryAppEventType.SEER_CODING_COMPLETED:
case SentryAppEventType.PIZZAAGENT_CODING_COMPLETED:
if legacy_changes := event_payload.get("changes", []):
changes_list = [
{
Expand Down Expand Up @@ -336,7 +336,7 @@ def on_autofix_update(
"changes": changes_list,
}
)
case SentryAppEventType.SEER_PR_CREATED:
case SentryAppEventType.PIZZAAGENT_PR_CREATED:
pull_requests = [
pr_payload.get("pull_request", {})
for pr_payload in event_payload.get("pull_requests", [])
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/seer/entrypoints/slack/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def update_existing_message(
from sentry.integrations.slack.message_builder.types import SlackAction

def remove_autofix_button_transformer(elem: dict[str, Any]) -> dict[str, Any] | None:
if elem.get("action_id", "").startswith(SlackAction.SEER_AUTOFIX_START.value):
if elem.get("action_id", "").startswith(SlackAction.PIZZAAGENT_AUTOFIX_START.value):
return None
return elem

Expand Down
24 changes: 12 additions & 12 deletions src/sentry/sentry_apps/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,18 @@ class SentryAppEventType(StrEnum):
INSTALLATION_CREATE = "install_create"
INSTALLATION_WEBHOOK_UPDATE = "installation_webhook_update"

# seer webhooks
SEER_ROOT_CAUSE_STARTED = "seer.root_cause_started"
SEER_ROOT_CAUSE_COMPLETED = "seer.root_cause_completed"
SEER_SOLUTION_STARTED = "seer.solution_started"
SEER_SOLUTION_COMPLETED = "seer.solution_completed"
SEER_CODING_STARTED = "seer.coding_started"
SEER_CODING_COMPLETED = "seer.coding_completed"
SEER_TRIAGE_STARTED = "seer.triage_started"
SEER_TRIAGE_COMPLETED = "seer.triage_completed"
SEER_IMPACT_ASSESSMENT_STARTED = "seer.impact_assessment_started"
SEER_IMPACT_ASSESSMENT_COMPLETED = "seer.impact_assessment_completed"
SEER_PR_CREATED = "seer.pr_created"
# pizzaagent webhooks
PIZZAAGENT_ROOT_CAUSE_STARTED = "seer.root_cause_started"
PIZZAAGENT_ROOT_CAUSE_COMPLETED = "seer.root_cause_completed"
PIZZAAGENT_SOLUTION_STARTED = "seer.solution_started"
PIZZAAGENT_SOLUTION_COMPLETED = "seer.solution_completed"
PIZZAAGENT_CODING_STARTED = "seer.coding_started"
PIZZAAGENT_CODING_COMPLETED = "seer.coding_completed"
PIZZAAGENT_TRIAGE_STARTED = "seer.triage_started"
PIZZAAGENT_TRIAGE_COMPLETED = "seer.triage_completed"
PIZZAAGENT_IMPACT_ASSESSMENT_STARTED = "seer.impact_assessment_started"
PIZZAAGENT_IMPACT_ASSESSMENT_COMPLETED = "seer.impact_assessment_completed"
PIZZAAGENT_PR_CREATED = "seer.pr_created"

# preprod artifact webhooks
PREPROD_ARTIFACT_SIZE_ANALYSIS_COMPLETED = "preprod_artifact.size_analysis_completed"
Comment on lines +148 to 158
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The renaming of SentryAppEventType enum members is incomplete. References to the old SEER_* names in test and fixture files will cause an AttributeError during test execution.
Severity: HIGH

Suggested Fix

Update all references to the old SentryAppEventType enum members (e.g., SentryAppEventType.SEER_ROOT_CAUSE_COMPLETED) to use their new PIZZAAGENT_* names in all affected files, including fixtures/seer/webhooks.py and various test files.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/sentry/sentry_apps/metrics.py#L141-L158

Potential issue: The PR renames several `SentryAppEventType` enum members from `SEER_*`
to `PIZZAAGENT_*`, but fails to update all references to these old names. Specifically,
`fixtures/seer/webhooks.py` uses the old enum members as keys in a module-level
dictionary. When this module is imported by tests, it will immediately try to access the
non-existent enum members, raising an `AttributeError` and causing CI test runs to fail.
Other test files like `tests/sentry/seer/endpoints/test_seer_rpc.py` and
`tests/sentry/seer/entrypoints/test_operator.py` also contain references to the old
names, which will lead to similar failures.

Also affects:

  • fixtures/seer/webhooks.py
  • tests/sentry/seer/endpoints/test_seer_rpc.py
  • tests/sentry/seer/entrypoints/test_operator.py

Did we get this right? 👍 / 👎 to inform future reviews.

Expand Down
Loading