Skip to content

fix(ci): rebase-and-retry auto-commit pushes to survive races#14

Merged
AbdullahBakir97 merged 1 commit intomainfrom
fix/auto-commit-rebase
Apr 27, 2026
Merged

fix(ci): rebase-and-retry auto-commit pushes to survive races#14
AbdullahBakir97 merged 1 commit intomainfrom
fix/auto-commit-rebase

Conversation

@AbdullahBakir97
Copy link
Copy Markdown
Owner

Summary

The morning health-check on main after commit 8217205 showed Build examples failing with ! [rejected] main -> main (fetch first) — classic push race against Refresh CONTEXT.md which fired off the same merge.

Fix: replace bare git push with a 3-attempt loop:

for attempt in 1 2 3; do
  if git pull --rebase origin main && git push; then exit 0; fi
  sleep 3
done
exit 1

Applied symmetrically to both build-examples.yml and refresh-context.yml. Both auto-commits are purely additive (CONTEXT.md and examples/rendered/ never touch each other), so rebase has no conflicts.

Test plan

  • Both workflow YAMLs parse cleanly via yaml.safe_load
  • CI green on push (preview)
  • Verify in production: next push to main should fire both workflows simultaneously and both should now succeed

Build-examples and refresh-context both fire on every push to main and
both push back. When two workflows race for the same ref, the loser hit
`! [rejected] main -> main (fetch first)` and the run failed.

Today's morning health-check surfaced exactly this on commit 8217205:
build-examples lost the race against refresh-context committing the
auto-marker refresh.

Fix: replace the bare `git push` with a 3-attempt loop that does
`git pull --rebase origin main && git push`, sleeping briefly between
attempts. Both auto-commits are pure additive (no conflicts possible),
so rebase is safe. Three attempts > the worst observed contention; if
all three fail something else is wrong and we want the run to error.

Applied symmetrically to both workflows.
@AbdullahBakir97 AbdullahBakir97 merged commit 14a0875 into main Apr 27, 2026
13 checks passed
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