fix(github): retry the transient 405 'Merge already in progress' race (#5003) - #5042
Merged
Merged
Conversation
…#5003) classifyMergeFailure treated every 405 except the known "Base branch was modified" TOCTOU race as terminal, holding the PR for a human. "Merge already in progress" (GITTENSORY-1K, 2 Sentry events) is the same class of benign race -- another merge request for the same PR is already being processed by GitHub -- not a policy rejection, so it resolves the same way: retry against the settled state instead of holding.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5042 +/- ##
=======================================
Coverage 94.28% 94.28%
=======================================
Files 462 462
Lines 39365 39367 +2
Branches 14362 14363 +1
=======================================
+ Hits 37117 37119 +2
Misses 1593 1593
Partials 655 655
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 Gittensory is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Merge already in progress(GITTENSORY-1K, 2 events) and a rate-limit hit during an assignee retry (GITTENSORY-1M, 1 event).Requirement #1 (
Merge already in progress):classifyMergeFailure(src/services/merge-failure.ts) already has a documented precedent for exactly this shape —isBaseBranchMovedMessagespecial-cases the benign "Base branch was modified" 405 as retryable (terminal: false), while every other 405 falls through to terminal. "Merge already in progress" is the same class of race: another merge request for the same PR is already being processed by GitHub — not a policy rejection, resolves on its own once the in-flight merge settles. AddedisMergeAlreadyInProgressMessage, matching the existing pattern exactly (same file, same shape, sameMERGE_RETRY_CAP-bounded retry viahandleMergeFailureinagent-action-executor.ts, unchanged).Requirement #2 (rate-limit during assignee retry): confirmed
ensurePullRequestAssignee's octokit client already threadsgithubRateLimitAdmissionKeyForInstallation(installationId)throughmakeInstallationOctokit— the same shared rate-limit-budget convention every othersrc/github/call site uses. The one captured GITTENSORY-1M event is from2026-07-09T21:41:51Z, on releasegittensory-orb@0.4.0-beta.13— after #4167's 403-handling fix (2026-07-08) had already deployed. Seer's own root-cause read ("high queue load causes excessive concurrent GitHub API calls per installation, exhausting the rate limit") matches: this is a single, isolated rate-limit event from ordinary contention during a burst, not a new bug — the call already follows the standard rate-limit-aware conventions, and GitHub's own limiter self-resets within the hour. No code change proposed for this half; documented in the issue.Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #5003).Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocallynpm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
test:coverage(full unsharded): not run end-to-end — ran scopedvitest --coveragefortest/unit/merge-failure.test.tsand confirmed via lcov thatsrc/services/merge-failure.tsis at 100% line and branch coverage (LF:18 LH:18,BRF:24 BRH:24). Also rantest/unit/agent-action-executor.test.ts(176 tests combined) to confirm the executor's merge-retry wiring is unaffected.actionlint/test:workers/build:mcp/test:mcp-pack/ui:openapi:check/ui:lint/ui:typecheck/ui:build/npm audit: not run — this change touches onlysrc/services/merge-failure.ts(a pure classification function, no new API/schema/binding/dependency surface) and its tests; no workflow, MCP, UI, or dependency-manifest surface changed.Safety
UI Evidencesection. (N/A.)Notes
Part of a batch of 13 bug fixes filed from a Sentry-issue triage this session (#4994–#5006). This is #10 by priority.