Repository navigation
fix(queue): retry control-plane 5xx and propagate retryable admission failures (re-land) - #1503
Conversation
… 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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 8, 2026, 12:59 PM ET / 16:59 UTC (Revision 2). ClawSweeper reviewWhat this changesAdds 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 Review scores
Verification
How this fits togetherClawSweeper 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]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
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.
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=trueand 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 3from the public repository atGITHUB_SHAintoRUNNER_TEMP. The bootstrap requires a nonempty file and a definedcontrol_plane_curlfunction. 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.mdwith the retry contract and commit-pinned helper bootstrap, and activedocs/live-dashboard.mdwith 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-checkoutoutcome. 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.mjsdriver 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 preservesdirect_lifecycle_requeue: trueand the requeue disposition without checkout. This addresses the source finding and both related merge-risk/rank-up requests.Evidence
actions/checkout@step preceding another checkout in the same job, across all workflows. A reverted-shape fixture proves the audit rejects the original sequence.setup-pnpmconsumer 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.pnpm checkpath includestest/sweep-workflow.test.tsandtest/repair/workflow-sparse-checkout.test.tsthrough the all-tests runner.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
c96bd996e1c15d18fc5237a6138403b6c4ef1ebfon macOS, Node 24.20.0, corepack pnpm 11.10.0, local Git shell and Wrangler 4.107.0/workerd.actis unavailable. Commands:node scripts/e2e/control-plane-checkout.mjs,node scripts/e2e/control-plane-checkout-cleanup.mjs, andnode 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-2562f9ab7096aa98b6d327242f7b5483a2c301ab69cf7ff640fc9b8532ea08bff92. 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=trueandsetup-pnpm/action.ymlmissing. The new bootstrap preserves the entire local Git configuration, and the full checkout materializesaction.yml. The helper retries 503 twice then returns HTTP 200 and the final body; 400 produces one request. Both webhook and internal ingress return503 {error: "target_visibility_unverified", retryable: true}withRetry-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, andscripts/e2e/control-plane-retries.mjs. Local transcripts are.artifacts/control-plane-checkout-proof.txtand.artifacts/control-plane-proof/transcript.txt; the latter driver also recordsworkerd.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
actor 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.