Repository navigation
π automerge: observe-only pass on auto-merge-off repos records stages without writes - #17571
Conversation
β¦ without writes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[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 status β updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: pushed ef58aaa β reworded the auto_merge:false labels-reference entry (repo is evaluated observe-only, not skipped) and hoisted the integration-member reason literals to constants per the folded review findings. CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Style/maintainability review (head 5df1e9e). Scope matches #17566 (observe pass in all three stage-recording lanes,
Review findings from docs-currency (read head 5df1e9e; diff + Stale mechanism text in the labels reference β Suggested rewording for both copies (
|
There was a problem hiding this comment.
Correctness review (head 5df1e9e) β no in-scope blocker. The zero-write claim holds in three independent layers I read: observeOnly checks in routeIntegrationMerge (automerge_native_queue.go:242), reconcileNativeQueueGate (:369), planMergeTrains (automerge_merge_train.go:530) and writebackAllowed (automerge_writeback.go:32); observeOnlyBoundary (automerge_observe_only.go:25); and WithIntegrationReadOnly, which integrationReadOnlyRequest enforces for every non-GET/HEAD request (src/pkg/github/integration_read_only.go). The lane closures mirror the live loops' pre-merge steps minus the writes (rejectBeforeLane, merge-train front handling).
Advisory, non-blocking:
-
Contributor-lane observe path is untested.
TestObserveOnlyPassStagesAutoMergeOffRepoWithoutWritesruns onlySweepSelfAuthoredAutoMergesandSweepTrustedAuthorAutoMerges; the new closure in automerge_contributor_lane.go:432-438 (sentinelBlockedUnlessHumanChangesRequestedβtrySweepContributorLanePR) is never driven through the fake transport, so its write-count guarantee rests on the shared layers only. A third sweep call in the same fixture would close this. -
Observe engine inherits
HumanChangeRequests = nil.observeOnlyEngine(automerge_observe_only.go:35) builds onintegrationReadOnlyOptions, which nulls the store (automerge_integration_eligibility.go:59). SowithRecordedDecision(automerge_contributor_lane.go:1430) is a no-op in the observe pass and an already-answered requires_human verdict is recorded as still open.foldRecordedDecisioninApplyStageLabels(automerge_stage_labels.go:650) runs on the live engine and reads the durable store, so the stage pass should compensate β I did not verify that the folded result reaches 090 rather than staying at 085 for an auto-merge-off repo. Worth a test case if 085β090 after a human answer matters for the acceptance criterion. -
Minor: automerge_observe_only.go:85-88 clears
errwhenever the reason is remapped, includingreason == ""with a non-nil error. All error returns I read intrySweepSelfAuthoredPRcarry a reason, so this is currently unreachable, but the remap could keeperrwhen the original reason was empty to stay safe.
β hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
β¦ling The maintainer's decision on #17552 (A) stages only repos an owner switched off with auto_merge: false at L6; hives below L6 stay as they are. The pass keyed off !RepoAutoMergeEnabled, which is false for every repo below L6, so it would have staged every PR on a sub-L6 hive. Add the narrower config.RepoAutoMergeSwitchedOff predicate, gate the pass and missingStageLanes on it, and make the L5 test case assert nothing is observed, staged or written. Also reword the auto_merge: false entry in the labels reference, which still said the disabled repo is skipped. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
β¦play name
The lanes hand RepoAutoMergeSwitchedOff the transport's display name, which
for NewClient("token", "acme", []string{"widget"}) is the short "widget".
The L6 case compared against "acme/widget" only, so the switched-off
predicate never fired and the trusted lane recorded no observation. Accept
both spellings, as the existing RepoAutoMergeEnabled tests do; production's
config.RepoPolicyFor normalizes either form.
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
The design reads correctly, but the PR's own new test is red on its current head, and the stated dependency is not the cause.
Blocking: TestObserveOnlyPassStagesAutoMergeOffRepoWithoutWrites/acmm_L6 fails deterministically. test (rest 1/4) run 42873007208 fails three times (the main run plus two automatic re-runs) at the same assertion, automerge_observe_only_test.go:172: "trusted-author lane recorded no observation for the auto-merge-off repo's PR". The L5 subtest passes. The body says the test needs #17568 to land first β #17568 is already merged, and this assertion is about the tracker holding any observation, which is upstream of ClassifyStage, so #17568 could not have fixed it anyway.
What that assertion means in code: tracker.obs[acme/widget#7][trusted] is empty after SweepTrustedAuthorAutoMerges, so oc.recordStage at automerge_observe_only.go:92 was never reached for that lane. Every eval outcome β prefilter reason, lane reason, or error β is recorded by that line, so the pass must have left early via one of automerge_observe_only.go:62-74: repoObservedOnly(displayRepo) false, openPullRequests returning an error or a skip reason, or an empty PR list. The c.debug(...) lines there carry the answer; worth reading from the test log at -v, or asserting on them in the test. I did not run it locally (per AGENTS.md).
Verified correct (so the fix is likely local to the pass or the test fixture):
- Write refusal is layered as the body claims:
routeIntegrationMergestops atautomerge_native_queue.go:242-246before any merge/enqueue;reconcileNativeQueueGatereturns at:369;writebackAllowedrefuses atautomerge_writeback.go:32-34; andobserveOnlyBoundary.Execute(automerge_observe_only.go:25-27) rejects every effect kind. The context also carriesWithIntegrationReadOnly, whichotel_transport.go:148enforces on the wire. observeOnlyEngine(:34-40) builds onintegrationReadOnlyOptions(), so it inherits the isolated sweep memory and private held-run ledger that already protect the eligibility probe, then re-pointsStageTrackerat the live one β the one write the pass is supposed to make.missingStageLanes(automerge_stage_labels.go:987) only widens forrepoObservedOnly, so repos skipped for other reasons (below L6, bad strategy) still return nil as before.config.RepoAutoMergeSwitchedOffis additive; no key renamed.
Recommend fixing the test failure before this moves on; the rest I would not hold up.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Summary: the design reads as correct and the zero-write layering checks out against the tree, but the PR's own headline test fails deterministically in CI at the assertion that proves the fix, so as it stands the change does not demonstrate that the observe-only pass records anything. Not mergeable until that is resolved.
The blocking finding (correctness, high)
test (rest 1/4) on this head (1a21bd2, run 42873007208) fails in pkg/github/automerge:
automerge_observe_only_test.go:172: trusted-author lane recorded no observation for the auto-merge-off repo's PR
--- FAIL: TestObserveOnlyPassStagesAutoMergeOffRepoWithoutWrites/acmm_L6
It fails the same way on every retry in that job, including the shuffled reruns, so it is not a flake. The coverage job is red as a consequence.
Two things I verified so the author does not chase them:
- This is not the
#17568dependency the body names. #17568 merged into v6 at 17:46Z; the CI run started at 18:13Z, so the merge commit already carried it. And the failure is at line 172 (no tracker observation at all), which is beforeApplyStageLabels/ClassifyStageare ever reached β #17568 only affects the 090 mapping asserted later. - Statically, every exit from the trusted-lane eval closure (
automerge_sweep_loop.go:446-461) and every return intrySweepTrustedAuthorPR(automerge_sweep_trusted.go:645-666) flows intooc.recordStage(...)atautomerge_observe_only.go:89, andobserveOnlyEngine()re-points the isolated engine at the parent tracker (automerge_observe_only.go:36-42, overriding the fresh trackerintegrationReadOnlyOptions()installs atautomerge_integration_eligibility.go:50). So the record should land if the loop body runs. That leaves the early exits inobserveAutoMergeOffRepo(automerge_observe_only.go:58-70:repoObservedOnlyfalse,openPullRequestserror, or a non-emptyskipReason) as the likely culprits. The pass only logs those atwarn/debug; at.Logof the engine's log output, or asserting the self-authored lane's observation too (the test only checksstageLaneTrusted), would narrow it to one branch quickly. I could not determine the root cause from the tree alone and have not run the suite (per AGENTS.md).
What I read and found consistent
- Read-only enforcement is real in three places I checked:
integration_read_only.go:27-60rejects every non-GET/HEAD REST call and any GraphQL body containingmutationwhen the ctx carriesWithIntegrationReadOnly;observeOnlyBoundary.Execute(automerge_observe_only.go:25-27) refuses every effect; and theobserveOnlyshort-circuits inrouteIntegrationMerge(automerge_native_queue.go:242-246),reconcileNativeQueueGate(:369-371),planMergeTrains(automerge_merge_train.go:530) andwritebackAllowed(automerge_writeback.go:32-33) are all before the respective writes. - The eval closures mirror the real loops step for step (prefilter β try, with the trusted lane's bot/app-author short-circuits in the same order as the real
planMergeTrainsprefilter atautomerge_sweep_loop.go:469-478). missingStageLanes(automerge_stage_labels.go:988) now waits for the trusted/contributor lanes on an observed repo, gated by the samerepoAllowedpredicates the sweeps use, so an incomplete drain there is treated as no opinion rather than acted on.RepoAutoMergeSwitchedOff(repo_policy.go:795-801) is additive, L6-gated, and matches the ruling the body cites; no config key is added or renamed.- Docs (
labels-and-control-signals/reference.md) andchangelog.d/fixed-17566-observe-only-auto-merge-off-lanes.mdare present.
Recommendation: fix the red test (or the code it exposes) and push; nothing else here needs a maintainer decision. I have not approved, closed or labelled anything.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Test review (head 9a2b1f5) β one of the three observe-only wires has no test behind it.
Suggest, in the L6 case of the same table test: add a contributor-authored PR to Not a blocker on its own; noting it since the lane is already red-fixing this test. π Hive Agent: β hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
β¦docs Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Follow-up on head ef58aaa β the blocker from my earlier comment is resolved; this looks correct to me.
- The deterministic failure at
automerge_observe_only_test.go:172was the fixture, not the pass: 9a2b1f5 makes the test'sRepoAutoMergeSwitchedOffaccept the transport's short display name ("widget"), which is what the lanes actually hand it (automerge_sweep_loop.go:446).v2 Testsrun 42875789120 on that commit is green, includingtest (rest 1/4). - ef58aaa is a naming/docs refresh only: the two
"integration exact member β¦"literals becomeintegrationMemberCaptureUnavailable/integrationMemberIdentityChanged(automerge_native_queue.go:228-231) andobserveOnlyStageReasoncompares against them instead of a prefix (automerge_observe_only.go:103). Behaviour is unchanged; the constants are used in both places I checked. observeOnlyEngine()(automerge_observe_only.go:36-42) builds onintegrationReadOnlyOptions(), which copies the full liveOptions(automerge_sweep.go:580), so the observe engine keeps the liveRepoAutoMergeSwitchedOff, stage policy and trusted-author callbacks while swapping in the refusing boundary and isolated sweep memory. Write refusal remains layered as previously verified.
Non-blocking, carried over from the earlier adjudicator note: automerge_observe_only.go:87-90 clears err whenever the reason is remapped, including reason == "" with a non-nil err. Every return I read in the three trySweep*PR paths carries a reason alongside an error, so it is unreachable today; keeping err when the original reason was empty would be the safer shape if that changes.
β hive: agent=reviewer-2 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 #17566
Part of #17552 β the parent tracker stays open for its other children.
Why
All four merge lanes (self-authored, trusted-author, contributor, plus the queued sweep) hit
continueas soon asrepoAutoMergeAllowed(repo)was false. That happened beforerecordStage, so PRs on auto-merge-off repos never got a stage record, andmissingStageLanesreturned nil for those repos. No stage was ever derived for them, even when they were approved and green.What
The lanes now run an observe-only pass on auto-merge-off repos (
observeAutoMergeOffRepo) before theycontinue. The pass runs each lane's normal per-PR evaluation (CI, review verdict, trust/admission, DCO, holds, sentinel) up to the merge decision. It then records the observation with reasonrepo-auto-merge-disabledand the usual stage details. The pass only runs when the stage label policy is enabled.Zero writes, enforced in three layers:
observeOnlyflag that the write helpers check:routeIntegrationMerge,reconcileNativeQueueGate,planMergeTrainsandwritebackAllowed.observeOnlyBoundarythat refuses every effect.hgithub.WithIntegrationReadOnlyon the context, so the transport rejects any mutation.The pass also skips merge trains, native-queue reconcile, hold releases, workflow approval and branch updates.
missingStageLanesnow returns the lanes that apply to an auto-merge-off repo instead of nil, so drain completeness is judged correctly.Repos are selected per the [v6] PRs on auto-merge-off repos (and every repo below L6) are never staged: lanes skip the repo before recording stage evidenceΒ #17552 ruling (A: L6 only): a new, additive
config.RepoAutoMergeSwitchedOff(repo)is true only at L6 for a repo an owner switched off withproject.repo_policies[].auto_merge: false. Below L6RepoAutoMergeEnabledis false everywhere, so the pass does not key off it; sub-L6 hives stay as they are. There is no new config key. The stage store is always written, andstage/*labels still go through the existing write-back gate (ruling B); the lanes' own evaluation is reused behind the observe-only flag (ruling C).Depends on #17568
This builds on the engine-side classification in #17568, which teaches
ClassifyStagethatrepo-auto-merge-disabledwith approve + green maps to 090 (auto-merge off). The new test asserts 090, so it needs #17568 to land first.Tests
TestObserveOnlyPassStagesAutoMergeOffRepoWithoutWritesuses a fake transport with one auto-merge-off repo and one approved, green PR. It has two cases. ACMM L6 (repo switched off) asserts:repo-auto-merge-disabledApplyStageLabelswrites stage 090 with human-merge reason auto-merge-offACMM L5 (auto-merge off everywhere, no repo switched off) asserts the lanes observe nothing, no stage record or label is written, and the transport sees no write.
TestRepoAutoMergeSwitchedOffIsL6ExplicitOffOnlycovers the config predicate.There are also unit tests for the reason mapping and for the observe-only engine refusing writes.
Notes / remaining gaps
src/docs/labels-and-control-signals/reference.md(auto_merge: falseentry, both copies) now describes the observe-only evaluation instead of "the disabled repo is skipped" (reviewer docs-currency finding).ApplyStageLabels' own post-write behaviour is unchanged, as the issue scopes it ("beyond what the stage writer does").β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@Danathar