Skip to content

fix(readme-refresh): retry rolling-branch push through the auto-merge race - #1261

Merged
don-petry merged 1 commit into
mainfrom
fix/readme-refresh-push-race
Jul 15, 2026
Merged

don-petry merged 1 commit into
mainfrom
fix/readme-refresh-push-race

Conversation

@don-petry

Copy link
Copy Markdown
Collaborator

Problem

The single rolling chore/readme-refresh branch is reused every run. When the previous refresh PR auto-merges mid-run, GitHub deletes/fast-forwards that branch, staling the --force-with-lease lease → the next push fails and (correctly, per the loud-failure hardening) reds the run. Observed live: run 29386746375 failed because PR #1246 merged at 03:43 as the run pushed at 03:42.

That's a benign race, not a real error — the immediate re-run on the clean branch succeeded.

Fix

Retry the push up to 3×, running git fetch --prune between attempts so --force-with-lease re-evaluates against current remote state:

  • branch deleted (prior PR merged + auto-delete) → stale ref pruned → push recreates it
  • branch fast-forwarded → ref updated → push overwrites

Only a persistent failure (e.g. genuinely lost write access) fails the run — so real problems still go red loudly.

Validation: bash -n + shellcheck clean. Behavioral fix; end-to-end coverage is the weekly job surviving the next auto-merge overlap.

🤖 Generated with Claude Code

… race

The single rolling `chore/readme-refresh` branch is reused every run, and the
prior refresh PR often auto-merges mid-run — deleting or fast-forwarding the
branch and staling the --force-with-lease lease, so the next push fails and
(correctly) reds the run. That's a benign race, not a real error.

Retry the push up to 3×, running `git fetch --prune` between attempts so the
lease re-evaluates against current remote state (branch deleted → recreate;
branch moved → overwrite). Only a persistent failure (e.g. lost write access)
fails the run, preserving the loud-failure behavior for genuine problems.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@don-petry
don-petry requested a review from a team as a code owner July 15, 2026 04:01
@don-petry don-petry added the readme-refresh Automated README refresh label Jul 15, 2026
Copilot AI review requested due to automatic review settings July 15, 2026 04:01
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@don-petry, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 64f9c539-bb8e-481f-b5e8-ddf3b7a11cdd

📥 Commits

Reviewing files that changed from the base of the PR and between f6886ad and 0620386.

📒 Files selected for processing (1)
  • scripts/aw-readme-refresh.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/readme-refresh-push-race

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry enabled auto-merge (squash) July 15, 2026 04:01
@don-petry
don-petry disabled auto-merge July 15, 2026 04:02
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
**Summary:**
**Bot:** SonarCloud  
**Issues addressed:** 0  
**Findings:**
- Quality Gate: Passed ✓
- 0 New issues
- 0 Security Hotspots
- No open review threads
**Action:** No fixes required. The PR passes all quality gates with zero new issues and zero security hotspots. All completed CI checks are successful, and there are no open threads from the bot to resolve.

@don-petry
don-petry enabled auto-merge (squash) July 15, 2026 04:02
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-07-15T05:03:22Z.

Copilot AI 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.

Pull request overview

This PR hardens the readme-refresh automation against a benign race where the rolling chore/readme-refresh branch can be deleted or fast-forwarded mid-run (due to auto-merge of the prior refresh PR), causing git push --force-with-lease to fail.

Changes:

  • Add a bounded retry loop (3 attempts) around the rolling-branch git push --force-with-lease.
  • Between retries, run git fetch --prune to re-sync the remote-tracking ref so the lease can re-evaluate against current remote state.

Comment on lines +386 to 398
local push_ok=0 attempt
for attempt in 1 2 3; do
if git -C "$dir" push --force-with-lease --quiet origin "$BRANCH" 2>/dev/null; then
push_ok=1; break
fi
warn "$full_repo: push to $BRANCH failed (attempt $attempt/3) — re-syncing remote ref and retrying"
git -C "$dir" fetch --prune --quiet origin 2>/dev/null || true
sleep 3
done
if [ "$push_ok" -ne 1 ]; then
echo "::error::readme-refresh: $full_repo: git push to $BRANCH failed after 3 attempts — READMEs NOT updated (check GH_TOKEN write access / branch state)" >&2
return 1
fi
Comment on lines +386 to +390
local push_ok=0 attempt
for attempt in 1 2 3; do
if git -C "$dir" push --force-with-lease --quiet origin "$BRANCH" 2>/dev/null; then
push_ok=1; break
fi
@don-petry
don-petry merged commit fd3ca10 into main Jul 15, 2026
39 of 40 checks passed
@don-petry
don-petry deleted the fix/readme-refresh-push-race branch July 15, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readme-refresh Automated README refresh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants