fix(state): retry transient invalid 2xx bodies in worker record requests - #969
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 30, 2026, 2:29 PM ET / 18:29 UTC. ClawSweeper reviewWhat this changesRetries Worker record POST requests after a transient invalid 2xx response body and expands the request tests for persistent and recovering malformed-success responses. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 6 items remain Keep this PR open: it addresses a real worker-record hydration failure, but the new outer retry loop can combine with Priority: P1 Review scores
Verification
How this fits togetherClawSweeper's Worker-record client sends signed requests from review and apply automation to the canonical record store. flowchart LR
A[Review and apply jobs] --> B[Worker record client]
B --> C[Signed POST request]
C --> D[Canonical Worker store]
D --> E[HTTP response body]
E --> F{Valid JSON object?}
F -->|Yes| G[Hydration and state operations]
F -->|No| H[Bounded retry or request error]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one shared retry counter and backoff budget across malformed-2xx, 5xx, and network failures, remove the release-owned changelog edit, then attach a redacted live or integration-style recovery transcript showing the request succeeds after one invalid 2xx body. Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction is included for the after-fix behavior. The mocked request test path is clear from source, and the PR body reports a real blank-200 failure, but it does not show a real recovery run on the current change. Is this the best way to solve the issue? No. Retrying invalid bodies is a reasonable direction, but the retry must share the existing Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b4d1edea05cc. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Problem
Run 30569173886 failed hydration with
WorkerRecordRequestError: Worker record request failed (200): invalid_json_body— the edge transiently served a blank 200. #888 made this fail loudly (correct — better than crashing callers far from the request), but a single transient blank body still kills the whole review run.Fix
signedPostnow retries invalid 2xx bodies within the existingSIGNED_REQUEST_MAX_ATTEMPTSbudget (3 attempts, exponential backoff), throwing the sameinvalid_json_bodyerror with body snippet if the condition persists. 4xx behavior unchanged (deterministic, no retry); 5xx/network retry behavior unchanged.Proof