Skip to content

fix: recover uncertain auto-merge requests on the same PR - #157197

Open
roboclaw-bot wants to merge 3 commits into
mainfrom
openclaw/repair-uncertain-auto-merge-recovery
Open

roboclaw-bot wants to merge 3 commits into
mainfrom
openclaw/repair-uncertain-auto-merge-recovery

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #156743

What Problem This Solves

Fixes: a network failure during auto-merge submission can leave the native PR workflow unable to retry or cancel, stranding the original pull request.

User Impact

Maintainers can recover on the same PR without deleting the uncertain attempt record or closing and replacing the PR. Recovery requires explicit operator action and preserves normal review, identity, and CI gates.

Why This Change Was Made

An uncertain auto request is neither a rejection nor a confirmed active request. The existing retry and cancellation paths correctly refuse to guess, but offered no way to make progress.

The new path records and confirms a GitHub draft barrier, keeps the PR unmergeable during repair and exact-head verification, then records a replacement-bound readiness transition. Only a separate explicit recovery can request an immediate merge. Lost responses are reconciled without repeating mutations.

Draft is a no-merge barrier, not proof of historical non-execution or a request-generation fence. Because readiness has no atomic expected-head parameter, release now additionally requires an existing, exact-pattern, administrator-enforced read-only lock on the head branch. Force pushes, deletion, and fork syncing must be disabled. The native owner verifies and retains the effective rule identity through readiness and settlement; it never creates, relaxes, removes protection, or deletes the protected branch. A repository administrator owns the narrowly scoped lock setup and restoration—no additional bot privileges are requested.

Evidence

  • Reproduced the original refusal through the native Git/process-lock fixture, then exercised suspension, retained capture/provenance, replacement release, explicit immediate recovery, lost replies, and concurrent merges.
  • Seven-suite run: 421 passed; one outdated CLI-forwarding assertion was corrected. Affected-suite rerun: 269 passed (98.44 seconds runner wall). Final schema/concurrent-merge cases: 3 passed (23.94 seconds runner wall). The original seven-suite runner took 200.99 seconds.
  • Test-root typecheck, changed-test lint, shell syntax, and diff checks passed. Other changed-check stages passed; initial lint findings were corrected and rechecked.
  • Independent review exposed an environment-variable bypass in standalone verification. Replaced it with a strict internal recoveryMode contract; the public CLI always selects ordinary verification. Poisoned-environment regression failed before the correction and passes afterward. Final affected verification/recovery suites: 86 passed.
  • Cold-wrapper testing exposed four missing transitive source entries in the existing inventory at the base revision. Added only those dependencies; main-refresh and eager-import-closure suites now pass all 90 tests (186.79 seconds runner wall).
  • Second independent P0–P2 review is clean, including the strict verification-option correction and full lifecycle sources.
  • Live protected GitHub CLI transport proof passed on this repair PR at 8901a678cd710905843558d51b1ba31d83700f88: draft → ready → draft → ready. Fresh API reads confirmed each state with the same head and no auto-merge request. The draft event intentionally superseded the first CI start; the final ready state owns the landing run. No auto-merge mutation or original-PR mutation was used for this proof. Native interrupted/lost-response behavior remains covered by the isolated fixtures, not a fabricated live failure.

Head-change review correction

  • Addressed the reviewed collaborator-head-change window with a server-enforced write-fence prerequisite, read through the unchanged managed maintainer’s GraphQL ref.branchProtectionRule contract. Repository, ref, head, writer permission, rule identity/pattern and lock flags are bound; an independent canonical Git-ref read follows. Null, forbidden, partial-error, wrong identity, changed-rule and head-drift responses fail closed.
  • 106 lifecycle/recovery tests passed (184.94 seconds runner wall); after the final reader correction all 24 auto-recovery tests passed (148.21 seconds runner wall). The writer/admin-push cases inspect the fixture’s actual Git ref and landed content, not only a command status. Typecheck, lint, format, shell syntax and size guards passed; independent P0–P2 review is clean.
  • Live managed-reader proof confirms roboclaw-bot has MAINTAIN access to the exact query and the expected ref/head. It returned a null rule because no lock is installed. A non-null installed lock and live rejected-push proof remain pending an administrator-owned, create-only rule on this task’s head branch. No policy or role changes have been made.
  • Previous CI job 107602780389 stopped during the architecture check because its runner received a shutdown signal; the log shows no source assertion failure before termination. The new head requires fresh CI.

Worked on by

Work sessions


View the OpenClaw team session

@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

OpenClaw-Publication: 2d7322ff-1237-4c88-b314-977691824991

Co-authored-by: steipete <[email protected]>
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/repair-uncertain-auto-merge-recovery branch from f65842a to 8901a67 Compare September 24, 2026 10:06
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 24, 2026 10:07
@roboclaw-bot
roboclaw-bot marked this pull request as draft September 24, 2026 10:07
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 24, 2026 10:07
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 24, 2026, 7:52 AM ET / 11:52 UTC (Revision 3).

ClawSweeper review

What this changes

Adds a native maintainer command to suspend an uncertain auto-merge attempt, protect the reviewed PR head during release from draft, and require a separate explicit merge recovery.

Merge readiness

⛔ Blocked before merge - 6 items remain

Keep this PR open. Current main lacks this recovery path, and the overlapping open PR is not a proven replacement. The current source addresses the prior head-change finding, but the required GitHub lock has not been installed or proven to reject an unreviewed push.

Priority: P2
Reviewed head: 1a17560c40368ab6333f8b135d7aa35ddb51a709
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The recovery implementation has substantial boundary coverage, but its decisive live authority check remains unproved.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: Authority-chain proof required: The native merge owner now reads a GitHub head lock before ready release, and GitHub's timeline supports the reported draft and ready transitions on the earlier head. The collaborator rejection and late-auto final effect are modeled by a synthetic GitHub client; the PR body says the live rule returned null, so a real rejected-push result is still needed. Redact private identifiers from the evidence. Updating the PR body should trigger re-review; if it does not, ask a maintainer to comment @clawsweeper re-review. Existing version-1 outcome fields remain optional, so no stored-record migration is indicated. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: The native merge owner now reads a GitHub head lock before ready release, and GitHub's timeline supports the reported draft and ready transitions on the earlier head. The collaborator rejection and late-auto final effect are modeled by a synthetic GitHub client; the PR body says the live rule returned null, so a real rejected-push result is still needed. Redact private identifiers from the evidence. Updating the PR body should trigger re-review; if it does not, ask a maintainer to comment @clawsweeper re-review. Existing version-1 outcome fields remain optional, so no stored-record migration is indicated. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 10 items Current-main boundary: The fetched main revision permits recovery of an unaccepted immediate intent or a qualified auto refusal, but has no draft-suspension route for an otherwise uncertain auto request.
Introduced head fence: The introduced recovery path requires a same-repository head and an exact, administrator-enforced read-only branch rule, then independently reads the Git ref.
Release ordering: The path checks exact-head review, rechecks the fence, records the ready outcome before requesting readiness, and checks the fence again afterward. This addresses the previous source-level finding.
Findings None None.
Security Needs attention Live head-lock enforcement remains unverified: The PR body reports a null rule on the task branch, while the forbidden-push test uses a synthetic GitHub client. A real rejected push is needed to establish that the reviewed head stays fixed before a delayed auto request can act.

How this fits together

OpenClaw's native PR workflow combines GitHub PR state, retained merge outcomes, review records, and CI results before requesting draft, ready, or merge transitions. It records the outcome so an interrupted request can be reconciled without blindly repeating it.

flowchart LR
A[Uncertain auto request] --> B[Retained outcome]
B --> C[Draft barrier]
C --> D[Reviewed head and CI]
D --> E[Head branch lock]
E --> F[Ready transition]
F --> G[Explicit merge recovery]
G --> H[Verified merge receipt]
Loading

Decision needed

Question Recommendation
Will an authorized repository administrator install and retain the exact head-branch lock needed for this same-PR recovery path and verify that GitHub rejects an unreviewed push? Prove the protected recovery: Install the narrowly scoped rule, capture the live forbidden-push result, and retain the lock until the original request and recovery settle.

Why: The proposed safety boundary depends on repository policy that the PR does not create and that the available live evidence says is absent.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: The native merge owner now reads a GitHub head lock before ready release, and GitHub's timeline supports the reported draft and ready transitions on the earlier head. The collaborator rejection and late-auto final effect are modeled by a synthetic GitHub client; the PR body says the live rule returned null, so a real rejected-push result is still needed. Redact private identifiers from the evidence. Updating the PR body should trigger re-review; if it does not, ask a maintainer to comment @clawsweeper re-review. Existing version-1 outcome fields remain optional, so no stored-record migration is indicated. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve security concern: Live head-lock enforcement remains unverified - The PR body reports a null rule on the task branch, while the forbidden-push test uses a synthetic GitHub client. A real rejected push is needed to establish that the reviewed head stays fixed before a delayed auto request can act.
  • Resolve merge risk (P1) - The required read-only rule is not installed on the task branch, and no live rejected-push observation shows that a collaborator's unreviewed head is stopped before a delayed auto request could merge it.
  • Resolve merge risk (P1) - This recovery mode requires administrator-owned protection setup and later restoration; the operator must preserve prior rule settings and keep the lock through merge settlement.
  • Complete next step (P2) - Have an authorized administrator install the exact head-branch lock, capture a live rejected collaborator push through the ready boundary, and confirm who retains and restores the rule.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [medium] Live head-lock enforcement remains unverified — scripts/pr-lib/merge-outcome.sh:695
Agent review details

Security

Needs attention: The code now checks a head-write fence, but the live GitHub enforcement needed at the ready transition remains unproved.

PR surface

Tests +753, Docs +50, Other +316. Total +1119 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 7 769 16 +753
Docs 2 51 1 +50
Config 0 0 0 0
Generated 0 0 0 0
Other 5 346 30 +316
Total 14 1166 47 +1119

Review metrics

Metric Value Why it matters
Recovery interface 1 CLI flag added The new suspension choice is an operator-visible route with a separate release step.
Production and test growth tooling +316, tests +753 net lines The retained recovery lifecycle explains the tooling growth; the new tests exercise consequential state transitions but use a synthetic GitHub client.

Merge-risk options

Maintainer options:

  1. Prove the live head fence (recommended)
    An authorized administrator should install the exact read-only rule and capture a rejected collaborator push before the ready and delayed-auto boundary is accepted.
  2. Pause same-PR recovery
    Keep the uncertain request behind the draft barrier if the branch cannot remain write-locked through settlement.

Technical review

Best possible solution:

Keep the reviewed head under a verified, administrator-enforced GitHub write lock through readiness and settlement, then restore only the task-owned protection change after the merge receipt is confirmed.

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

Yes at source level: current main refuses recovery of an unaccepted auto intent without qualified refusal evidence. This read-only review did not execute the native workflow.

Is this the best way to solve the issue?

Unclear pending live enforcement proof. The draft barrier and head-lock checks form a coherent path, but the critical GitHub rejection behavior has not been observed with an installed rule.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 074198a6341a.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded maintainer landing-workflow improvement with limited user-facing blast radius.
  • merge-risk: 🚨 security-boundary: Ready release can expose a PR head to an outstanding auto request, so the live head-write boundary must be established.
  • merge-risk: 🚨 automation: The patch changes native PR merge automation and its retained recovery lifecycle.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: The native merge owner now reads a GitHub head lock before ready release, and GitHub's timeline supports the reported draft and ready transitions on the earlier head. The collaborator rejection and late-auto final effect are modeled by a synthetic GitHub client; the PR body says the live rule returned null, so a real rejected-push result is still needed. Redact private identifiers from the evidence. Updating the PR body should trigger re-review; if it does not, ask a maintainer to comment @clawsweeper re-review. Existing version-1 outcome fields remain optional, so no stored-record migration is indicated. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Live head-lock enforcement remains unverified — scripts/pr-lib/merge-outcome.sh:695
    The PR body reports a null rule on the task branch, while the forbidden-push test uses a synthetic GitHub client. A real rejected push is needed to establish that the reviewed head stays fixed before a delayed auto request can act.
    Confidence: 0.9

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Patrick Erichsen: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect proof that GitHub rejects a collaborator's unreviewed head while the exact admin-enforced lock is held through ready release and delayed-request settlement.
  • Record who owns preserving and restoring the task-specific branch rule after the verified receipt.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-24T10:18:34.246Z sha 8901a67 :: needs real behavior proof before merge. :: [P1] Fence the PR head through the ready transition
  • reviewed 2026-09-24T10:51:37.615Z sha 8901a67 :: needs real behavior proof before merge. :: [P1] Fence the PR head before marking it ready

Require an existing administrator-enforced read-only branch lock through readiness and settlement. Read the effective policy through the managed maintainer's GraphQL contract without changing repository permissions.

Co-authored-by: steipete <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XL labels Sep 24, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant