Skip to content

Conversation

@ameliahsu
Copy link
Member

redirects metric alert incidents to the appropriate metric issue.

note we don't currently support passing a specific open period id to the UI, but we can easily add this to the redirect logic later.

@ameliahsu ameliahsu requested a review from a team as a code owner November 25, 2025 20:02
@ameliahsu ameliahsu requested a review from a team November 25, 2025 20:02
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 25, 2025
@mifu67 mifu67 self-requested a review November 25, 2025 20:02
Comment on lines +283 to +290
useApiQuery<IncidentGroupOpenPeriod>(
[
`/organizations/${organization.slug}/incident-groupopenperiod/`,
{query: {incident_identifier: alertId}},
],
{
staleTime: 0,
enabled: shouldRedirect && !!alertId,
Copy link

Choose a reason for hiding this comment

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

Bug: withOpenPeriodRedirect lacks error handling for useApiQuery failures, causing silent fallbacks and cascading issues when /incident-groupopenperiod/ returns errors.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The withOpenPeriodRedirect function uses useApiQuery to fetch data from /incident-groupopenperiod/ but lacks error handling for API failures. When the API request fails (e.g., returns a 404, 400, or 5xx error), the isError state from useApiQuery is not checked. This causes the component to silently fall through and render the wrapped component (AlertWizardProjectProvider), leading to a cascading failure where the user experiences indefinite loading or repeated failures from the old incidentRedirect component.

💡 Suggested Fix

Add an if (isError) check within withOpenPeriodRedirect to display an appropriate error message or component (e.g., <LoadingError />) when useApiQuery fails to fetch data from /incident-groupopenperiod/.

🤖 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: static/app/views/alerts/workflowEngineRedirects.tsx#L283-L290

Potential issue: The `withOpenPeriodRedirect` function uses `useApiQuery` to fetch data
from `/incident-groupopenperiod/` but lacks error handling for API failures. When the
API request fails (e.g., returns a 404, 400, or 5xx error), the `isError` state from
`useApiQuery` is not checked. This causes the component to silently fall through and
render the wrapped component (`AlertWizardProjectProvider`), leading to a cascading
failure where the user experiences indefinite loading or repeated failures from the old
`incidentRedirect` component.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 3622188

@ameliahsu ameliahsu merged commit 41df9ad into master Nov 26, 2025
48 checks passed
@ameliahsu ameliahsu deleted the mia/aci/redirect-incidents branch November 26, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants