Skip to content

fix(automerge): merge ready behind heads directly#679

Merged
hxy91819 merged 2 commits into
mainfrom
feature/automerge-direct-behind
Jul 18, 2026
Merged

fix(automerge): merge ready behind heads directly#679
hxy91819 merged 2 commits into
mainfrom
feature/automerge-direct-behind

Conversation

@hxy91819

Copy link
Copy Markdown
Member

Summary

  • stop treating an otherwise-ready BEHIND head as an automatic repair/rebase request
  • allow exact-head automerge readiness and the repair shepherd to proceed for BEHIND
  • keep DIRTY and CONFLICTING states on the fail-closed repair path, including mixed BEHIND + CONFLICTING observations

Root cause

ClawSweeper treated ordinary base drift as a required contributor-branch rewrite before attempting GitHub squash merge. A real local-container smoke with OpenClaw PR 108974 reproduced the consequence: rebasing the already-green PR onto current main made it inherit four unrelated typecheck failures that also reproduce on the exact main base alone.

GitHub can merge an otherwise-ready behind head with its normal three-way squash merge. The merge call remains pinned with --match-head-commit; required checks, exact-head ClawSweeper review, review decisions, conflicts, and GitHub repository policy are unchanged.

Validation

  • focused automerge router/shepherd tests: 138 passed
  • pnpm run check
  • staged-only gitleaks: no leaks
  • autoreview: clean, no accepted/actionable findings

Follow-up

The independent real-OpenClaw smoke PR will add a direct-automerge scenario because the current repair-only harness cannot exercise this route.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Jul 18, 2026
@clawsweeper

clawsweeper Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 5:16 PM ET / 21:16 UTC.

Summary
The PR permits otherwise-ready BEHIND pull-request heads to pass ClawSweeper automerge and shepherd readiness without a rebase, while preserving conflict handling and adding focused regression and fake-GitHub concurrency coverage.

Reproducibility: no. independently inspectable live reproduction artifact is included in the supplied context, but the added focused tests provide a clear source-level path for the BEHIND readiness behavior and conflict exclusion.

Review metrics: 2 noteworthy metrics.

  • Patch surface: 8 files affected; 160 additions, 21 deletions. The change is focused on automerge readiness, its shepherd, and targeted regression coverage.
  • Focused validation: 2 router/shepherd test files changed; 1 fake-GitHub concurrency test added. The diff covers the direct-behind decision and the state-fixture reliability used by automation tests.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] This intentionally delegates current-base integration enforcement for BEHIND heads to each target repository’s GitHub merge policy; repositories that require an up-to-date branch must enforce that rule there.
  • [P1] The current head still needs its in-progress pnpm check to complete successfully before an automerge action can proceed.

Maintainer options:

  1. Land with the accepted exact-head policy (recommended)
    Allow the PR to proceed once required checks complete, relying on exact-head pinning and target-repository GitHub merge rules for current-base enforcement.
  2. Restore a universal rebase requirement
    Keep BEHIND as a repair condition if maintainers instead want ClawSweeper to require every contributor branch to be rewritten onto current main.

Next step before merge

  • [P2] No mechanical repair is indicated; wait for the in-progress required check and then use the normal exact-head merge gates.

Security
Cleared: The diff changes internal readiness logic and test fixtures without adding dependencies, external execution sources, permissions, secrets handling, or supply-chain inputs.

Review details

Best possible solution:

Merge only after the exact reviewed head remains mergeable with all required checks green, using the accepted policy that GitHub repository rules—not a contributor rebase—decide whether base freshness is required.

Do we have a high-confidence way to reproduce the issue?

No independently inspectable live reproduction artifact is included in the supplied context, but the added focused tests provide a clear source-level path for the BEHIND readiness behavior and conflict exclusion.

Is this the best way to solve the issue?

Yes. Given the recorded maintainer decision, accepting only an exact reviewed, mergeable, green-checked head and leaving base-freshness enforcement to GitHub repository policy is the narrowest solution; the separate conflict gates remain intact.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8f6fb8fcb193.

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR author is a repository MEMBER, so the external-contributor real-behavior-proof gate does not apply; the supplied context nevertheless records a local smoke and focused automated validation.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: This PR changes the merge path for otherwise-ready pull requests and can affect active automerge workflows across repositories.
  • merge-risk: 🚨 compatibility: The change replaces an implicit rebase-before-merge expectation with target-repository GitHub policy for ordinary base drift.
  • merge-risk: 🚨 automation: The changed code directly controls ClawSweeper automerge router and shepherd readiness decisions.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR author is a repository MEMBER, so the external-contributor real-behavior-proof gate does not apply; the supplied context nevertheless records a local smoke and focused automated validation.
Evidence reviewed

What I checked:

  • Maintainer policy decision: A MEMBER explicitly selected exact-head-only direct merges for ordinary BEHIND state and stated that DIRTY/CONFLICTING, failed checks, head drift, and failed review remain fail-closed.
  • Router retains independent mergeability and review gates: The changed readiness condition broadens only the accepted merge-state values; the surrounding current-main readiness path separately requires view.mergeable === "MERGEABLE", green checks, an exact reviewed head, and no blocking review decision. (src/repair/comment-router.ts:4078, 6ee4e230fa9a)
  • Conflict repair remains explicit: The PR keeps DIRTY and mergeable: CONFLICTING on the cloud-rebase repair path, and adds coverage for a mixed BEHIND plus CONFLICTING observation. (src/repair/comment-router-core.ts:629, 6ee4e230fa9a)
  • Shepherd policy matches router policy: The shepherd now uses the shared ready-state predicate, with a test showing a BEHIND but mergeable exact-reviewed head becomes ready only after successful checks and the trusted verdict are present. (src/repair/automerge-shepherd.ts:74, 6ee4e230fa9a)
  • Validation remains pending at the reviewed head: The supplied check state shows the focused automation checks and CodeQL succeeded, while pnpm check is still in progress; this is a normal merge gate rather than evidence of a patch defect. (6ee4e230fa9a)

Likely related people:

  • hxy91819: They authored both commits in this PR and supplied the explicit maintainer decision defining the intended exact-head merge boundary. (role: automerge policy decision author and recent area contributor; confidence: high; commits: 87d4b3a5f1a2, 6ee4e230fa9a; files: src/repair/comment-router.ts, src/repair/comment-router-core.ts, src/repair/automerge-shepherd.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (2 earlier review cycles)
  • reviewed 2026-07-18T20:48:59.362Z sha 87d4b3a :: found issues before merge. :: [P1] Require merge-result validation before accepting BEHIND heads
  • reviewed 2026-07-18T21:08:53.513Z sha 6ee4e23 :: found issues before merge. :: [P1] Validate the merge result before accepting BEHIND heads

@hxy91819

Copy link
Copy Markdown
Member Author

Maintainer decision: choose option 2 (accept exact-head-only direct merges for ordinary BEHIND).

The intended ownership boundary is: ClawSweeper pins the reviewed contributor head with --match-head-commit, requires green PR checks and an exact-head trusted review, and leaves current-base integration enforcement to the target repository's GitHub merge policy. We explicitly accept that tradeoff to avoid rewriting contributor branches and forcing unrelated current-main baseline failures onto otherwise ready PRs. DIRTY/CONFLICTING, failed checks, head drift, and review failures remain fail-closed.

Local proof on 6ee4e230fa: pnpm run check passed; the local 8 GiB container passed all 12 tiny/openclaw-shaped automerge scenarios; structured autoreview returned 0 actionable findings. A follow-up real-OpenClaw smoke PR will add the direct-behind merge-result fixture/smoke layer without changing this policy PR.

@hxy91819

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 18, 2026
@hxy91819
hxy91819 merged commit 06552f2 into main Jul 18, 2026
13 checks passed
@hxy91819
hxy91819 deleted the feature/automerge-direct-behind branch July 18, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant