Skip to content

feat(github): support asynchronous PR merges - #163579

Merged
vincentkoc merged 4 commits into
mainfrom
feat/github-async-merge-20261002
Oct 6, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
feat/github-async-merge-20261002

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

OpenClaw's GitHub tooling does not yet support GitHub's generally available asynchronous merge requests.

User Impact

The protected-wrapper correction is implemented in Octopool PR #231. Async submission and polling now put X-Octopool-Require: merge-async-v1 first after api, before any option an older wrapper might delegate. Protected old wrappers refuse before rewriting or child GitHub I/O; use a build containing that Octopool fix. Never remove the marker, disable protection, or select a raw CLI to work around refusal. No Worker deployment or credential change is required.

The dependency merged as c75889dc406b, with a landed tree identical to tested head 32fb0b8. Both Linux and Windows CI passed. OpenClaw current-head CI passed, and the native workflow squashed the exact reviewed head ca07a71 as 38ed3ed9ab42. Remote main contains the landed commit; native completion is verified.

Native immediate squash merges can submit a reviewed, head-pinned async request and resume by checking its saved UUID without submitting another merge. The bundled GitHub skill explains the same API and its queue and stack semantics.

Acceptance is not merge completion: existing PR, commit, and tree verification still gates completion and cleanup. Single-PR admission rejects stacks because GitHub can also merge open downstack PRs. Existing auto-merge, queue, admin, and alternate transport contracts remain in place.

Why This Change Was Made

Use GitHub's async merge API through the existing GitHub subprocess and merge-outcome owners. The request UUID is retained before polling; failures, conflicts, expired results, and lost replies require reconciliation instead of automatic resubmission.

The production growth is for the new API response contract and durable asynchronous request lifecycle. No new configuration, dependencies, or storage owner is introduced.

Evidence

Current candidate

  • Head ca07a714938ef35ec4c5979de4d74daa192bba4a adds the mandatory guard to async PUT and UUID GET, preserves its first-option ordering, and documents the upgrade contract. The earlier head 0d3f50e6e62f6df0f73737a082b55013d0003abe already integrated main c949e281be43f7f7cb590889b38eb34f41f2eade; its CI run passed 46 jobs. That is prior-head evidence, not current-head CI.
  • Octopool PR #231 is merged. It models async fields structurally, pins omitted heads, snapshots commit text, protects native status reads, and refuses generic merge fallback. Local formatter arguments remain unchanged. Built executable and copied-shim tests passed allowed requests and structural rejection before child I/O. Focused protection/API/shim proof passed in 11.883s; exact-head Linux/Windows CI passed, and its final ClawSweeper review has no findings or rank-up moves.
  • Reproduced the original defect against installed Octopool 0.6.4 (e2eae0a) with a synthetic child: without marker, one child received rebase; marker-first exited 1 with zero children. Then ran this OpenClaw head's actual merge-rest -> execPrGh -> PATH gh -> Octopool polling path: marker stayed first and the old wrapper refused with zero child GitHub calls.
  • Qualified a task-scoped build of the merged Octopool source through supported OPENCLAW_GH_BIN, with OCTOPOOL_GH_PATH retaining the original configured PATH writer. Binary SHA-256: 28148b1df3d759ecf5ce566c44049ba13957c6029a32864c0c0d298db1d57caf. Existing policy/configuration and credential sources remain unchanged; no global install or Worker deployment occurred. OpenClaw's actual wrapper verified the same writer identity and a live merge-status GET returned HTTP 204. Current empty policy is pass-through; active-policy refusal is established by built-shim fixtures, not that live read.
  • Independent P0/P1 reviews of both corrections returned scoped-clean. Syntax, formatting, staged-content hook, and diff checks passed. The OpenClaw linked worktree has no installed dependencies, so the normal current-head PR CI supplies the remaining lifecycle test proof. No shared install was changed.
  • Current-head CI passed: 48 successful jobs, 25 skipped, zero failures; openclaw/ci-gate succeeded. The exact-head ClawSweeper review has no code/security findings and accepts the authority proof. Its remaining dependency-first and configured-wrapper conditions are now both satisfied by the merged dependency and qualified scoped writer above. The OpenClaw head is unchanged; no rating-only re-review is requested.

Earlier proof

  • Ten native CLI response cases passed: pending, merged, failed, enqueued, expired, wrong head, wrong UUID, unexpected rule bypass, malformed commit, and unknown status.
  • Shell/JavaScript syntax, formatting, diff checks, and independent blocking-defect review passed.
  • A live request for the already-merged PR #163245 returned HTTP 200, status: merged, and its known merge commit. This checks the live endpoint contract; it does not claim a new async merge was executed.
  • Added real-Git lifecycle coverage for retained UUIDs, repeated polling, operator recovery captures, lost/invalid responses, expiry, commit mismatch, and stacks.
  • Prior-head CI passed for e687585a9c60741fd63ebb62ccafbddf78dcb87c, including the affected lifecycle suites, changed-file/boundary checks, lint, type checks, guards, and dependencies.
  • The shared repository-read fake accepts the exact versioned and unversioned authority requests; the recovery suite now expects the current rejection diagnostic. Both keep their refusal and no-mutation assertions.
  • Earlier clean reviews were superseded by the confirmed Octopool finding; their verdicts do not cover the corrective head. The measured historical test cost is retained below.

Historical measured test cost

Observed on the prior e687585a9c60 hosted CI run; these are CI measurements, not an isolated local single-worker benchmark. Suite wall time is the test-file duration reported by Vitest. CI seconds measure the containing job from start to completion and include setup and any other suites in that job.

Suite Passed Suite wall time CI job seconds
Async REST merge 94 133.866 s 200 s
Merge recovery 57 122.674 s 189 s
Main refresh 92 134.215 s 196 s
Hosted merge 29 31.689 s 168 s

These suites exceed 30 seconds because they exercise real Git repositories, supervised native subprocess dispatch, retained Git objects, compare-and-swap outcome updates, and operation-lock recovery. Pure response-parser mocks cannot prove those boundaries; the ten lightweight CLI cases cover the response contract separately. Shared test-support changes are covered by these four existing suites.

@vincentkoc vincentkoc self-assigned this Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 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-barnacle openclaw-barnacle Bot added scripts Repository scripts size: M labels Oct 2, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review October 2, 2026 14:40
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 6, 2026, 8:12 AM ET / 12:12 UTC (Revision 5).

ClawSweeper review

What this changes

The PR adds asynchronous squash-merge submission, saved request identifiers, polling and recovery to OpenClaw’s PR landing scripts, with lifecycle coverage and GitHub skill guidance.

Merge readiness

⛔ Blocked before merge - 2 items remain

The corrective head resolves the prior protected-wrapper finding, and the supplied authority-boundary proof is sufficient. The feature remains absent from current main; the prerequisite Octopool correction remains unmerged.

Priority: P2
Reviewed head: ca07a714938ef35ec4c5979de4d74daa192bba4a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The correction has focused boundary proof and a coherent retained-request implementation; dependency landing remains separate from patch quality.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The captured evidence exercises this head’s production polling path against the installed protected wrapper and the dependency’s built executable/shim for allowed dispatch and rejection before child I/O. This satisfies the MEMBER-authored PR’s scoped authority gate; no live pending merge is claimed. Existing-state compatibility is source-verified because asyncMerge is optional and legacy intents remain reconciliation-only.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured evidence exercises this head’s production polling path against the installed protected wrapper and the dependency’s built executable/shim for allowed dispatch and rejection before child I/O. This satisfies the MEMBER-authored PR’s scoped authority gate; no live pending merge is claimed. Existing-state compatibility is source-verified because asyncMerge is optional and legacy intents remain reconciliation-only.
Evidence reviewed 12 items Pinned introduced change: Reviewed the merge-base-to-head production hunks. The checkout is the original PR head, ca07a71; the supplied stale test merge was not used to infer removal of main behavior.
Prior authority finding corrected: Both PUT submission and UUID GET pass through asyncMergeResponse, which inserts the mandatory guard immediately after api. GitHub’s verified corrective-commit patch also shows the matching documentation and ordering assertion.
Retained-state compatibility: asyncMerge is optional in the existing version-1 outcome validator. New acknowledgments retain the UUID before polling, while older outcomes continue through reconciliation without a new submission. Completion still requires the authoritative PR receipt and reconstructed landed tree.
Findings None None.
Security None None.

How this fits together

OpenClaw’s PR landing scripts consume reviewed commits and GitHub admission evidence, then submit merges through the configured GitHub wrapper. Retained outcomes govern reconciliation, completion comments and cleanup.

flowchart TD
  A[Reviewed PR head] --> B[Admission checks]
  B --> C[Retained merge intent]
  C --> D[Protected GitHub wrapper]
  D --> E[GitHub asynchronous merge]
  E --> F[Saved request and polling]
  F --> G[PR and tree verification]
  G --> H[Completion and cleanup]
Loading

Before merge

  • Resolve merge risk (P1) - The prerequisite Octopool correction is still unmerged; protected installations without it will refuse ordinary REST squash submission and async polling.
  • Complete next step (P2) - Complete the prerequisite landing at fix(rewrites): preserve async PR merge authority octopool#231 and verify the configured wrapper includes merge-async-v1 support.
Agent review details

Security

None.

PR surface

Tests +179, Docs +52, Other +150. Total +381 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 183 4 +179
Docs 2 56 4 +52
Config 0 0 0 0
Generated 0 0 0 0
Other 3 162 12 +150
Total 8 401 20 +381

Review metrics

Metric Value Why it matters
Production versus test growth production net +150 lines; tests and support net +179 lines The PR justifies production growth through the async response contract and retained-request lifecycle.

Merge-risk options

Maintainer options:

  1. Land the wrapper prerequisite first (recommended)
    Keep this PR pending until the Octopool correction lands and the configured wrapper includes its async structural guard.

Technical review

Best possible solution:

Coordinate the wrapper upgrade with this feature while preserving head-pinned admission, durable reconciliation and verified completion.

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

Not applicable as a bug reproduction: current main lacks this asynchronous lifecycle, and the supplied wrapper evidence directly exercises the corrected authority boundary.

Is this the best way to solve the issue?

Yes. Extending the existing dispatch and retained-outcome owners is a focused approach, provided the protected-wrapper prerequisite lands first.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against bfde36e86028.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Older protected wrappers intentionally refuse the new calls; that upgrade tradeoff is accepted, but the prerequisite correction remains unmerged.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured evidence exercises this head’s production polling path against the installed protected wrapper and the dependency’s built executable/shim for allowed dispatch and rejection before child I/O. This satisfies the MEMBER-authored PR’s scoped authority gate; no live pending merge is claimed. Existing-state compatibility is source-verified because asyncMerge is optional and legacy intents remain reconciliation-only.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured evidence exercises this head’s production polling path against the installed protected wrapper and the dependency’s built executable/shim for allowed dispatch and rejection before child I/O. This satisfies the MEMBER-authored PR’s scoped authority gate; no live pending merge is claimed. Existing-state compatibility is source-verified because asyncMerge is optional and legacy intents remain reconciliation-only.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded improvement to maintainer merge tooling.
  • merge-risk: 🚨 compatibility: Older protected wrappers intentionally refuse the new calls; that upgrade tradeoff is accepted, but the prerequisite correction remains unmerged.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured evidence exercises this head’s production polling path against the installed protected wrapper and the dependency’s built executable/shim for allowed dispatch and rejection before child I/O. This satisfies the MEMBER-authored PR’s scoped authority gate; no live pending merge is claimed. Existing-state compatibility is source-verified because asyncMerge is optional and legacy intents remain reconciliation-only.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured evidence exercises this head’s production polling path against the installed protected wrapper and the dependency’s built executable/shim for allowed dispatch and rejection before child I/O. This satisfies the MEMBER-authored PR’s scoped authority gate; no live pending merge is claimed. Existing-state compatibility is source-verified because asyncMerge is optional and legacy intents remain reconciliation-only.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head production hunks. The checkout is the original PR head, ca07a71; the supplied stale test merge was not used to infer removal of main behavior. (scripts/pr-lib/merge-rest.mjs:596, ca07a714938e)
  • Prior authority finding corrected: Both PUT submission and UUID GET pass through asyncMergeResponse, which inserts the mandatory guard immediately after api. GitHub’s verified corrective-commit patch also shows the matching documentation and ordering assertion. (scripts/pr-lib/merge-rest.mjs:603, ca07a714938e)
  • Retained-state compatibility: asyncMerge is optional in the existing version-1 outcome validator. New acknowledgments retain the UUID before polling, while older outcomes continue through reconciliation without a new submission. Completion still requires the authoritative PR receipt and reconstructed landed tree. (scripts/pr-lib/merge-outcome.sh:202, ca07a714938e)
  • Production-boundary evidence: The captured PR body reports this head’s actual merge-rest → execPrGh → PATH gh → installed Octopool polling path preserving marker-first ordering and refusing with zero child GitHub calls. Installed Octopool 0.6.4 reproduced the unsafe unguarded rewrite. The earlier live request returned the known commit for an already-merged PR; it proves the endpoint contract, not a new pending merge. (scripts/pr-lib/github.mjs:112, ca07a714938e)
  • Affirmative dependency contract: The target’s guard and proof explicitly depend on fix(rewrites): preserve async PR merge authority octopool#231. At f90f415f6abdaeba72299e61bed3be0d94f2a5b2, the dependency models async SHA, method, action and bypass fields structurally, snapshots commit text, and routes status reads through the native writer. (cmd/octopool/string_rewrites_api.go, f90f415f6abd)
  • Allowed and forbidden final-dispatch proof: The dependency body records the built executable and copied gh shim preserving an allowed file request and rejecting an anchored squash-to-rebase rule before child I/O. Inspected production-path coverage additionally checks SHA, action and bypass-field structural rejection, immutable snapshots, native polling and unsupported-fallback refusal. (cmd/octopool/string_rewrites_api_async_merge_test.go, f90f415f6abd)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

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 (4 earlier review cycles)
  • reviewed 2026-10-02T14:55:58.826Z sha e687585 :: needs changes before merge. :: none
  • reviewed 2026-10-02T15:04:24.678Z sha e687585 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-05T06:36:37.578Z sha 0d3f50e :: needs real behavior proof before merge. :: [P1] Preserve structural merge parameters through the protected wrapper
  • reviewed 2026-10-05T06:48:55.079Z sha 0d3f50e :: needs real behavior proof before merge. :: [P1] Preserve structural merge parameters through the protected wrapper

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. and removed 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. labels Oct 5, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Head ca07a71 requires the async structural guard before dispatch. Dependency fix and protected-wrapper allowed/rejection proof: openclaw/octopool#231 . The PR body includes the installed older-wrapper reproduction and actual OpenClaw-to-Octopool zero-child refusal proof.

@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 6, 2026
@vincentkoc
vincentkoc merged commit 38ed3ed into main Oct 6, 2026
140 checks passed
@vincentkoc
vincentkoc deleted the feat/github-async-merge-20261002 branch October 6, 2026 12:41
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 7, 2026
* feat(github): support asynchronous PR merges

* test(pr): align merge fixtures with current API contract

* fix(pr): require protected async merge authority
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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