feat(finish): schedule auto-merge-on-green when a merge is gated on required CI checks #464
No reviewers
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea!464
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-438-finish-ci-gated-merge"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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