Skip to content

fix(ci): sweep must retry, mergeStateStatus is computed lazily - #153

Merged
cmarko89 merged 1 commit into
mainfrom
fix-sweep-lazy-mergestate-20260906
Sep 6, 2026
Merged

cmarko89 merged 1 commit into
mainfrom
fix-sweep-lazy-mergestate-20260906

Conversation

@cmarko89

@cmarko89 cmarko89 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

The sweep added in #151 was a no-op. Caught by dispatching it rather than assuming it worked.

The defect

To avoid burning runner minutes I gave the sweep a single query per PR (attempts = isSweep ? 1 : 6). But GitHub computes mergeStateStatus lazily: the first query for a PR it has not looked at recently returns UNKNOWN and only then kicks off the computation. So every cold PR read UNKNOWN and was skipped.

The first live sweep (run 34006340085) proves it, skipping all 7 open PRs:

sweep: 7 open PR(s)
#148: mergeStateStatus=UNKNOWN, leaving for the next sweep
#139: mergeStateStatus=UNKNOWN, leaving for the next sweep
... all 7

Note #139 and #135-#138 are genuinely CLEAN right now, so they should have been enqueued.

Fix

Warm every candidate in one parallel pass, wait once, then read the settled values, and retry on UNKNOWN instead of giving up after a single attempt. That is O(2N) queries rather than O(6N) sleeps, so the runner-minute concern is still addressed without breaking the mechanism.

Note

This did not make things worse than before #151, and the deploy-critical path still converged (each sweep warms the cache for the next one, so it would have worked on the second pass 15 minutes later). But it was fragile and effectively halved the cadence, which is not what the fix claims to do.

The sweep added in #151 was a no-op. It used a single query per PR to avoid
burning runner minutes, but GitHub computes mergeStateStatus lazily: the first
query for a PR it has not looked at recently returns UNKNOWN and only then
starts the computation. Every cold PR therefore read UNKNOWN and was skipped.

The first live sweep confirmed it, skipping all 7 open PRs with
'mergeStateStatus=UNKNOWN, leaving for the next sweep'.

Warms every candidate in one parallel pass, then reads the settled values, and
retries on UNKNOWN rather than giving up after one attempt.
@cmarko89
cmarko89 added this pull request to the merge queue Sep 6, 2026
Merged via the queue into main with commit f29be64 Sep 6, 2026
3 checks passed
@cmarko89
cmarko89 deleted the fix-sweep-lazy-mergestate-20260906 branch September 6, 2026 02:38
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