fix(autofix): Reset sections on re-run#110644
Merged
Conversation
When the same step is re-run, the contents from the previous run should be discarded to make for a cleaner loading state.
| finalizeSection(); | ||
| } | ||
|
|
||
| section = { |
Contributor
There was a problem hiding this comment.
Bug: The mergedByFile map is not cleared when a step re-runs, causing artifacts from previous runs to be incorrectly included in the output.
Severity: MEDIUM
Suggested Fix
When a step re-run is detected within the getOrderedAutofixSections function, clear the mergedByFile map. This should happen inside the if (metadata.step === section.step) block to ensure each step execution starts with a clean state.
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#L379
Potential issue: In the `getOrderedAutofixSections` function, the `mergedByFile` map
accumulates file patches. When a step like `code_changes` is re-run, the logic is
intended to discard the previous run's results. However, while the current `section` is
reset, the `mergedByFile` map is not cleared. This causes file patches from the previous
run to be carried over. If the re-run generates new patches, the final artifacts will
incorrectly contain both the old and new patches, rather than just the results from the
most recent run.
Did we get this right? 👍 / 👎 to inform future reviews.
shruthilayaj
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the same step is re-run, the contents from the previous run should be discarded to make for a cleaner loading state.