Skip to content

fix: adopt --remote uses stale parent when parent PR is merged/closed#691

Open
simsinght wants to merge 1 commit intofix/adopt-remote-batch-orderingfrom
fix/adopt-remote-merged-parent-resolution
Open

fix: adopt --remote uses stale parent when parent PR is merged/closed#691
simsinght wants to merge 1 commit intofix/adopt-remote-batch-orderingfrom
fix/adopt-remote-merged-parent-resolution

Conversation

@simsinght
Copy link
Copy Markdown
Contributor

Stacked on #679

Summary

  • Pre-existing bug: when adopt --remote encountered a merged/closed parent PR, it walked up the chain to find the nearest open ancestor — but AdoptingBranch was constructed before this walk, so it kept the stale parent
  • Fix: move AdoptingBranch construction to after the parent resolution loop

When a parent PR was merged or closed, initAdoption walked up the
chain to find the nearest open ancestor. However, the AdoptingBranch
was constructed before this walk, so it kept the original (closed)
parent instead of the resolved one.

Move AdoptingBranch construction to after the parent resolution loop.
@simsinght simsinght requested a review from a team as a code owner April 3, 2026 02:08
@aviator-app
Copy link
Copy Markdown
Contributor

aviator-app bot commented Apr 3, 2026

🔃 FlexReview Status

Common Owner: aviator-co/engineering (expert-load-balance assignment)
Owner and Assignment:

  • 🔒 aviator-co/engineering (expert-load-balance assignment)
    Owned Files
    • 🔒 cmd/av/adopt.go

Review SLO: 7 business hours if PR size is <= 200 LOC for the first response.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the branch adoption logic in cmd/av/adopt.go by moving the instantiation of the AdoptingBranch struct to occur after the loop that resolves the parent branch. This ensures that the branch metadata correctly reflects the updated parent if the original parent was merged or closed. I have no feedback to provide.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant