Repository navigation
[3447 by Claude Opus 5.5] Update a behind branch and wait for fresh CI before auto-merging - #3450
Conversation
…only after CI passes on the updated head. It's off unless a repository sets `auto_merge.require_up_to_date: true`. `npm run test:prepare`, the typechecks, zero-warning eslint (root `src/`, `packages/core`, `packages/cli`) and 8 related test files via `node scripts/run-test-suite.mjs` all pass. Nothing has run against real GitHub; all the tests use mocked GitHub and Redis. Config (`autoMergePolicy.ts`) - New keys: `require_up_to_date` (boolean, default false) and `max_branch_updates_per_hour` (whole number 1–30, default 3). They go through the validator, the editor JSON schema (with parity test cases added), the `propr init` scaffold, the docs and the CHANGELOG. - New decision reasons: `updated_branch` and `waiting_for_ci_updated_head`, plus waiting reasons for a pending update, another PR going first, the hourly limit, a conflict, another update failure, and a failed base comparison. Merge path (`checkRunHandler.ts` and a new `webhook/autoMergeUpToDate.ts`) - The mergeability gate now also lets a `behind` PR through, but only so its branch can be updated; a head GitHub reports as behind is never merged. - After the policy allows the merge, ProPR compares the head with the latest base commit: - Up to date: it merges as before. - Behind: it calls GitHub's update-branch API with the evaluated head SHA instead of merging. - When the updated head merges: a later green check or a sweep re-evaluates the new head. It merges only once its own CI passes and it contains the base. - One PR at a time: per repository, the oldest eligible PR (lowest number) holds the update turn. It gives the turn up when it merges, closes, fails CI on the updated head, reaches its hourly limit, or after an hour with no progress. A PR that has hit its limit can't hold up younger ones. - Conflicts: if the update fails because of conflicts, ProPR queues the existing opt-in conflict resolution (new `auto_merge` trigger). If that isn't enabled, it posts one comment explaining why auto-merge is waiting. - Recording: every decision goes through `recordAutoMergeDecisionEvent`, which now accepts `branch_updated` and `waiting` actions. A repeated decision for the same head and base is recorded and commented only once, so the 60-second sweep doesn't flood the timeline. Option off - A behind PR is still skipped and a clean PR still merges, both without any base comparison; tests check this. - One difference: a behind PR now gets as far as the active-work check and the policy read before being skipped, which costs a few more GitHub reads per evaluation. I did this because the option lives in the policy file. Tests - New `packages/core/test/autoMergeUpToDate.test.ts` (11 tests) covers up-to-date, behind, waiting for an update that hasn't landed, waiting for CI, the one-at-a-time rule, recording once, rate limiting, failed CI ending the turn, conflicts with and without auto-resolve, a head that moved, a failed base comparison and other update failures. - `test/checkRunHandler.test.ts` gets 6 end-to-end cases, including option off. I also added `recordAutoMergeDecisionEvent` to its mock of the gate module, because the new module imports it. - I didn't add a sweep test: the sweep code is unchanged and just re-evaluates through the same path. There are no visual changes, so I made no preview files.
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR adds opt-in branch updates, CI re-evaluation, throttling, and decision reporting, but needs changes before merge: native auto-merge can bypass the option, and concurrent direct merges remain uncoordinated. ✅ Configuration parity — Validation, schema, scaffold, documentation, and parser tests consistently support both new options. ✅ Head-pinned updates — Update requests include ✅ Failure coverage — Tests cover update rejection, conflicts, rate limits, and failed-CI turn release. The supplied current-head checks report 38 passed and no failures or pending checks. The linked issue specification is explicitly truncated; this review relies on its visible requirements and the supplied code. No commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Native auto-merge bypasses the policy
F2: 🔴 Current heads bypass repository serialization
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Exercise stalled CI expiryThe pending-CI path refreshes the turn every time it is observed, whereas the documentation describes expiry after an hour without progress. A clock-controlled test with recurring sweep observations would clarify the intended behavior for a permanently pending check. This is an optional operational follow-up rather than an additional blocker under the visible acceptance criteria. ScoreThe configuration and sequential update paths are well covered, and current checks are green. Two gaps in enforcement prevent the advertised merge safety from holding across the supported paths. Score: 5/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit ecde9b6
Summary of ChangesI fixed both findings. GitHub's own auto-merge is no longer turned on when F1: GitHub's auto-merge bypassed the option
F2: two current PRs could merge together
New tests
I also updated the docs ( Limits of the fix (not changed):
No visual changes, so there are no previews. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
… turned on when `require_up_to_date` is set (F1). ProPR's base comparison and merge now run one at a time per repository, including for PRs that are already up to date (F2). The 11 related test files pass. Typecheck is clean for root and `packages/core`, `eslint --max-warnings 0` is clean on `packages/core` and the two changed root files, and core was rebuilt. Nothing has run against real GitHub; the tests mock GitHub and Redis. I fixed both findings. GitHub's own auto-merge is no longer turned on when `require_up_to_date` is set (F1). ProPR's base comparison and merge now run one at a time per repository, including for PRs that are already up to date (F2). The 11 related test files pass. Typecheck is clean for root and `packages/core`, `eslint --max-warnings 0` is clean on `packages/core` and the two changed root files, and core was rebuilt. Nothing has run against real GitHub; the tests mock GitHub and Redis. **F1: GitHub's auto-merge bypassed the option** - **Arming:** when the option is on, `gateAutoMergeArming` still allows the merge but returns a new `directMergeOnly: true` and no merge method. Both places that turned on GitHub's auto-merge now check for it: - `issueJobPostProcessingHelpers.ts`: it doesn't turn it on and leaves the merge to check events and the sweep. - `ultrafixLoopGithub.ts`: it doesn't turn it on and goes straight to ProPR's own merge path, since CI has usually finished by then. - **Requests already on a PR:** a new `withdrawNativeAutoMergeForUpToDate` turns off a GitHub auto-merge request that ProPR itself set up. It re-reads ownership just before turning it off, records an event and posts one comment. It runs in three places: - at arming time. - when the PR gets new commits or a new base (`reevaluateArmedAutoMergeOnNewHead`). - in the check-run and sweep merge path, which catches a repository that enables the option after a PR was already armed. - **Requests set up by a person or another App** are left alone. **F2: two current PRs could merge together** - A new `mergeWhenUpToDate` in `autoMergeUpToDate.ts` takes a per-repository Redis lock before comparing the PR with its base and holds it until the merge attempt finishes, even if the merge throws. - A second PR that finds the lock taken records a "serialized" waiting decision and doesn't compare. Its next check event or sweep compares it against the base the first merge produced, so it gets its branch updated instead of merged. - Only ProPR's own lock is released, and an abandoned lock expires after 5 minutes. With the option off, the merge path behaves as before and takes no lock. **New tests** - New file `packages/core/test/autoMergeGateUpToDate.test.ts`: no merge method under the option; ProPR's request withdrawn at arming time and on new commits; requests from others kept, including one taken over by a maintainer during evaluation. - In `autoMergeUpToDate.test.ts`: the reported overlap reproduced (PR 8 checked while PR 7's comparison is still waiting on GitHub), plus a test that a failed merge releases the lock and that a PR never releases another's lock. - In `checkRunHandler.test.ts`: the merge runs while holding the lock; a PR waits without comparing when another holds it; withdrawal happens on the check-merge path. - The two caller test files check that GitHub's auto-merge isn't turned on. I also updated the docs (`repository-workflow.md`) and the CHANGELOG entry. **Limits of the fix (not changed):** - A GitHub auto-merge request set up by a person or another App can still merge a PR that is behind. That follows the finding's "preserve independently owned requests". - If GitHub's auto-merge fires before ProPR next looks at an already-armed PR, ProPR can't stop it. That's a race with GitHub, so I didn't try to make it atomic. - Merges that don't go through ProPR's auto-merge path, such as a person merging by hand or the MCP merge tool, don't take the lock. - The lock release is a read followed by a delete, not one atomic step. It only matters if the 5-minute expiry passes at exactly that moment. - At arming time the timeline still says "Auto-merge armed" under the option, even though GitHub's auto-merge isn't turned on; the withdrawal events carry an explanatory detail. No visual changes, so there are no previews. PR: #3450 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds branch updates, per-repository serialization, and policy-controlled direct merging, but needs changes before merge. ✅ Configuration parity — The validator, schema, scaffold, documentation, and policy tests consistently expose both new options. ✅ Head-pinned updates — Branch updates pass The linked issue excerpt is truncated; this review assesses the visible requirements and supplied code. Current checks show 12 pending, 0 failed, 0 passed, and 9 neutral/skipped. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F3: 🔴 Withdraw native auto-merge before CI gating
F4: 🔴 Stop renewing turns without progress
SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Exercise merge ownership expiryThe fake Redis explicitly does not simulate TTLs. Add coverage for ownership expiry during comparison and takeover before the merge callback, including atomic owner-checked release. This would strengthen confidence in the serialization guarantee; the supplied context does not establish a production timing sequence sufficient to classify this separately as a blocker. ScoreThe configuration and normal-path coverage are strong, but native auto-merge can bypass the new policy and stalled CI can indefinitely block branch updates. Current CI remains pending. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit ad02a4f
Summary of ChangesI fixed F3 and F4. The new tests fail on the old code and pass with the fixes. Nothing has run against real GitHub; the tests mock GitHub and Redis. F3: native auto-merge is now withdrawn before ProPR's own gates can return early
F4: waiting for CI no longer keeps a PR's update turn alive
New tests
Checks run
There is no visual change, so I made no preview. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ass with the fixes. Nothing has run against real GitHub; the tests mock GitHub and Redis. I fixed F3 and F4. The new tests fail on the old code and pass with the fixes. Nothing has run against real GitHub; the tests mock GitHub and Redis. **F3: native auto-merge is now withdrawn before ProPR's own gates can return early** - When GitHub reports native auto-merge as armed on an open, non-draft PR, `processPRAutoMerge` (`packages/core/src/webhook/checkRunHandler.ts`) now runs a new helper before the label/Ultrafix, head-match, CI and mergeability checks and the active-work check. - The helper, `withdrawNativeAutoMergeIfUpToDateRequired` (`packages/core/src/services/autoMergeGate.ts`), checks the base branch's policy. If the merge is allowed only with `require_up_to_date`, it withdraws the native request. As before, only a request ProPR armed is withdrawn; ownership is re-read just before withdrawing, and the helper never throws. - So a sweep that sees pending CI now withdraws the native request instead of returning and leaving it armed. Branch updates and direct merges still sit behind every existing gate. - To avoid checking the policy on every sweep, `PRAutoMergeInfo` now has an `autoMergeArmed` flag, read from the PR data ProPR already fetches. The policy is only checked when that flag is set. - The later withdrawal after the policy check is kept, for a request armed between the two reads. - One race can't be avoided: CI finishing while the withdrawal request is in flight. **F4: waiting for CI no longer keeps a PR's update turn alive** - In `packages/core/src/webhook/autoMergeUpToDate.ts`, `noteCiWaitAfterBranchUpdate` and the "already holds the turn" branch of `claimTurn` no longer extend the turn's expiry. - Only a successful branch update by the PR holding the turn extends it, and only if that PR still holds it. A turn that already expired, and may have passed to another PR, is not taken back. - A PR whose updated head stays pending therefore loses the turn an hour after its last update, and the next eligible PR can be updated. This now matches the documented "an hour passes without progress". **New tests** - `packages/core/test/autoMergeUpToDate.test.ts`: the fake Redis can now expire keys against the test clock (only the new tests turn this on). One test simulates a minute-by-minute sweep: PR 10 waits while PR 5's head is pending and gets updated once the hour is up. Another checks that a second branch update by the holder extends its turn by an hour. - `packages/core/test/autoMergeGateUpToDate.test.ts`: the new helper withdraws a request ProPR armed under `require_up_to_date`. It leaves alone a policy without the option, a request a maintainer armed, and a PR the policy won't merge. - `test/checkRunHandler.test.ts`: pending CI and a non-clean mergeable state each still withdraw the native request, with no branch update or merge. Nothing is withdrawn without the option, and the policy isn't checked when no request is armed. The module mock now includes the new export. **Checks run** - The two core test files pass (22/22). - The four root files pass via `scripts/run-test-suite.mjs` (`checkRunHandler`, `taskIntentWithdrawal`, `ultrafixAutoMergeFallback`, `submissionPrUltrafix`). - `tsc --noEmit` is clean for root and `packages/core`. Zero-warning eslint is clean on the four changed core source files; I tightened one import to keep `checkRunHandler.ts` under the 400-line limit. - Core was rebuilt. There is no visual change, so I made no preview. PR: #3450 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR implements branch updates, fresh-head reevaluation, rate limits, and repository-level serialization. It needs changes before merge because waiting candidates can lose their retry path, and merge ownership can expire without stopping its holder. ✅ Configuration parity — Runtime validation, editor schema, scaffold, and documentation consistently expose both new options. ✅ Head-pinned updates — Branch updates pass ✅ Focused coverage — Added tests exercise rate limits, native auto-merge withdrawal, conflict responses, and overlapping merge attempts. The supplied issue excerpt is truncated; this review relies on its visible requirements and the complete supplied diff. Current checks show 36 passed, one pending, and no failures. No commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F5: 🔴 Waiting candidates can lose all retries
F6: 🔴 Expired ownership still permits merging
SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Clarify decision deduplication scope
ScoreThe configuration and normal-path tests are thorough, but retry coverage and ownership lifetime leave correctness gaps in the new queue behavior. The remaining pending check is not itself a blocker. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit d789c32
Summary of ChangesI fixed F5 and F6. The new tests fail on the old code and pass with the fixes. Nothing has run against real GitHub or Redis; the tests mock both. F5 — deferred PRs could lose all retries. Every time
F6 — expired ownership still let a PR merge.
Tests and checks:
I also updated the docs page 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ass with the fixes. Nothing has run against real GitHub or Redis; the tests mock both.
I fixed F5 and F6. The new tests fail on the old code and pass with the fixes. Nothing has run against real GitHub or Redis; the tests mock both.
**F5 — deferred PRs could lose all retries.** Every time `require_up_to_date` makes a PR wait, ProPR now records it for retry in Redis. That covers waiting for another PR's turn or merge, a pending or just-made branch update, the rate limit, an unavailable base comparison, a failed update, and a head that moved. The new code is in `packages/core/src/webhook/autoMergeUpToDateRetry.ts`.
- The auto-merge sweep (`src/daemon/autoMergeSweep.ts`) now re-checks these PRs as well as plan PRs, about once a minute, through the same guarded merge path. PR B from the finding gets re-checked even if it has no plan row and gets no further webhook.
- A PR leaves the retry list only after a successful re-check that didn't make it wait again. If the re-check throws, the PR stays on the list. An entry that hasn't been refreshed for 24 hours is dropped.
- Merge conflicts are not retried: nothing can change until someone pushes, and that push brings its own CI events.
**F6 — expired ownership still let a PR merge.**
- **Atomic renew and release:** both now run as Redis scripts that check the owner's token, so a PR can't renew or release another PR's ownership.
- **Renewal while working:** the owner renews its ownership every 100 seconds (a third of the five-minute expiry) while the comparison and merge run.
- **Check just before merging:** ProPR checks ownership once after the comparison and again in `performMergeAndPostActions` immediately before `mergePR`. That puts the check after every await on the way to the merge, including `resolveDirectMergeMethod`. If the Redis call fails, ProPR assumes ownership is lost and doesn't merge.
- **A PR that lost ownership:** it doesn't merge. ProPR records a waiting decision ("the merge ownership expired before the merge; comparing again with the latest base") and adds the PR to the retry list. The retry takes ownership again and compares against the new base.
- **Unavoidable race:** a short gap remains between the last ownership check and GitHub actually processing the merge request; Redis and GitHub can't be locked together. Because the check resets the expiry to five minutes, the ownership would only lapse if the process stalled for longer than that between the Redis reply and GitHub receiving the request.
**Tests and checks:**
- **F5 regression:** a PR that isn't in a plan is made to wait on its last check event; after the holder finishes, the retry updates and then merges it with no new webhook.
- **F6 regression:** PR A's ownership expires after its comparison, PR B merges, and when A resumes it doesn't merge; its retry updates the branch instead.
- **Other new tests:** live renewal, a PR that found the ownership taken, conflicts left out of the retry list with 24-hour cleanup, de-duplication and settling in the sweep, and a check-run test where ownership is lost while resolving the merge method.
- **Results:** typecheck is clean for root and `packages/core`. Zero-warning eslint is clean on the changed files, after I moved the retry code into its own module and trimmed `checkRunHandler.ts` to fit the 400-line limit. I rebuilt core. Seven related test files pass: 74 tests in core, and 2 + 135 + 4 + 7 at the root.
I also updated the docs page `docs/docs/features/repository-workflow.md` and the CHANGELOG to describe the retry and ownership behaviour. I found no other problems outside F5 and F6.
PR: #3450
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds opt-in branch updates, serialized merge attempts, and deferred retries. It needs a localized correctness fix before merging: the sweep can discard a retry obligation without resolving it. ✅ Configuration parity — Validation, editor schema, scaffold, and documentation consistently expose both new options. ✅ Guarded merge execution — Updates use the evaluated head SHA; merge ownership is renewed and checked immediately before merging. ✅ Focused coverage — Added tests cover serialization, rate limits, ownership takeover, and native auto-merge withdrawal. Current checks report 38 passed and no failures or pending checks. The supplied issue specification is explicitly truncated; this review assesses its visible requirements and the changed implementation. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F7: 🔴 Preserve retries across inconclusive evaluations
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe implementation has substantial focused coverage and passing current checks, but premature retry settlement undermines the recovery behavior central to this change. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 5af870b
Summary of ChangesI fixed F7. A PR that's waiting in the retry list is now only removed once an evaluation actually settles it. If an evaluation can't decide, the PR stays on the list and the next sweep tries it again. What changed
Tests
Checks: typecheck is clean for root and Not changed: a PR held back by a merge-blocking state such as There are no previews because nothing visible changed. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ly removed once an evaluation actually settles it. If an evaluation can't decide, the PR stays on the list and the next sweep tries it again. I fixed F7. A PR that's waiting in the retry list is now only removed once an evaluation actually settles it. If an evaluation can't decide, the PR stays on the list and the next sweep tries it again. **What changed** - `reevaluatePRAutoMerge` and `processPRAutoMerge` now return `'resolved'` or `'inconclusive'` instead of nothing. The sweep (`src/daemon/autoMergeSweep.ts`) removes a waiting PR only on `'resolved'`. Thrown errors still keep it, as before. - The sorting rules live in a new file, `packages/core/src/webhook/autoMergeEvaluation.ts`, because `checkRunHandler.ts` was already at the 400-line lint limit. - **Resolved:** the PR merged, closed, is a draft, has no label, has a failed Ultrafix run, has failing or still-running checks (those produce their own check event), or the policy turned it down on purpose. - **Inconclusive:** CI couldn't be read; CI hasn't registered yet (this includes a repository with no CI that is still in its grace period); GitHub hasn't worked out mergeability yet; the PR or its head couldn't be read; the head moved; other work or Ultrafix is still running on the PR; the policy file or diff couldn't be read; or the merge was skipped, refused, failed or put off. - **Same bug in two shared helpers:** both treated a failed read as a real answer, which would also have dropped a PR from the list. `getPRAutoMergeInfo` now marks a failed PR read as `unavailable`. The new `readLinkedIssueAutoMergeLabel` returns `null` when the linked issue can't be read, so "no label" and "couldn't read the label" are no longer the same. `linkedIssueHasAutoMergeLabel` and `shouldAutoMergePR` still return the same booleans as before. - `performMergeAndPostActions` now reports whether the merge happened, so only a real merge counts as resolved. - The `require_up_to_date` docs page now explains when a PR stays on the retry list and that it's dropped after a day without being added again. **Tests** - `test/checkRunHandler.test.ts` gets the regression the finding asked for. A green PR that isn't part of a plan is put on the retry list because another PR holds the merge lock. The first sweep finds CI unavailable, and in a second version mergeability not computed yet. The second sweep, with no webhook in between, merges it and removes it from the list. This runs the real sweep and the real Redis retry functions; GitHub and Redis are mocked. Other cases check that a failed check and a closed PR count as resolved, and that an unreadable PR or linked issue counts as inconclusive. - `test/autoMergeSweep.test.ts` gets a sweep-only version of the same two-sweep scenario. - With the previous source files swapped back in, all the new tests fail. The two-sweep tests fail on "the inconclusive evaluation keeps the retry entry", which is the reported bug. **Checks:** typecheck is clean for root and `packages/core`, and `eslint --max-warnings 0` is clean on the changed files. Core was rebuilt. The 13 related test files pass via `node scripts/run-test-suite.mjs`. `test/taskIntentWithdrawal.test.ts` used 81% of its 180s timeout. Nothing has run against real GitHub or Redis. **Not changed:** a PR held back by a merge-blocking state such as `blocked` or `dirty` still counts as resolved. It waits for a review or a push, and either one produces its own event. A policy file that is truly invalid can't be told apart from one that couldn't be read, so both are inconclusive. Such a PR is re-checked about once a minute for up to the existing one-day limit; these checks don't post comments. There are no previews because nothing visible changed. PR: #3450 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
⏳ Ultrafix is waiting for CI before the next These blocking checks on
Checks matching this repository's non-blocking checks never gate Ultrafix. The loop continues automatically once the blocking checks pass; if they have not settled within 2 hours, Ultrafix stops. |
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds opt-in branch updates, per-repository merge serialization, and deferred retries. It needs a targeted correction before merge: a deferred non-plan PR can lose its retry entry while CI runs and then stall permanently after its final check event. ✅ Configuration parity — Runtime validation, editor schema, scaffold, documentation, and tests consistently cover both new options. ✅ Guarded merges — Branch updates include the expected head SHA; merge ownership is renewed, token-checked, and checked again before merging. ✅ Focused coverage — Tests cover overlapping merges, ownership loss, rate limits, and transient reads. The supplied current checks report 38 passed, none failed or pending. The linked issue specification is explicitly truncated; this review does not infer requirements from its omitted portion. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F8: 🔴 Preserve retries through running CI
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe implementation has substantial safeguards and passing checks, but its retry lifecycle still permits a newly updated PR to stall. A localized recovery fix is required before merge. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 97fb611
Summary of ChangesI fixed F8. A PR that ProPR has updated and put on the retry list now stays on it while CI is still running on the new head. Only a failed blocking check takes it off the list, so the sweep can still merge it if the final green check runs into a temporary refusal. What changed
Tests (in
With the old Checks run
There's nothing visual in this change, so I made no previews. Something I found but didn't change: 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…y list now stays on it while CI is still running on the new head. Only a failed blocking check takes it off the list, so the sweep can still merge it if the final green check runs into a temporary refusal. I fixed F8. A PR that ProPR has updated and put on the retry list now stays on it while CI is still running on the new head. Only a failed blocking check takes it off the list, so the sweep can still merge it if the final green check runs into a temporary refusal. **What changed** - `packages/core/src/webhook/checkRunHelpers.ts`: when checks aren't passing, `getCiMergeReadiness` now also says whether a blocking check failed (`checksFailed`). Before, running and failed checks gave the same answer. The reason names are unchanged. - `packages/core/src/webhook/autoMergeEvaluation.ts`: `ciRefusalOutcome` returns `resolved` only when a blocking check has failed, including when other checks are still running. A failure waits on a new head or a re-run, and either one sends its own event. Running checks now return `inconclusive`, so the sweep keeps the entry. I updated the doc comments to match. - `src/daemon/autoMergeSweep.ts` and `docs/docs/features/repository-workflow.md`: the docs had said running checks take a PR off the list; they now describe the new behaviour. An entry still drops off after a day without a new deferral, so CI that hangs forever can't keep it on the list. **Tests** (in `test/checkRunHandler.test.ts`) - A full replay of the review's scenario for a non-plan PR: 1. A green check on the behind head makes ProPR update the branch and add the PR to the list. 2. A sweep while CI is pending keeps the entry. 3. The final green check arrives while GitHub reports `mergeable: null` / `unknown`. Nothing merges and the entry stays. 4. The next sweep merges the updated head and removes the entry. - Running checks keep the entry; a failed check removes it, even with another check still running. - `getCiMergeReadiness` reports `checksFailed: false` for pending checks and `true` for failures, alone or alongside running checks. With the old `ciRefusalOutcome` put back, both new sweep tests fail; with the fix they pass. **Checks run** - I rebuilt core, then ran `node scripts/run-test-suite.mjs` on `test/checkRunHandler.test.ts`, `test/autoMergeSweep.test.ts`, `packages/core/test/autoMergeUpToDate.test.ts` and `packages/core/test/autoMergeGateUpToDate.test.ts`: 172 tests, all passing. - Typecheck is clean for root and `packages/core`. - `eslint --max-warnings 0` is clean on the changed core files and `src/daemon/autoMergeSweep.ts`. The root lint config doesn't cover the test file, so it wasn't linted. - Nothing has run against real GitHub or Redis; the tests mock both. There's nothing visual in this change, so I made no previews. **Something I found but didn't change:** `mergeabilityRefusalOutcome` treats a mergeable state of `blocked` as `resolved`. GitHub can report `blocked` when the checks that have registered are green but a required check hasn't registered yet. That PR would then come off the list. If the late required check's green event then sees unknown mergeability, it gets stuck the same way F8 describes. Fixing it needs a way to tell a missing required check apart from a missing review, which is beyond F8, so I left it. PR: #3450 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR adds opt-in branch updates, serialized comparison and merging, and sweep recovery. It needs a localized recovery fix before merging. ✅ Configuration parity — Validation, editor schema, scaffold, and documentation consistently expose the optional settings and bounded update allowance. ✅ Merge ownership protection — Ownership renewal, token-checked release, and a final ownership check prevent a displaced holder from merging using its earlier comparison. ✅ Focused coverage — Tests cover expected-head updates, serialization, ownership takeover, and several transient recovery paths. The supplied current checks show 38 passed, none failed or pending. This review uses static analysis of the supplied diff and context; no commands were run. The linked issue specification is explicitly truncated, so conclusions rely on its visible requirements and changed behavior. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F9: 🔴 Preserve recovery across failed-check reruns
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe implementation has substantial focused coverage and all supplied checks pass. One demonstrated recovery gap can still strand an updated PR after CI recovers, so it is not yet merge-ready. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit ff13978
Summary of ChangesI fixed F9. When CI fails on a branch ProPR updated, the PR now stays on the retry list. So when a re-run turns green and that green event hits unknown mergeability or active work, a later sweep still merges it. The tests mock GitHub and Redis; nothing ran against the real services. What changed
A PR still leaves the list when it merges or closes, becomes a draft, loses the label, its Ultrafix loop fails, or the policy leaves it for a person. Tests (
Checks run
Limits that still apply
Found but not changed
Nothing visual changed, so there are no previews. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
… now stays on the retry list. So when a re-run turns green and that green event hits unknown mergeability or active work, a later sweep still merges it. The tests mock GitHub and Redis; nothing ran against the real services.
I fixed F9. When CI fails on a branch ProPR updated, the PR now stays on the retry list. So when a re-run turns green and that green event hits unknown mergeability or active work, a later sweep still merges it. The tests mock GitHub and Redis; nothing ran against the real services.
**What changed**
- **Failed checks keep the retry entry** (`packages/core/src/webhook/checkRunHandler.ts`): any CI refusal, running or failed, now returns `inconclusive`. I removed `ciRefusalOutcome`. A failed check still gives up the repository's update turn, so other PRs can be updated in the meantime.
- **Mergeability refusals keep it too**: this is the same mistake one gate later. A PR that was `blocked`, `dirty` or `unstable` was taken off the list on the assumption that a later event would merge it. That fails in two ways: a re-approval sends no check event, and the green event after a conflict fix or a re-run can hit the same transient refusal. F9 asks for recovery until "the remaining merge gates permit merging", and the F8 fix had already flagged `blocked` without changing it. I removed `mergeabilityRefusalOutcome`.
- **Removed `checksFailed`**: `CiMergeReadiness` got this field in the F8 fix only for `ciRefusalOutcome`. Nothing reads it now, so `getCiMergeReadiness` is back to main's shape.
- **Docs**: the code comments, the sweep doc comment and the retry paragraph in `docs/docs/features/repository-workflow.md` now describe the new behaviour.
A PR still leaves the list when it merges or closes, becomes a draft, loses the label, its Ultrafix loop fails, or the policy leaves it for a person.
**Tests** (`test/checkRunHandler.test.ts`)
- **The F9 scenario, end to end, for a non-plan PR**:
1. ProPR updates the behind branch and puts the PR on the list.
2. CI fails. Two sweeps keep the entry and the turn is released.
3. A green re-run on the same head arrives while mergeability is unknown.
4. The next sweep merges `updated-head` and removes the entry.
- **One test each for `blocked`, `dirty` and `unstable`**: the PR stays on the list and merges once GitHub reports it clean. The `dirty` and `unstable` cases also send a green event that hits unknown mergeability first.
- **Two existing tests changed**: they had asserted that a failed check settles the entry. That one test is replaced by the F9 test, and the other now expects `inconclusive`.
- **On the previous code, the 4 new tests fail**: the F9 test fails at step 2 ("a failed check does not settle the retry"), and each mergeability test fails on its first sweep. With the fix they pass.
- **Active work is not exercised.** This test file can't make the active-work check report anything; the queue and DB mocks fail first. I used unknown mergeability instead, which the finding allows, and both return the same way.
**Checks run**
- The 7 related test files pass (including `checkRunHandler` with 145 tests, the sweep suite, and core's `autoMergeUpToDate`, `autoMergeGateUpToDate` and `autoMergePolicy`).
- Core was rebuilt. Typecheck is clean for root and `packages/core`.
- `eslint --max-warnings 0` is clean on the changed core files and on `src/daemon/autoMergeSweep.ts`.
**Limits that still apply**
- An entry still drops off a day after it was last added. So if CI stays failed (or the PR stays blocked) for more than a day, a later green event that hits a temporary refusal is still lost. That one-day limit is how the list cleans itself up, and changing it would mean polling failing PRs without end.
- Until then, the sweep re-checks a failing or blocked PR on the list about once a minute, as it already does for plan PRs.
**Found but not changed**
- **Draft PRs leave the list**: a PR turned into a draft is taken off. Nothing re-checks auto-merge when it is marked ready for review, so a non-plan PR can stall there.
- **Conflicts never add a PR to the list**: when the branch update fails with a conflict, the PR isn't added. If the conflict fix's green event then hits a temporary refusal, a non-plan PR that wasn't already on the list stalls.
Nothing visual changed, so there are no previews.
PR: #3450
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
|
🔀 Resolved merge conflicts from Conflicting Files
Resolution SummaryBoth conflicts are resolved and no conflict markers remain anywhere in the repository. 1.
2.
Checks I ran:
🤖 Resolution Details
System-triggered merge conflict resolution |
…-behind-branch-an-20261111-2200-q3e Automatically resolved merge conflicts after merging target branch into PR branch. Resolved conflicts in: - packages/cli/src/commands/initCommands.ts - packages/core/test/repositoryWorkflow.test.ts PR: #3450 Model: Claude Opus 5.5
|
/ultrafix |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR is merge-ready within the supplied scope. It adds the optional policy, guarded branch updates, merge serialization, and sweep recovery with substantial targeted coverage. ✅ Configuration parity — Runtime validation, editor schema, scaffold, and documentation consistently expose both new options and their defaults. ✅ Head-bound operations — Branch updates use ✅ Recovery coverage — Tests exercise overlapping merges, ownership loss, rate limits, native auto-merge withdrawal, and deferred non-plan PRs. This was a static review; no commands were run. The supplied checks report 38 passed and none failed or pending. The issue specification is explicitly truncated, so requirements beyond its visible portion could not be assessed. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S4: 🟢 Cover retry expiry during waitingIn S5: 🟢 Clarify repositories without CIThe new documentation promises merging after CI passes, while ScoreThe implementation has strong safeguards and targeted tests, with no verified merge blocker in the supplied changes. Current-head checks are green; verification here was static. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3447
Branch:
3447/claude-opus-5-5-update-a-behind-branch-an-20261111-2200-q3eCommits: ✅ Changes committed (bb091a6)
AI Processing Completed
Execution Details:
Summary:
ProPR can now update a behind branch before auto-merging, and merges only after CI passes on the updated head. It's off unless a repository sets
auto_merge.require_up_to_date: true.npm run test:prepare, the typechecks, zero-warning eslint (rootsrc/,packages/core,packages/cli) and 8 related test files vianode scripts/run-test-suite.mjsall pass. Nothing has run against real GitHub; all the tests use mocked GitHub and Redis.Config (
autoMergePolicy.ts)require_up_to_date(boolean, default false) andmax_branch_updates_per_hour(whole number 1–30, default 3). They go through the validator, the editor JSON schema (with parity test cases added), thepropr initscaffold, the docs and the CHANGELOG.updated_branchandwaiting_for_ci_updated_head, plus waiting reasons for a pending update, another PR going first, the hourly limit, a conflict, another update failure, and a failed base comparison.Merge path (
checkRunHandler.tsand a newwebhook/autoMergeUpToDate.ts)behindPR through, but only so its branch can be updated; a head GitHub reports as behind is never merged.auto_mergetrigger). If that isn't enabled, it posts one comment explaining why auto-merge is waiting.recordAutoMergeDecisionEvent, which now acceptsbranch_updatedandwaitingactions. A repeated decision for the same head and base is recorded and commented only once, so the 60-second sweep doesn't flood the timeline.Option off
Tests
packages/core/test/autoMergeUpToDate.test.ts(11 tests) covers up-to-date, behind, waiting for an update that hasn't landed, waiting for CI, the one-at-a-time rule, recording once, rate limiting, failed CI ending the turn, conflicts with and without auto-resolve, a head that moved, a failed base comparison and other update failures.test/checkRunHandler.test.tsgets 6 end-to-end cases, including option off. I also addedrecordAutoMergeDecisionEventto its mock of the gate module, because the new module imports it.There are no visual changes, so I made no preview files.
Detailed Logs:
695dcca9-0cde-4d30-8581-5e1f80631f32Log files stored at:
/usr/src/app/logs/executions/issue-3447-2026-11-11T22-25-42-749Z-conversation.json/usr/src/app/logs/executions/issue-3447-2026-11-11T22-25-42-749Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3447.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!