Skip to content

Conversation

@Churro
Copy link
Collaborator

@Churro Churro commented Dec 16, 2025

Changes

Ensures that platform automerge is only re-attempted when needed (due to rebase) instead of attempting it always for any unmerged PR.

#26567 introduced functionality to re-enable platform automerge when a PR is updated. This approach nowhere ensures that reattemptPlatformAutomerge() is only called in case of new commits on a branch. Since reattemptPlatformAutomerge() works idempotent on all supported platforms, it also doesn't fail if auto-merge is already active, which may explain why this went unnoticed so far.

The issue with the current approach is that it adds unnecessary extra HTTP requests which, in the case of GitLab with 5 retries for failed attempts, slow down renovate execution.

Context

Please select one of the following:

  • This closes an existing Issue, Closes: #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests, but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository: https://gitlab.com/entropy_cat/platform-automerge-test/-/merge_requests/2

Log before this change (only relevant parts)
DEBUG: Branch already exists (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: branch.isBehindBase(): using git to calculate (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: branch.isBehindBase(): false (repository=entropy_cat/platform-automerge-test, baseBranch=main, branch=renovate/yaml-2.x)
       "branchName": "renovate/yaml-2.x"
DEBUG: Branch is up-to-date (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: isBranchConflicted(main, renovate/yaml-2.x) (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: branch.isConflicted(): using git to calculate (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: branch.isConflicted(): false (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Branch does not need rebasing (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Using reuseExistingBranch: true (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Setting current branch to main (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: latest commit (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
       "branchName": "main",
       "latestCommitDate": "2025-12-15T21:12:42Z",
       "sha": "f2a77ae51b0c2d23a52587451db1c22f24a29906"
DEBUG: manager.getUpdatedPackageFiles() reuseExistingBranch=true (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: npm.updateDependency(): dependencies.yaml = 2.8.2 (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: No package files need updating (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Getting updated lock files (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Writing package.json files (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
       "packageFiles": ["package.json"]
DEBUG: Writing any updated package files (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: No updated lock files in branch (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: No changes to package files, skipping post-upgrade tasks (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: No files to commit (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Setting current branch to main (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: latest commit (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
       "branchName": "main",
       "latestCommitDate": "2025-12-15T21:12:42Z",
       "sha": "f2a77ae51b0c2d23a52587451db1c22f24a29906"
 INFO: Extra debugging for demo purposes PR #2 (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
       "commitSha": null
DEBUG: PR not yet in mergeable state. Retrying 1 (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: PR not yet in mergeable state. Retrying 2 (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: PR not yet in mergeable state. Retrying 3 (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: PR not yet in mergeable state. Retrying 4 (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: PR not yet in mergeable state. Retrying 5 (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: PR platform automerge re-attempted...prNo: 2 (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Checking if we can automerge branch (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: mergeStatus=no automerge (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Ensuring PR (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: There are 0 errors and 0 warnings (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
...
DEBUG: HTTP statistics (repository=entropy_cat/platform-automerge-test)
         "gitlab.com": {
           "count": 16,
           "reqAvgMs": 592,
           "reqMedianMs": 448,
           "reqMaxMs": 2690,
           "queueAvgMs": 0,
           "queueMedianMs": 0,
           "queueMaxMs": 1
         }
Log after this change (only relevant parts)
DEBUG: Branch already exists (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: branch.isBehindBase(): using git to calculate (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: branch.isBehindBase(): false (repository=entropy_cat/platform-automerge-test, baseBranch=main, branch=renovate/yaml-2.x)
       "branchName": "renovate/yaml-2.x"
DEBUG: Branch is up-to-date (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: isBranchConflicted(main, renovate/yaml-2.x) (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: branch.isConflicted(): using git to calculate (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: branch.isConflicted(): false (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Branch does not need rebasing (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Using reuseExistingBranch: true (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Setting current branch to main (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: latest commit (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
       "branchName": "main",
       "latestCommitDate": "2025-12-15T21:12:42Z",
       "sha": "f2a77ae51b0c2d23a52587451db1c22f24a29906"
DEBUG: manager.getUpdatedPackageFiles() reuseExistingBranch=true (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: npm.updateDependency(): dependencies.yaml = 2.8.2 (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: No package files need updating (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Getting updated lock files (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Writing package.json files (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
       "packageFiles": ["package.json"]
DEBUG: Writing any updated package files (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: No updated lock files in branch (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: No changes to package files, skipping post-upgrade tasks (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: No files to commit (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Setting current branch to main (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: latest commit (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
       "branchName": "main",
       "latestCommitDate": "2025-12-15T21:12:42Z",
       "sha": "f2a77ae51b0c2d23a52587451db1c22f24a29906"
DEBUG: Checking if we can automerge branch (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: mergeStatus=no automerge (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: Ensuring PR (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
DEBUG: There are 0 errors and 0 warnings (repository=entropy_cat/platform-automerge-test, branch=renovate/yaml-2.x)
...
DEBUG: HTTP statistics (repository=entropy_cat/platform-automerge-test)
         "gitlab.com": {
           "count": 10,
           "reqAvgMs": 409,
           "reqMedianMs": 379,
           "reqMaxMs": 542,
           "queueAvgMs": 0,
           "queueMedianMs": 0,
           "queueMaxMs": 1
         }

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