Repository navigation
π fix(mergelane): record definite merge refusals as not-applied so the front advances - #14949
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
hive/awaiting-ci: CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Read against v6 44534cd40; this looks correct to me.
src/pkg/mergelane/gate.go:355still classifies 409 from the rawapiErr(captured in the closure) before the wrappederris consulted, soErrHeadMovedwins even thoughMergeAPIErrorNotAppliedalso listshttp.StatusConflictβ the new table test's 409βErrHeadMovedcase is real, not incidental.effects.NotAppliedsurvives the boundary:crux/effects/effects.go:59unwraps to[err, ErrNotApplied], andconvergence/mutation/executor.go:124-128returnseffectErrunchanged after recordingStatusNotApplied, solane.go:804errors.Is(err, effects.ErrNotApplied)is reachable with the real boundary, not only the test fake.- Rate-limit 403s are
*gh.RateLimitError/*gh.AbuseRateLimitError, not*gh.ErrorResponse, so they fall througherrors.Asand stay uncertain β the lane will not drop a front just because the App got throttled. - Moving the helper to
pkg/githubis a pure relocation; the four automerge call sites change only the identifier.
No findings.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
hive/awaiting-ci: CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
The production change looks correct to me; the new unit test's 5xx case cannot pass as written, and it is what is failing test (rest 4/4) / test / coverage on this head.
What I verified in the tree
src/pkg/mergelane/gate.go:345wraps the mergeapiErrwithMergeAPIErrorNotApplied, but the 409 βErrHeadMovedmapping atgate.go:351still reads the rawapiErrviagithubStatus, so 409 keeps its moved-head semantics even though 409 is in the NotApplied set. Good.src/pkg/convergence/mutation/boundary.go:165returnsexecErrunwrapped, andmutation/executor.go:123-128recordsStatusNotAppliedwhenerrors.Is(effectErr, effects.ErrNotApplied), so the journal does see the definite refusal.lane.go:804-808thenleave()s instead ofhold()ing, which promotes the next waiter in the same round. Mechanism matches the intent.
Finding β src/pkg/mergelane/gate_test.go:518 (medium, blocks CI)
The 500 case asserts strings.Contains(err.Error(), "uncertain"). That text comes only from mutation/executor.go:135 ("effect outcome uncertain, reconciliation required: %w"), i.e. from a journaling boundary. The test client is built with ghub.NewClient(...) and never calls SetMutationBoundary, so c.MutationBoundary() is nil (client.go:4433-4441) and effects.Execute falls back to NoopBoundary, which returns the effect error verbatim (crux/effects/effects.go:198-205). CI confirms it:
gate_test.go:518: 500: err = PUT http://127.0.0.1:39159/repos/acme/widgets/pulls/600/merge: 500 refused by policy [], want an uncertain effect
--- FAIL: TestRESTGitHubMergeRefusalClassification
Suggested fix: for the 5xx case assert err != nil && !errors.Is(err, effects.ErrNotApplied) && !errors.Is(err, ErrHeadMoved) (that is the property the production code guarantees), or install a journaling boundary on the test client if you want to assert the "uncertain" wording.
I have not approved or requested changes; flagging for the author.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Danathar <6772335+Danathar@users.noreply.github.com>
β¦rding The no-op mutation boundary returns the API error unchanged, so there is no "uncertain" text to match; uncertain is defined by being neither ErrNotApplied nor ErrHeadMoved. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Describe in operator-reference.md that a front whose merge call GitHub refuses with 403/405/422 leaves the front at once, while 5xx/transport errors still hold it until the front timeout, and name the effects.ErrNotApplied contract on the GitHub.Merge interface so adapters and fakes stay consistent. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
β¦ the lane The serialized contributor lane reads the decision's MergeError to park owner-approved workflow PRs on a missing App permission. A definite refusal now leaves the front, so the error has to travel with that leave. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
85b8c02 to
dfcb873
Compare
|
hive/awaiting-ci: rebased onto v6 over #14941 (kept both new gate tests; the not-applied leave now also carries the typed MergeError so the contributor lane's workflow-permission parking still sees it). CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #14936
The effect layer treated a definite GitHub 403/405/422 from the lane's merge call as an unknown outcome, so the journal recorded it as uncertain and the front PR held its place for the full front timeout (60m) while later PRs waited.
Now these refusals map to
effects.NotAppliedand the lane leaves the front with GitHub's status and message, promoting the next waiter in the same round. 409 still maps toErrHeadMoved. 5xx and transport errors remain uncertain, preserving exactly-once for genuinely unknown outcomes.The status list is not duplicated:
mergeAPIErrorNotAppliedmoved topkg/githubasMergeAPIErrorNotApplied, and automerge now calls it.mergelanealready importspkg/githuband does not importautomerge.β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@Danathar