Skip to content

fix(queue): retry control-plane calls through deploy-length outages - #1955

Merged
steipete merged 2 commits into
mainfrom
fix/control-plane-outage-retries
Oct 13, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/control-plane-outage-retries

Conversation

@steipete

@steipete steipete commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Completed Codex reviews are being thrown away because the workflow's control-plane retry gives up before a short queue outage ends.

On 2026-10-13 the exact-review Durable Object answered HTTP 500 for 15–30 seconds three times within an hour: 03:54:45–03:55:05, 04:21:36–04:22:05, and 04:52:52–04:53:08, the last during a Worker deploy (Cloudflare deployment records at 04:52:54 and 04:53:08). control_plane_curl retries 5xx only four times with 2/4/8-second waits, so it gives up about 14 seconds in. In those windows:

14 of the 29 failed exact-review runs in that three-hour window fell into these three bursts: 10 classified queue_completion_failure, and 4 that finished their review (review_outcome=success, exit 0) but were classified codex_or_content_failure because the direct-publication lifecycle post exhausted the same helper. In https://github.com/openclaw/clawsweeper/actions/runs/38347798743 that post's first attempt hung for its 20-second timeout at 04:52:42, attempts 2–4 got 500 until 04:53:17, and the queue still answered 500 at 04:53:32, so the deploy outage lasted about 50 seconds. That is why the new budget is about a minute, not 30 seconds.

Change

scripts/control-plane-curl.sh now allows up to six attempts within a 62-second backoff budget (2, 4, 8, 16, 32). A Retry-After delay (still capped at 60 seconds) replaces the next wait and draws from the same budget, and the next failure after the budget is spent is final, so the worst case stays bounded even when the queue keeps answering 503 with Retry-After. 4xx stays terminal; curl's exit code, stdout, output file and body handling are unchanged. Every caller already retried these lease-fenced requests three times, so idempotency is unchanged.

Heartbeats keep their behavior: a failed heartbeat is still non-fatal and the loop still sleeps 60 seconds, but a retry now lands about 30 seconds into an outage instead of the next 74-second cycle. The 20-minute EXACT_REVIEW_HEARTBEAT_GRACE_MS leaves ample room.

docs/scheduler.md documents the new contract; changelog.d/control-plane-outage-retries.md records it.

Behavior proof

  • Claim: a control-plane call survives a 15–30 second queue outage and still gives up within about a minute when the queue is down for longer.
  • Surface: the real control_plane_curl helper with real curl and real sleep, against a local HTTP server that answers 500 until a deadline and 200 afterwards.
  • Command: node run-proof.mjs <helper.sh> <outage-seconds> <label>, run against main (7a6def5328) and this branch. macOS, bash 5.3, curl 8.
Helper Outage Attempts (seconds after start) Result
main 20 s 0.1, 2.3, 6.4, 14.5 500, review lost
this branch 20 s 0.1, 2.3, 6.4, 14.5, 30.6 200
this branch 32 s 0.1, 2.2, 6.3, 14.5, 30.6, 62.8 200
this branch 120 s 0.1, 2.2, 6.3, 14.4, 30.6, 62.9 500 after 62.9 s (bounded)
  • Limits: the outage is simulated as plain HTTP 500s. The real Worker/Durable Object failure mode during a reset may differ (for example connection errors), but the helper already treats those curl exits as retryable. The root cause of the two non-deploy outages is not identified here; the available Cloudflare token cannot read Workers Observability logs.

Validation

  • test/control-plane-curl.test.ts: 14/14 on macOS (bash 5.3) and in node:24-bookworm (bash 5.2, curl 7.88). New scenarios cover a deploy-length outage that recovers on the fifth attempt and Retry-After draining the shared budget. Against main's helper the deploy-length scenario fails.
  • Helper consumers: update-command-status, exact-review-queue-client, exact-review-reconcile-workflow, workflow-sparse-checkout, sweep-workflow: 190/190 after build:all.
  • The Linux-only scripts/e2e/exact-review-start-authority.mjs pinned four requests for its service and transport failure scenarios, and its transport scenario would now outrun the 45-second scenario timer under real backoff. It expects six attempts, and its private helper copy skips backoff waits (guarded by an assertion), so test/control-plane-curl.test.ts keeps owning retry timing. In node:24-bookworm all Linux-only tests pass (exact-review-start-authority in 8.9 s, hosted-review-canary-proof, command-runner, apply-drift-refresh): 119 passed, 6 skipped by design.
  • pnpm run check:static and git diff --check pass.
  • Codex /review (autoreview, P0–P2): clean on the uncommitted change and on the committed branch against its merge-base.

OpenClaw Bay

Not affected. No status, lifecycle, telemetry or projection contract changes; only the workflow-side retry timing of control-plane requests.

The exact-review Durable Object answers HTTP 500 for 15-30 seconds during a Worker deploy or reset (2026-10-13 03:54, 04:21 and the 04:52 deploy). control_plane_curl gave up after four attempts and about 14 seconds, so completed Codex reviews failed finalization or completion and were discarded. Allow up to six attempts within a 62-second backoff budget, with Retry-After waits drawn from the same budget so the worst case stays bounded.
@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T06:58:08.002011Z d0b26fb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The Linux-only startup-authority e2e pinned four requests for its service and transport failure scenarios. With the 62-second budget, its transport scenario would also outrun the 45-second scenario timer, so its private helper copy now skips backoff waits; test/control-plane-curl.test.ts keeps owning retry timing.
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Current proof and validation for head 37fe7ca are in the PR body.

@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. 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. labels Oct 13, 2026
@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR extends shared control-plane retries to six attempts with a 62-second total backoff budget and updates documentation and coverage.

Example: The control plane returns HTTP 500 for 20 seconds before recovering.

  • Before: The fourth attempt fails at about 14.5 seconds, preventing review finalization.
  • After: The fifth attempt succeeds at about 30.6 seconds.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused, and supported by real transport recovery traces and successful exact-head validation; no actionable patch defect was found.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The current-head PR body supplies measured request timings from the real production helper, curl, and sleep against a local HTTP server on macOS: recovery after 20- and 32-second outages, plus bounded exhaustion during a 120-second outage. This exercises the changed transport retry owner; it does not prove deployed Worker recovery or identify non-deploy outage causes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Completed reviews are discarded when transient control-plane outages outlast the workflow retry window.
Reason: The maintainer-authored direction addresses documented lost review work with a small shared-helper change, without new configuration, protocol, storage, or Bay contracts.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: current main still exhausts retries during the documented outage windows, and this narrow change addresses that failure without an actionable correctness finding.

Priority: P1
Reviewed head: 37fe7caae9957ec22a788de30c50a259121fefc2

Before merge

None.

Findings

None.

Agent review details

How this fits together

Workflow shell steps send queue, heartbeat, completion, and lifecycle requests through the shared curl helper, which returns the final response to existing lease-aware callers.

flowchart LR
  A[Workflow step] --> B[Shared curl helper]
  B --> C[Control plane]
  C --> D[Queue lease checks]
  C --> E[Response or transport failure]
  E --> B
  B --> F[Final response to caller]
Loading

Technical review

Best possible solution:

Retain the shared bounded retry owner and adopt the longer backoff budget while preserving existing response and lease-rejection semantics.

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

Current-main source exhausts four attempts after 14 seconds of fallback backoff, and the supplied real-HTTP baseline trace demonstrates failure during a 20-second outage; this review executed no target code.

Is this the best way to solve the issue?

The change addresses insufficient transient-failure tolerance in the existing shared owner, with a finite attempt limit and shared Retry-After budget; diagnosing longer queue overloads remains separate work.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Exact introduced change: The pinned introduction diff changes only the shared retry budget, its documentation and fragment, and focused test fixtures. (scripts/control-plane-curl.sh:10, 37fe7caae995)
  • Current main still has the shorter retry window: Fetched main retains four attempts and the original 2/4/8-second fallback waits. (scripts/control-plane-curl.sh:9, dc9730979277)
  • Supplied real-transport proof: The complete PR body records real curl and sleep against deadline-based loopback HTTP failures on macOS: main fails during a 20-second outage; the candidate recovers from 20- and 32-second outages and terminates after 62.9 seconds during a 120-second outage. The maintainer's re-review comment identifies this proof as current for the reviewed head. (37fe7caae995)
  • Existing retry and bootstrap intent: fix(queue): retry control-plane 5xx and propagate retryable admission failures (re-land) #1503 established bounded transient retries and preserved response semantics while repairing sparse-checkout bootstrap failures; this PR retains that architecture. (scripts/control-plane-curl.sh:5, 31fc0b87393b)
  • Lease rejection remains terminal: The helper still treats 4xx as terminal; workflow startup and finalization retain their 409 handling, and queue heartbeat handling checks current lease identity and liveness before updating state. (.github/workflows/sweep.yml:941, 37fe7caae995)
  • Exact-head validation: The reviewed head has successful pnpm check, coverage, test shards, network smoke, Windows launcher, and CodeQL checks; cancelled admission jobs have successful counterparts on the same head and establish no diff-caused failure. (37fe7caae995)

Likely related people:

  • Peter Steinberger: Raw commit 31fc0b8 adds scripts/control-plane-curl.sh:5 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 31fc0b87393b; files: scripts/control-plane-curl.sh)
  • Ayaan Zaidi: Raw commit 2ad1cdb adds scripts/control-plane-curl.sh:51 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2ad1cdb75a20; files: scripts/control-plane-curl.sh)

Labels

Label changes:

  • add P1: Documented short control-plane outages discard completed reviews and break finalization and completion workflows.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • 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.

Label justifications:

  • P1: Documented short control-plane outages discard completed reviews and break finalization and completion workflows.
  • 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.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 13, 2026, 4:06 AM ET / 08:06 UTC.

@steipete
steipete merged commit bd129c3 into main Oct 13, 2026
29 of 32 checks passed
@steipete
steipete deleted the fix/control-plane-outage-retries branch October 13, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 Urgent regression or broken agent/channel workflow affecting real users now. 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