Skip to content

fix(ci): a push in its gate holds a remote marker, so the auto-sync leaves the branch alone (#20260) - #20570

Closed
mrveiss wants to merge 9 commits into
mainfrom
issue-20260-push-marker
Closed

mrveiss wants to merge 9 commits into
mainfrom
issue-20260-push-marker

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

The sync bot merges main into open PR branches. A push waiting in the pre-push hook, up to 20 minutes under load, can lose to it and fail at the very end with cannot lock ref, so the whole gate runs again. The bot runs on GitHub and cannot see a local hook. The maintainer chose a remote marker with a TTL equal to the hook's limit.

What Changed

  • The hook creates refs/push-gate/<branch>/<expiry> through the API when it starts on a branch, and removes it on exit. It uses the API because a git push of the marker would re-enter this hook. A dead hook's marker is removed on that branch's next push and is ignored after expiry anyway.
  • The expiry is twice MAX_BUDGET, the fast gate's two bounded stages.
  • A stage that queued for a machine slot (decision(ci): how to limit local test and gate load by machine #20518) renews the marker after the wait, since the queue has no time limit. This branch includes decision(ci): how to limit local test and gate load by machine #20518, which lands first.
  • The bot reads live markers just before each merge, not once at planning, since a run can last minutes, and skips those branches. They sync on the next run.
  • If a marker cannot be written the hook warns and continues, so the push is as racy as before and never blocked. AUTOBOT_PUSH_MARKER=0 turns it off.

Verification

repo_tests/push_marker_20260_test.py passes: marker parsing and expiry, the bot's skip with a contrast case, and the hook's real functions in bash against a fake gh. Against the real API I created, listed through ls-remote, and deleted one marker on refs/push-gate/.

Limits:

  • A small window remains: the marker goes when the hook exits, just before git sends the push, and a bot merge already past its check can still win. Seconds, not the length of the gate.
  • A full-mode gate (AUTOBOT_PREPUSH_FULL=1) can run longer than the expiry.
  • A marker for a branch that is deleted and never pushed again stays as an ignored ref.
  • Each push makes up to 3 more network calls. Not yet measured on a real push race, and a real hook run happens for the first time on this PR's own push once it is installed.

Refs #20260

Model Used

Claude Opus 5.5

@mrveiss mrveiss added the phase:M1.7 Docker docs and the docs close-out label Nov 1, 2026
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between fd4c2df and 9dab695.

Files selected for processing: 4
  • pipeline-scripts/branch_sync.py
  • pipeline-scripts/branch_sync_core.py
  • repo_tests/push_marker_20260_test.py
  • tools/git-hooks/pre-push
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20570 (head ed29472): approve, with Refs #20260 rather than Closes.

Read only; nothing was run. A marker failure can't block a push, an expired or stale marker is ignored, and refs/push-gate/ stays outside the branch sweeps and workflow triggers checked. Open:

  • Medium, tools/git-hooks/pre-push:271: the marker lasts a fixed 1200 s and is never renewed. Gates exceeded that under this week's load, and then the original bug returns. Whichever of this and decision(ci): how to limit local test and gate load by machine #20518 lands second must renew after the wait. That's AC1's gap, with no real race measured, hence Refs.
  • Low, pre-push:619: the marker uses local_ref, so pushing local:other names the wrong branch.
  • Low, branch_sync.py being_pushed(): an ls-remote failure reads as no marker, the old behaviour.
    The trap wiring, stale-marker cleanup and real ls-remote glob aren't exercised by tests.

This was referenced Nov 1, 2026
@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20570 (head c199b2f): approve, to land after #20592, which it contains.

Read only; I didn't run the tests. A queued push renews its marker after the wait, tested against a really held slot, and Refs #20260 matches what's delivered. A gate still running past 1200 s after the wait can outlive the marker; that's a smaller window than before.

@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Landed in the merge train (PR #20692) as 58cbf98: frozen head 6628eb1 is an ancestor of that merge. This PR's later head 9dab695 only merged main, with 0 non-merge commits since.

@mrveiss mrveiss closed this Nov 2, 2026
@mrveiss
mrveiss deleted the issue-20260-push-marker branch November 2, 2026 20:10
timothybrush pushed a commit to timothybrush/AutoBot-AI that referenced this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

phase:M1.7 Docker docs and the docs close-out

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant