fix(ci): resolve modify/delete conflicts in sync conflict PRs

Merged
RI
3mo ago
+45-5

What

  • Fix Create PR for conflicts in sync-branches.yml when upstream sync hits modify/delete conflicts (e.g. .github/workflows/ci.yml deleted on plus, modified upstream).
  • Refetch upstream objects before merge to reduce promisor lazy-fetch errors during merge.

Why

Run 32394290222 shows PR #109 fixed the promisor crash and correctly detected merge conflicts, but the job still failed at Create PR for conflicts:

  • git merge upstream/main -X theirs auto-resolved content conflicts
  • modify/delete on .github/workflows/ci.yml stayed unmerged
  • Step exited 1 → no conflict PR created

How

  • Added merge_upstream_preferred() in .github/scripts/sync-gh-helpers.sh: runs -X theirs, then for remaining unmerged paths runs git checkout --theirs + git add (covers modify/delete), then commits.
  • Both sync-main-branch and sync-plus-branch conflict PR steps use the helper.
  • Added git fetch --refetch --no-filter upstream main after initial upstream fetch.
  • Conflict PR branches now checkout from origin/plus / origin/main.

Testing

  • Reproduced failure signature from run 32394290222 logs.
  • Locally simulated partial clone + upstream merge; helper completes merge when only modify/delete conflict remains on ci.yml.

Not Tested

  • Full GitHub Actions re-run after merge (please re-run Sync Branches from Upstream → plus).

Notes

  • Open sync PRs #81 and #82 left untouched.
  • Conflict PR may re-introduce upstream .github/workflows/ci.yml; review before merging sync PR.
Open in Web Open in Cursor 

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Improved automated branch synchronization by preferring upstream changes during merges.
    • Added handling for unresolved conflicts, including selecting or removing upstream files where appropriate.
    • Ensured failed conflict resolution restores the affected branch to a clean state.
  • Maintenance
    • Improved upstream refetching to ensure complete branch data is available during synchronization.