Skip to content

fix(action-log): invalidate root cause when a Seer fix PR is closed - #121017

Draft
cvxluo wants to merge 1 commit into
masterfrom
cvxluo/invalidate-root-cause-when-a-seer-fix-pr-closes-un
Draft

fix(action-log): invalidate root cause when a Seer fix PR is closed#121017
cvxluo wants to merge 1 commit into
masterfrom
cvxluo/invalidate-root-cause-when-a-seer-fix-pr-closes-un

Conversation

@cvxluo

@cvxluo cvxluo commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

No description provided.

…unmerged

Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 31, 2026
Comment on lines +156 to +168
# than PullRequest ids, so a closed PR can't be traced back to a Seer run.
seer_opened_a_pr = state[LAST_COMPLETED_AUTOFIX_STEP] in (
IssueAutofixStep.PR_CREATED,
IssueAutofixStep.PR_ITERATION,
)

match entry.action:
case RootCauseIdentifiedAction() | SeerRCACompletedAction() if not current:
return emit(HAS_ROOT_CAUSE.value(True))
case SetRegressedAction() if current:
return emit(HAS_ROOT_CAUSE.value(False))
case PullRequestClosedAction(has_other_open_prs=False) if current and seer_opened_a_pr:
return emit(HAS_ROOT_CAUSE.value(False))

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.

Root cause cleared for non-Seer PR closures after Seer workflow completed

LAST_COMPLETED_AUTOFIX_STEP tracks the furthest Seer step ever reached and never resets, so once Seer creates a PR the seer_opened_a_pr guard stay True forever. Any later PullRequestClosedAction(has_other_open_prs=False) — even for an unrelated user PR — will clear the root cause.

Evidence
  • track_last_completed_autofix_step only advances LAST_COMPLETED_AUTOFIX_STEP; once it reaches PR_CREATED or PR_ITERATION it stays there permanently (lines 249-267).
  • track_root_cause reads that same feature to decide whether Seer ever created a PR: state[LAST_COMPLETED_AUTOFIX_STEP] in (IssueAutofixStep.PR_CREATED, IssueAutofixStep.PR_ITERATION) (line 157).
  • When a PullRequestClosedAction(has_other_open_prs=False) arrives and current is True, root cause is unconditionally cleared if that guard is True (lines 167-168).
  • Example trigger: Seer PR is merged (issue resolves) → issue is reopened → user creates an unrelated PR and closes it (no other open PRs) → root cause is incorrectly cleared, even though the Seer diagnosis was correct.
  • The code comment acknowledges the per-issue limitation but the permanent nature of LAST_COMPLETED_AUTOFIX_STEP makes the heuristic over-clear root cause for any future PR closure.

Identified by Warden · sentry-backend-bugs · HHH-TJ5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant