feat(finish): schedule auto-merge-on-green when a merge is gated on required CI checks #464

Merged
hexajon merged 1 commit from issue-438-finish-ci-gated-merge into main 2026-08-27 07:31:39 +00:00
Owner

Summary

On a repo whose default branch requires a status check, finish's merge failed with 405 "not all required status checks successful" because the required CI check had only just started - dropping the caller back into the manual watch-CI/merge/pull/delete flow finish exists to remove. Now a new gitea.IsMergeRequiredChecksPending predicate detects that specific 405, and MergeWithRetry re-issues the same merge with merge_when_checks_succeed so the FORGE merges the PR itself once the checks pass, returning an ErrAutoMergeScheduled sentinel. Every consumer of the shared merge path honors it - finish (local and remote), CLI pr merge, the MCP prs merge action, and orchestrate batch-merge and revert - reporting the scheduled merge and SKIPPING return-to-mainline (no pull, no branch delete; the forge merges and cleans up on green). The failure never falsely reports success: a failed schedule call surfaces verbatim. Classified before the behind-base 405 branch and separate from the #456 non-retryable/transient classes, so a CI-gated 405 is never mislabeled. #456's classification and the try-again-later backoff are untouched. Design: forge-side auto-merge-on-green (non-blocking), not a blocking poll. Tests cover the schedule path (second MergePR carries merge_when_checks_succeed), the non-CI-gated errors still failing verbatim, the happy path merging normally, and the misclassification guard.

Refs #438

## Summary On a repo whose default branch requires a status check, finish's merge failed with 405 "not all required status checks successful" because the required CI check had only just started - dropping the caller back into the manual watch-CI/merge/pull/delete flow finish exists to remove. Now a new gitea.IsMergeRequiredChecksPending predicate detects that specific 405, and MergeWithRetry re-issues the same merge with merge_when_checks_succeed so the FORGE merges the PR itself once the checks pass, returning an ErrAutoMergeScheduled sentinel. Every consumer of the shared merge path honors it - finish (local and remote), CLI pr merge, the MCP prs merge action, and orchestrate batch-merge and revert - reporting the scheduled merge and SKIPPING return-to-mainline (no pull, no branch delete; the forge merges and cleans up on green). The failure never falsely reports success: a failed schedule call surfaces verbatim. Classified before the behind-base 405 branch and separate from the #456 non-retryable/transient classes, so a CI-gated 405 is never mislabeled. #456's classification and the try-again-later backoff are untouched. Design: forge-side auto-merge-on-green (non-blocking), not a blocking poll. Tests cover the schedule path (second MergePR carries merge_when_checks_succeed), the non-CI-gated errors still failing verbatim, the happy path merging normally, and the misclassification guard. Refs #438
feat(finish): schedule auto-merge-on-green when a merge is gated on required CI checks (#438)
All checks were successful
drift / govulncheck (pull_request) Has been skipped
drift / surface-diff (pull_request) Successful in 59s
drift / forgejo-smoke (pull_request) Has been skipped
ci / mcp-conformance (pull_request) Successful in 1m49s
ci / mcp-conformance (push) Successful in -1s
drift / govulncheck (push) Has been skipped
ci / gate (pull_request) Successful in 17m12s
drift / surface-diff (push) Successful in -1s
drift / forgejo-smoke (push) Has been skipped
ci / gate (push) Successful in 11m5s
3962268072
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea!464
No description provided.