Skip to content

fix(queue): recover publication claims after transient failures - #1389

Merged
vincentkoc merged 1 commit into
mainfrom
fix/publication-claim-retry
Sep 4, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/publication-claim-retry

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where a dispatched publication workflow could lose a claim response during a transient Worker or network failure, exit without a lease, and leave already-reserved publication work waiting for later recovery.

Why This Change Was Made

Dispatched claim requests now retry transient network, timeout, and HTTP 5xx failures up to three attempts within the existing 45-second request budget. Retries reuse the exact serialized body and signature.

The Worker rechecks for an already-created lease after asynchronous target admission and replays the complete existing-batch admission path. The batch store remains the single transactional owner, so the same batch ID and lease owner can create at most one lease.

Undispatched claims, completion requests, post-effects, workflow behavior, capacity, batch size, schema, and configuration remain unchanged.

User Impact

Maintainers should see fewer failed publication runs and less delayed backlog recovery when a claim succeeded server-side but its response was lost.

OpenClaw Bay Impact

Bay is unaffected. This changes only the signed internal claim transport and existing-batch replay path; public projections, fields, and observer behavior are unchanged.

Documentation Impact

Reviewed docs/live-dashboard.md. No documentation change is required because the public queue contract, operator controls, configuration, and projection fields are unchanged. The retry is bounded internal transport recovery for dispatched claims.

Evidence

  • Signed head: 3a5ba4d056590aab12747d7be03c8c81559bef97
  • Base: 72041f31e1d34cff19f50da4b23c4a22a78c828a
  • Scope: five files.
  • Production: +56/-43, net +13.
  • Tests: +237/-0.
  • build, build:repair, and build:dashboard: passed.
  • Focused suites: 306 passed, 0 failed:
    • test/repair/exact-review-batch-queue-client.test.ts
    • test/exact-review-publication-batches.test.ts
    • test/dashboard-worker-queue-runtime.test.ts
  • Targeted oxlint: passed.
  • Targeted oxfmt --check: passed.
  • check-active-surface, check-dashboard-queue-boundary, and check-dashboard-strict: passed.
  • git diff --check: passed.

Regression coverage includes:

  • a dispatched claim retries timeout and HTTP 500, then returns the lease with identical body and HMAC on every attempt;
  • HTTP 4xx claims remain single-attempt;
  • undispatched claims, completion, and post-effects remain single-attempt;
  • concurrent same-identity claims replay the first committed lease after asynchronous admission clears the reservation;
  • replay responses retain the original lease identity while allowing current main's per-response server_time to advance;
  • batch-store same-identity replay returns the original lease without extending or replacing it.

The broad local pnpm run check was not rerun. A previous attempt on this worktree hung in unrelated test infrastructure after about 11 minutes; this branch instead uses the focused owner-boundary suites and targeted static gates above. Hosted CI remains required.

Real Behavior Proof

Claim: the built queue client retries a transient dispatched-claim HTTP 500 while preserving the exact request identity, then accepts the returned lease.

Surface: Node 26.7.0 running dist/repair/exact-review-batch-queue-client.js against an ephemeral local HTTPS server. The server captured each received body and signature and returned HTTP 500 before a successful lease response.

Command: an inline Node ESM proof imported the built client, started an ephemeral loopback HTTPS server with a synthetic key and webhook secret, issued one dispatched claim, and asserted the received bytes, HMAC, attempt count, and returned batch identity.

Observed result:

{"result":"pass","attempts":2,"identical_body":true,"identical_signature":true,"claimed_batch":"proof-claim","server_time_preserved":true}

Limits: this proves the built client and real HTTPS request boundary locally, including current main's internal server_time response field. The Worker concurrency and SQLite lease replay are covered by the focused production-queue harness tests; this draft does not claim deployment or a live queue mutation.

No deployment, queue dispatch, cancellation, retry, capacity change, or other live operation was performed.

@vincentkoc
vincentkoc force-pushed the fix/publication-claim-retry branch from 9180e58 to 3a5ba4d Compare September 4, 2026 01:02
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement 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 Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 3, 2026, 9:13 PM ET / September 4, 2026, 01:13 UTC.

ClawSweeper review

What this changes

This PR retries dispatched signed publication-claim requests after transient failures and replays an already-created lease after concurrent admission work completes.

Merge readiness

✅ Ready for maintainer review

Keep this member-authored PR open for normal maintainer review. Current main does not contain its retry or post-admission lease-replay changes, and the introduced patch is a focused, plausibly correct repair with targeted coverage.

Priority: P2
Reviewed head: 3a5ba4d056590aab12747d7be03c8c81559bef97

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused queue reliability repair with direct regression coverage and no concrete correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply; the PR body nevertheless records a built-client local HTTPS trace for the changed retry boundary and states its deployment limits.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply; the PR body nevertheless records a built-client local HTTPS trace for the changed retry boundary and states its deployment limits.
Evidence reviewed 5 items PR-introduced implementation: The introduced client path serializes and signs the dispatched claim once, then gives only dispatched claims the existing bounded retry deadline; it preserves the same claim identity across attempts.
Concurrent-claim recovery: After asynchronous admission, the queue now refetches the lease for the same claim identity and uses the full existing-batch replay path, avoiding a second claim attempt after another concurrent request created the lease.
Focused regression coverage: The added tests cover timeout/HTTP-500 retries with unchanged signed bytes, no retry on 4xx or undispatched requests, exact lease replay, and concurrent admission replay.
Findings None None.
Security None None.

How this fits together

The exact-review publication queue turns dispatched workflow claims into leased batches of review artifacts for publication. The queue client submits signed claims, the Worker rechecks target visibility, and the resulting lease is consumed by the publication runner.

flowchart LR
  A[Publication workflow] --> B[Signed claim client]
  B --> C[Queue claim endpoint]
  C --> D[Target admission check]
  D --> E[Durable batch lease]
  E --> F[Publication runner]
  B -->|transient failure| B
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and regression scope 2 production files changed; 3 test files +237 lines The production change is narrow and the added coverage directly exercises retry identity and concurrent lease replay.

Technical review

Best possible solution:

Retain the bounded, byte-identical retry and durable lease replay so transient response loss recovers without changing batch identity or broadening publication behavior.

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

Yes—current-main source makes dispatched claims single-attempt, and the focused fixtures deterministically exercise the timeout and HTTP-500 path that the patch changes.

Is this the best way to solve the issue?

Yes—the repair reuses the existing signed request, bounded retry transport, durable batch identity, and target-admission rules instead of adding a parallel recovery mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8440386ebd92.

Labels

Label changes:

  • add P2: This is a bounded reliability repair for delayed exact-review publication recovery, without evidence of a current user-facing outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply; the PR body nevertheless records a built-client local HTTPS trace for the changed retry boundary and states its deployment limits.

Label justifications:

  • P2: This is a bounded reliability repair for delayed exact-review publication recovery, without evidence of a current user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply; the PR body nevertheless records a built-client local HTTPS trace for the changed retry boundary and states its deployment limits.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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.

@vincentkoc
vincentkoc marked this pull request as ready for review September 4, 2026 01:16
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc
vincentkoc merged commit 8868550 into main Sep 4, 2026
25 of 28 checks passed
@vincentkoc
vincentkoc deleted the fix/publication-claim-retry branch September 4, 2026 01:16
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. 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