Skip to content

fix(queue): retry control-plane 5xx and propagate retryable admission failures (re-land) - #1503

Merged
steipete merged 3 commits into
mainfrom
queue/retryable-control-plane-calls-v2
Sep 8, 2026
Merged

steipete merged 3 commits into
mainfrom
queue/retryable-control-plane-calls-v2

Conversation

@steipete

@steipete steipete commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Related: #1497

Additional instructions

This branch is in the same repository, so maintainers edit it through repository write permissions. GitHub rejects its fork-only “Allow edits from maintainers” toggle for same-repository PRs. This PR is prepared for maintainer review; merging and automerge are not authorized by this work order.

What Problem This Solves

Resolves a problem where exact-review workflows fail on transient control-plane errors or lose the structured retryable admission response. Restores the retry fix while keeping local setup actions available when a job reaches its full checkout.

Why This Change Was Made

All shell control-plane calls in sweep, run reconciliation, and dead-letter health reconciliation use the shared bounded retry helper. The Worker preserves structured retryable 5xx responses and Retry-After through webhook and internal admission, and failed fences/reservations retain their queue-infrastructure classification.

Why the first landing was reverted: #1497 added helper-only sparse checkouts before full source checkouts. The early checkout left core.sparseCheckout=true and the single-file sparse definition in the shared workspace; the later checkout inherited it and omitted .github/actions/setup-pnpm/action.yml. This caused the local action lookup failures in run 34246655629 and run 34246581768.

Every helper-only sparse checkout is replaced with curl -fsSL --retry 3 from the public repository at GITHUB_SHA into RUNNER_TEMP. The bootstrap requires a nonempty file and a defined control_plane_curl function. Pre-checkout callers source that temporary copy; callers after full checkout source the repository copy. No bootstrap modifies Git configuration.

User Impact

Transient infrastructure failures receive bounded retries and preserve their final response semantics. Retryable visibility admission remains retryable, and exact-review jobs can reach the local package setup action after claiming work.

OpenClaw Bay Impact

No Bay code or contract change is needed. The existing queue-infrastructure failure category is preserved, and no observer field, route, lifecycle shape, or browser behavior changes. Bay remains an observer-only surface with no new controls.

Documentation Impact

Updated active docs/scheduler.md with the retry contract and commit-pinned helper bootstrap, and active docs/live-dashboard.md with structured retryable admission response handling. Their ClawSweeper maintainer ownership, workflow/Worker sources of truth, and update triggers remain applicable; verification scope is this PR's implementation and executed local proofs. The Unreleased changelog records both retry behavior and the checkout correction.

Finding disposition

The first ClawSweeper review identified a real checkout-free completion defect: direct-lifecycle recovery skips the publisher checkout, but completion still required its repository helper. The follow-up binds review completion, publication completion, and terminal retry to the actual source-checkout outcome. Successful checkout uses the repository helper; skipped, failed, or cancelled checkout uses the already validated temporary helper. Existing lease/admission guards are unchanged. Other always-run helper consumers require successful post-checkout fence, review, upload, or status outputs before they can run.

The new scripts/e2e/control-plane-checkout-cleanup.mjs driver executes all three cleanup paths over real loopback HTTP with successful, skipped, and failed checkout fixtures. The failed-checkout fixture contains a poisoned repository helper, and the successful-checkout fixture contains a poisoned temporary helper. All nine cases choose the intended source and submit one request; publication completion preserves direct_lifecycle_requeue: true and the requeue disposition without checkout. This addresses the source finding and both related merge-risk/rank-up requests.

Evidence

  • Checkout audit rejects any sparse actions/checkout@ step preceding another checkout in the same job, across all workflows. A reverted-shape fixture proves the audit rejects the original sequence.
  • Every sweep setup-pnpm consumer requires a preceding full checkout at its local action path, including the nested source checkout. Existing intentional single sparse repair checkouts retain their dependency audits.
  • Executed bootstrap failure tests cover failed downloads, empty files, missing functions, and a valid helper.
  • Original focused changed-behavior suite: 200 passed, 0 failed. Cleanup follow-up suite: 171 passed, 0 failed, including the nine real HTTP cleanup scenarios. The six reconciliation tests also passed independently after selecting the request step explicitly. The corrected apply-drift workflow proof passed independently in 4.2 seconds after receiving its temporary helper.
  • The existing CI pnpm check path includes test/sweep-workflow.test.ts and test/repair/workflow-sparse-checkout.test.ts through the all-tests runner.
  • Pre-commit Codex review: autoreview scoped-clean: no accepted/actionable findings in the selected Git scope and priority.

Real Behavior Proof

Claim: The retry helper bootstrap cannot leave the workspace sparse, while transient control-plane retries and structured retryable admission responses remain intact.

Surface: Actual bootstrap shell extracted from workflow YAML; real Git configuration, index and worktree; curl over loopback HTTP; production Worker and queue code in local workerd with SQLite Durable Objects.

Scenario / fixture: The reverted sparse-first checkout followed by clean/reset/fetch/checkout in one temporary clone; every new bootstrap followed by a full checkout; 503/503/200 and 400 HTTP responses; signed synthetic admission requests returning retryable visibility failures or unexpected exceptions.

Command and environment: Executed at head c96bd996e1c15d18fc5237a6138403b6c4ef1ebf on macOS, Node 24.20.0, corepack pnpm 11.10.0, local Git shell and Wrangler 4.107.0/workerd. act is unavailable. Commands: node scripts/e2e/control-plane-checkout.mjs, node scripts/e2e/control-plane-checkout-cleanup.mjs, and node scripts/e2e/control-plane-retries.mjs. All three passed on this committed head. The checkout driver downloaded from the published current-head raw URL and verified byte equality with the repository helper; SHA-256 2f9ab7096aa98b6d327242f7b5483a2c301ab69cf7ff640fc9b8532ea08bff92. The pre-publication proof also passed using the byte-identical helper from the reverted commit.

Observed result: All six actual bootstrap steps passed: sweep legacy intake, review/apply, publication, terminal finalization, bounded recovery, and reusable run reconciliation. The old shape leaves core.sparseCheckout=true and setup-pnpm/action.yml missing. The new bootstrap preserves the entire local Git configuration, and the full checkout materializes action.yml. The helper retries 503 twice then returns HTTP 200 and the final body; 400 produces one request. Both webhook and internal ingress return 503 {error: "target_visibility_unverified", retryable: true} with Retry-After: 30; unexpected exceptions remain 500 without Retry-After. Structured server-response telemetry is present.

Artifact / trace: Reproducible drivers are committed at scripts/e2e/control-plane-checkout.mjs, scripts/e2e/control-plane-checkout-cleanup.mjs, and scripts/e2e/control-plane-retries.mjs. Local transcripts are .artifacts/control-plane-checkout-proof.txt and .artifacts/control-plane-proof/transcript.txt; the latter driver also records workerd.log. The cleanup driver also emits a nine-case JSON transcript, including the actual completion/retry endpoints, selected helper source, and requeue flag. The main-body results above summarize the executed assertions.

Limits: The checkout proof simulates the relevant Git action sequence rather than running act or the full hosted sweep job. The Worker proof uses synthetic local admission fixtures and makes no production queue or GitHub mutation calls; it does not prove deployed Cloudflare behavior. Raw helper downloads are the checkout proof's only external requests.

Known Gaps

The preliminary local full check reported 5,645 passed, 13 skipped, and five failures. Its apply-drift bootstrap fixture was corrected and passed; the producer-run telemetry case, replacement-publication case, and both proof-consumer timeout cases subsequently passed isolated rechecks without implementation changes. The unit rerun had 4,017 passes, six skips, and the same pre-correction apply-drift failure. These preliminary runs are not claimed green; the final-tree full check subsequently completed all 5,663 tests with 5,650 passes, zero failures, and 13 skips, but exited 1 because Node found an empty child-process coverage file. The cleanup follow-up is checked again; hosted CI establishes the complete current coverage result. Current-head ClawSweeper review is checked separately before the maintainer handoff. No live sweep, apply, close, deployment, merge, or automerge is performed by this work order.

… failures (re-land)

Re-land the retry and structured admission failure behavior from reverted PR
#1497. The original early helper-only
sparse checkouts persisted sparse Git configuration into subsequent full
checkouts, omitting the local setup-pnpm action.

Fetch the helper at the workflow commit into RUNNER_TEMP before source checkout,
validate the download and function, and use the repository copy after full
checkout. Audit checkout ordering across workflows and full source checkout
before sweep setup-pnpm, with executable bootstrap failure coverage and a real
Git old/new checkout reproduction.
@clawsweeper

clawsweeper Bot commented Sep 8, 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.

@steipete
steipete marked this pull request as ready for review September 8, 2026 16:35
@steipete
steipete requested a review from a team as a code owner September 8, 2026 16:35
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. proof: sufficient Contributor real behavior proof is sufficient. 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 Sep 8, 2026
@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 8, 2026, 12:59 PM ET / 16:59 UTC (Revision 2).

ClawSweeper review

What this changes

Adds bounded retries for workflow control-plane requests, preserves retryable admission responses, and keeps lease cleanup working when source checkout is skipped or fails.

Merge readiness

✅ Ready for maintainer review

The retry behavior remains absent from current main after the earlier revert, so this PR is still useful. The prior cleanup finding and both follow-up requests are addressed; no remaining blocking defect was found.

Priority: P2
Reviewed head: c96bd996e1c15d18fc5237a6138403b6c4ef1ebf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused reliability repair with convincing current-head behavior proof and no remaining actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The captured current-head results and inspected drivers connect actual workflow shells and curl to loopback recovery, Git checkout behavior, and production Worker admission in local workerd; nine cleanup cases also address the prior finding. Hosted deployment behavior remains outside the stated proof scope.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured current-head results and inspected drivers connect actual workflow shells and curl to loopback recovery, Git checkout behavior, and production Worker admission in local workerd; nine cleanup cases also address the prior finding. Hosted deployment behavior remains outside the stated proof scope.
Evidence reviewed 8 items Repository policy: Read the complete root policy and checked for nested policies and maintainer notes; no additional applicable files were found. Applied the proof, review continuity, conservative automation, and Bay impact guidance.
Still needed on current main: At fetched main 3bd2ac5, the shared helper is absent and enqueueExactReview still consumes the response and throws for non-success admission. The supplied merged records identify the original landing at #1497 and its subsequent revert at #1498. The latest supplied release v0.3.0 also lacks the helper.
Prior finding resolved: The current cleanup steps select the repository helper only after successful source checkout and otherwise select the bootstrapped temporary helper. GitHub's commit delta against the previously reviewed parent confirms this repair in review completion, publication completion, and terminal retry.
Findings None None.
Security None None.

How this fits together

ClawSweeper workflows ask the Worker’s durable queue to admit, claim, and complete review work. This change handles transient failures between those workflows and the queue while preserving admission and lease checks.

flowchart TD
  A[GitHub events and workflows] --> B[Load commit-pinned helper]
  B --> C[Control-plane request]
  C --> D[Worker and durable queue]
  D --> E{Response type}
  E -->|Transient failure| F[Bounded retry]
  F --> C
  E -->|Success or terminal response| G[Continue or finish review work]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and validation growth Production net +86 lines; tests and proof drivers net +844 lines Production growth centralizes shell retries and response propagation; most added code validates transport and checkout behavior.
Cleanup coverage 3 cleanup paths × 3 checkout outcomes = 9 scenarios The current proof directly covers the earlier finding and failed-checkout follow-up.

Root-cause cluster

Relationship: canonical
Canonical: #1503
Summary: This is the corrected re-land of the reverted retry work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep retries centralized and bounded, preserve queue admission responses, and make claimed-lease cleanup independent of checkout success.

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

Yes: current-main source shows structured admission failures becoming exceptions, and the supplied production-path proof exercises transient HTTP failures and checkout-dependent cleanup. This review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes: one bounded shell helper and a narrow Worker response-preservation change fit the existing architecture, while the checkout-outcome repair resolves the previous review without changing lease policy.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded reliability improvement for transient queue failures, with the previously identified checkout defect repaired.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 current-head results and inspected drivers connect actual workflow shells and curl to loopback recovery, Git checkout behavior, and production Worker admission in local workerd; nine cleanup cases also address the prior finding. Hosted deployment behavior remains outside the stated proof scope.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured current-head results and inspected drivers connect actual workflow shells and curl to loopback recovery, Git checkout behavior, and production Worker admission in local workerd; nine cleanup cases also address the prior finding. Hosted deployment behavior remains outside the stated proof scope.

Evidence

What I checked:

  • Repository policy: Read the complete root policy and checked for nested policies and maintainer notes; no additional applicable files were found. Applied the proof, review continuity, conservative automation, and Bay impact guidance. (AGENTS.md:1, c96bd996e1c1)
  • Still needed on current main: At fetched main 3bd2ac5, the shared helper is absent and enqueueExactReview still consumes the response and throws for non-success admission. The supplied merged records identify the original landing at fix(queue): retry control-plane 5xx and propagate retryable admission failures #1497 and its subsequent revert at revert: retry control-plane 5xx and propagate retryable admission failures (#1497) #1498. The latest supplied release v0.3.0 also lacks the helper. (dashboard/worker.ts:7186, 3bd2ac52dc70)
  • Prior finding resolved: The current cleanup steps select the repository helper only after successful source checkout and otherwise select the bootstrapped temporary helper. GitHub's commit delta against the previously reviewed parent confirms this repair in review completion, publication completion, and terminal retry. (.github/workflows/sweep.yml:3665, c96bd996e1c1)
  • Current-head behavior proof: The captured PR body, source revision 8b3c9c4c6f73cf52c8124ccbc9c2260814458b5c66f8f65cbea225dd9dbfe55d, reports all three drivers passing at the reviewed head on macOS with Node 24.20.0 and local workerd. Inspected the drivers: real curl recovers from 503/503/200; 400 receives one request; production Worker ingress preserves admission 503 JSON and Retry-After; six extracted bootstrap steps preserve Git configuration; nine cleanup cases exercise successful, skipped, and failed checkout, including poisoned unused helpers. These are local production-path observations, not a hosted Actions or deployed Cloudflare run. (scripts/e2e/control-plane-checkout-cleanup.mjs:14, c96bd996e1c1)
  • Admission and retry boundaries: The helper retries selected transport failures and 5xx responses at most four times while retaining terminal 4xx handling. Worker response propagation leaves admission ahead of delivery persistence; queue claims continue checking live leases and hosted-target admission. No new authorization, persistence format, or credential scope is introduced. (scripts/control-plane-curl.sh:5, c96bd996e1c1)
  • Bay and documentation contract: The body explicitly explains that Bay needs no change because the existing infrastructure failure category is preserved without changing observer fields or controls. Scheduler and dashboard documentation describe the bounded retries, checkout-independent cleanup, and preserved admission response. (docs/scheduler.md:70, c96bd996e1c1)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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 (1 earlier review cycle)
  • reviewed 2026-09-08T16:41:00.102Z sha 57bf59e :: blocked before merge. :: [P1] [P1] Source the bootstrapped helper when completion skips checkout

Address the current ClawSweeper finding on
#1503: direct lifecycle recovery skips
source checkout, while claimed-lease completion must still reach the queue.

Bind review completion, publication completion, and terminal retry to the actual
checkout outcome. Use the repository helper after success and the already
validated temporary helper after skipped, failed, or cancelled checkout.
Preserve existing admission, lease, and requeue guards.

Exercise the extracted cleanup shells over loopback HTTP for nine successful,
skipped, and failed checkout scenarios, including a poisoned partial checkout
and checkout-free direct-lifecycle requeue.
@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 merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 8, 2026
@steipete
steipete merged commit 31fc0b8 into main Sep 8, 2026
27 of 29 checks passed
@steipete
steipete deleted the queue/retryable-control-plane-calls-v2 branch September 8, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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