Skip to content
Merged
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
7 changes: 6 additions & 1 deletion src/sentry/tasks/llm_issue_detection/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def get_base_platform(platform: str | None) -> str | None:
}


FALLBACK_ISSUE_TITLE = "AI-Detected Application Issue"


def get_group_type_for_title(title: str) -> type[GroupType]:
return TITLE_TO_GROUP_TYPE.get(title, AIDetectedGeneralGroupType)

Expand Down Expand Up @@ -227,7 +230,9 @@ def create_issue_occurrence_from_detection(
event_id=event_id,
project_id=project.id,
fingerprint=fingerprint,
issue_title=detected_issue.title,
issue_title=(
FALLBACK_ISSUE_TITLE if detected_issue.title == "Other" else detected_issue.title
),
subtitle=detected_issue.explanation[:200], # Truncate for subtitle
resource_id=None,
evidence_data=evidence_data,
Expand Down
21 changes: 21 additions & 0 deletions tests/sentry/tasks/test_llm_issue_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,27 @@ def test_create_issue_occurrence_uses_group_for_fingerprint_when_set(
assert occurrence.fingerprint == [f"1-{AIDetectedDBGroupType.type_id}-n+1-database-queries"]
assert occurrence.type == AIDetectedDBGroupType

@patch("sentry.tasks.llm_issue_detection.detection.produce_occurrence_to_kafka")
def test_other_title_uses_fallback_display_title(self, mock_produce_occurrence):
detected_issue = DetectedIssue(
title="Other",
explanation="Something unusual happening here",
impact="Low",
evidence="Observed in trace",
offender_span_ids=[],
trace_id="trace789",
transaction_name="POST /foo",
verification_reason="Verified",
group_for_fingerprint="Other",
)
create_issue_occurrence_from_detection(
detected_issue=detected_issue,
project=self.project,
)
occurrence = mock_produce_occurrence.call_args.kwargs["occurrence"]
assert occurrence.issue_title == "AI-Detected Application Issue"
assert occurrence.type == AIDetectedGeneralGroupType

@with_feature("organizations:gen-ai-features")
@patch("sentry.tasks.llm_issue_detection.detection.mark_traces_as_processed")
@patch("sentry.tasks.llm_issue_detection.detection._get_unprocessed_traces")
Expand Down
Loading