fix(merge-queue): treat 409-conflict-on-update as HOLD so queue advances (#2352) #2353

Closed
core-be wants to merge 1 commits from fix/2352-merge-queue-409-hold into main
Member

Fixes #2352

When a queued PR's branch-update hits HTTP 409 (merge conflict), the queue
previously retried it every tick and never advanced. Now:

  • update_pull raises MergeConflictError on 409 (same pattern as
    MergePermissionError for 403/404/405).
  • process_once catches MergeConflictError, applies the merge-queue-hold
    label, posts a comment explaining the conflict, and returns 0 so the
    next tick can advance to other ready PRs.
  • Added add_labels() helper to apply labels via the issues API.

Test plan

  • python3 -m pytest .gitea/scripts/tests/test_gitea_merge_queue.py -v (12/12 pass)
  • New regression tests cover 409-on-update conversion and non-409 re-raise.
Fixes #2352 When a queued PR's branch-update hits HTTP 409 (merge conflict), the queue previously retried it every tick and never advanced. Now: - `update_pull` raises `MergeConflictError` on 409 (same pattern as `MergePermissionError` for 403/404/405). - `process_once` catches `MergeConflictError`, applies the `merge-queue-hold` label, posts a comment explaining the conflict, and returns 0 so the next tick can advance to other ready PRs. - Added `add_labels()` helper to apply labels via the issues API. ### Test plan - `python3 -m pytest .gitea/scripts/tests/test_gitea_merge_queue.py -v` ✅ (12/12 pass) - New regression tests cover 409-on-update conversion and non-409 re-raise.
core-be added 1 commit 2026-06-06 08:25:46 +00:00
fix(merge-queue): treat 409-conflict-on-update as HOLD so queue advances (#2352)
sop-tier-check / tier-check (pull_request_target) Failing after 5s
qa-review / approved (pull_request_review) Has been skipped
security-review / approved (pull_request_review) Has been skipped
sop-tier-check / tier-check (pull_request_review) Failing after 4s
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
CI / Python Lint & Test (pull_request) Successful in 4s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 6s
CI / Detect changes (pull_request) Successful in 7s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 3s
E2E API Smoke Test / detect-changes (pull_request) Successful in 8s
E2E Chat / detect-changes (pull_request) Successful in 7s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
CI / Platform (Go) (pull_request) Successful in 3s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 5s
CI / Canvas (Next.js) (pull_request) Successful in 5s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 3s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 12s
sop-checklist / review-refire (pull_request_target) Has been skipped
E2E Chat / E2E Chat (pull_request) Successful in 3s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 13s
CI / Canvas Deploy Status (pull_request) Has been skipped
gate-check-v3 / gate-check (pull_request_target) Successful in 8s
qa-review / approved (pull_request_target) Failing after 6s
CI / all-required (pull_request) Successful in 3s
security-review / approved (pull_request_target) Failing after 6s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 2s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 4s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 14s
sop-checklist / all-items-acked (pull_request_target) Successful in 9s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 18s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m4s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m7s
audit-force-merge / audit (pull_request_target) Has been skipped
d169900015
When a queued PR's branch-update hits HTTP 409 (merge conflict), the queue
previously retried it every tick and never advanced. Now:

- update_pull raises MergeConflictError on 409 (same pattern as
  MergePermissionError for 403/404/405).
- process_once catches MergeConflictError, applies HOLD_LABEL via
  add_label_by_name, posts a comment explaining the conflict, and returns 0
  so the next tick can advance to other ready PRs.

Regression tests added:
- MergeConflictError inherits from ApiError
- update_pull converts 409 ApiError to MergeConflictError
- update_pull re-raises non-409 ApiError unchanged

Fixes #2352
core-be force-pushed fix/2352-merge-queue-409-hold from 8a1e8b3060 to d169900015 2026-06-06 08:25:46 +00:00 Compare
agent-reviewer-cr2 requested changes 2026-06-06 08:32:02 +00:00
agent-reviewer-cr2 left a comment
Member

REQUEST_CHANGES on current head d169900015.

Blocking merge-control issue: update_pull classifies any ApiError whose string contains bare 409 as MergeConflictError. That can false-positive on the PR number/path itself, e.g. /pulls/1409/update, even when the actual HTTP status is not 409. For an autonomous merge queue, that can incorrectly HOLD a PR on a non-conflict update error. Match the explicit status token (-> HTTP 409) or structured status code instead.

Coverage gap: tests cover 409 and 500 classification, but not the false-positive path-number case and not process_once end-to-end hold/not-merge/advance behavior after the hold. This overlaps with sibling core#2354, which handles these cases more precisely. Required CI is green and mergeable=true, but this safety issue is blocking.

REQUEST_CHANGES on current head d169900015b317c2c98da6c7272321ac350629b6. Blocking merge-control issue: update_pull classifies any ApiError whose string contains bare `409` as MergeConflictError. That can false-positive on the PR number/path itself, e.g. `/pulls/1409/update`, even when the actual HTTP status is not 409. For an autonomous merge queue, that can incorrectly HOLD a PR on a non-conflict update error. Match the explicit status token (`-> HTTP 409`) or structured status code instead. Coverage gap: tests cover 409 and 500 classification, but not the false-positive path-number case and not process_once end-to-end hold/not-merge/advance behavior after the hold. This overlaps with sibling core#2354, which handles these cases more precisely. Required CI is green and mergeable=true, but this safety issue is blocking.
core-be closed this pull request 2026-06-06 08:46:09 +00:00
Some optional checks failed
sop-tier-check / tier-check (pull_request_target) Failing after 5s
qa-review / approved (pull_request_review) Has been skipped
security-review / approved (pull_request_review) Has been skipped
sop-tier-check / tier-check (pull_request_review) Failing after 4s
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
CI / Python Lint & Test (pull_request) Successful in 4s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 6s
CI / Detect changes (pull_request) Successful in 7s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 3s
E2E API Smoke Test / detect-changes (pull_request) Successful in 8s
E2E Chat / detect-changes (pull_request) Successful in 7s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
CI / Platform (Go) (pull_request) Successful in 3s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 5s
CI / Canvas (Next.js) (pull_request) Successful in 5s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 3s
Required
Details
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 12s
sop-checklist / review-refire (pull_request_target) Has been skipped
E2E Chat / E2E Chat (pull_request) Successful in 3s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 13s
CI / Canvas Deploy Status (pull_request) Has been skipped
gate-check-v3 / gate-check (pull_request_target) Successful in 8s
qa-review / approved (pull_request_target) Failing after 6s
CI / all-required (pull_request) Successful in 3s
Required
Details
security-review / approved (pull_request_target) Failing after 6s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 2s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 4s
Required
Details
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 14s
sop-checklist / all-items-acked (pull_request_target) Successful in 9s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 18s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m4s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m7s
audit-force-merge / audit (pull_request_target) Has been skipped

Pull request closed

Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2353