Skip to content

feat(autofix): PR iteration frontend changes#118049

Merged
joseph-sentry merged 9 commits into
masterfrom
joey--autofix-pr-iteration-frontend
Jun 22, 2026
Merged

feat(autofix): PR iteration frontend changes#118049
joseph-sentry merged 9 commits into
masterfrom
joey--autofix-pr-iteration-frontend

Conversation

@joseph-sentry

@joseph-sentry joseph-sentry commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

there's multiple changes happening in this PR:

  • update the logic to display code changes from PR iteration blocks in the autofix explorer conversation in the code changes card
  • show feedback from the PR iteration blocks in the code changes card
  • after a PR is created show the Pull request next step section (textarea + button)
  • show the pull request next step section within the code changes card when a user clicks the "reset" button on the card
  • clicking the submit button after populating feedback in the PR iteration section will send the request to the Sentry backend which will forward that to Seer to run the Autofix

Fixes https://linear.app/getsentry/issue/CW-1397

image image image image image

the main change is we update the code changes card to display the
feedback PR iteration feedback that was passed for each PR iteration

we also update metrics, the next step logic, and the "autofix section"
construction to support PR iteration blocks

feature flag fixes

feat(autofix): add reset to code changes card for PR iteration

for PR iteration we want to enable the reset button in the top right
of the code changes card to open up an equivalent form as the PullRequestNextStep
component at the top of the code changes card to provide feedback and trigger PR
iteration

it's just another place to start a PR iteration in the UI so that uses don't get
confused
@joseph-sentry joseph-sentry requested review from a team as code owners June 18, 2026 18:55
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 18, 2026
@joseph-sentry joseph-sentry marked this pull request as draft June 18, 2026 18:56
Comment thread static/app/components/events/autofix/v3/codeChangesCard.tsx Outdated
Comment thread static/app/components/events/autofix/v3/useResetAutofixStep.tsx Outdated
Comment thread static/app/components/events/autofix/v3/prIterationFeedbackForm.tsx
Comment thread static/app/components/events/autofix/v3/codeChangesCard.tsx Outdated
Comment on lines +287 to +291
}
}

return section;
}

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: A section's status is checked before merged file patches are added to its artifacts, which can cause code changes to not be displayed.
Severity: MEDIUM

Suggested Fix

Modify the status determination logic to account for the presence of merged_file_patches. This can be done by checking for merged patches before setting the section's status, ensuring that sections with patches are correctly marked as 'completed'.

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/components/events/autofix/useExplorerAutofix.tsx#L287-L291

Potential issue: In the `buildSection` function, a section's `status` is determined
before `merged_file_patches` are added to its `artifacts` array. If a `code_changes`
section only contains merged patches and does not meet other completion criteria (e.g.,
the run is still processing), its status will remain 'processing'. Consequently,
`getAutofixArtifactFromSection` will not retrieve the patches because it checks for
`status === 'completed'`, preventing the code changes from being displayed to the user.

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

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

✅ no issues found

@linear-code

linear-code Bot commented Jun 18, 2026

Copy link
Copy Markdown

CW-1397

@joseph-sentry joseph-sentry marked this pull request as ready for review June 19, 2026 16:15
Comment thread static/app/components/events/autofix/v3/useResetAutofixStep.tsx
artifacts.length > 0
) {
section.status = 'completed';
}

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.

Section completes during PR iteration

Medium Severity

While the run is still processing, buildSection can mark the folded code_changes section completed when earlier blocks already have inline artifacts or the last block looks like a finished assistant message. The code changes card then skips the processing/iterating UI during an active PR iteration.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 95a5368. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is wrong, but it's a code smell since this logic is spread across Sentry FE, BE and Seer

we should clean this up later

basically we're relying on the BE not setting the artifact for code changes blocks and we're setting the artifact AFTER this check in the FE code

Comment thread static/app/components/events/autofix/v3/codeChangesCard.tsx
if (bucket) {
bucket.blocks.push(block);
} else {
buckets.set(currentStep, {blocks: [block], index: i});

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.

Repeated steps merge incorrectly

Medium Severity

getOrderedAutofixSections buckets blocks by step name only, so if the same step appears again after later steps (e.g. re-running root cause or solution), those blocks are merged into one section. section.index stays the first occurrence, so reset/re-run calls can send the wrong insert_index, and cards can mix stale and new blocks.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b0c4d7c. Configure here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this can't be true. there won't be multiple root cause or solution blocks in an autofix session.

when a step is re-ran, the blocks that come after the resetted step will be wiped. for example, if we had [root_cause, solution] block, and we re-run root_cause, it becomes [root_cause], and doesn't append the new root_cause to the end of the list of steps

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

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 119b439. Configure here.

icon={<IconArrow size="md" direction="right" />}
busy={isSubmitting}
disabled={isPolling || !feedback.trim()}
onClick={handleSubmit}

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.

Duplicate PR iteration submits

Medium Severity

The Submit control sets busy from isSubmitting but stays enabled whenever feedback is non-empty and isPolling is false. A second click or Enter can invoke handleSubmit again before polling starts, issuing duplicate pr_iteration startStep requests.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 119b439. Configure here.

@alexsohn1126 alexsohn1126 Jun 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In useButtonFunctionality.tsx:27-33, the rendered button's onClick is the wrapper handleClick, which short-circuits before ever calling the user's onClick:

  // Don't allow clicks when disabled or busy
  if (props.disabled || props.busy) {
    e.preventDefault();
    e.stopPropagation();
    return;
  }

Comment on lines +62 to +63
{(autofix.runState?.status === 'completed' ||
isLastStepPrIteration(autofix.runState)) && (

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 PR iteration feedback form is incorrectly shown for runs with status === 'error' because isLastStepPrIteration doesn't check the run status before rendering the component.
Severity: MEDIUM

Suggested Fix

Modify the rendering condition in content.tsx to also check for a non-error status. For example, change it to autofix.runState?.status === 'completed' || (autofix.runState?.status !== 'error' && isLastStepPrIteration(autofix.runState)). Alternatively, update isLastStepPrIteration to include a status check.

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/components/events/autofix/v3/content.tsx#L62-L63

Potential issue: The rendering condition for `SeerDrawerNextStep` is
`autofix.runState?.status === 'completed' || isLastStepPrIteration(autofix.runState)`.
The `isLastStepPrIteration` function only checks if the last step was a `pr_iteration`,
without considering the overall run status. Consequently, if a run fails and its status
becomes `'error'`, but the last attempted step was a PR iteration, the condition
evaluates to true, causing the PR iteration feedback form to be displayed. This is
incorrect UX, as users should not be prompted for feedback on a failed process. The
`isPolling` guard does not prevent this, as an errored state is not considered a polling
state.

Also affects:

  • static/app/components/events/autofix/useExplorerAutofix.tsx:52~55

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it makes sense to let the PR iteration feedback form to be displayed after a failed PR iteration step imo

@alexsohn1126 alexsohn1126 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:shipit:

@joseph-sentry joseph-sentry merged commit 91ddc73 into master Jun 22, 2026
77 checks passed
@joseph-sentry joseph-sentry deleted the joey--autofix-pr-iteration-frontend branch June 22, 2026 16:58
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.

2 participants