Repository navigation
fix(dashboard): normalize exact-review queue failures - #1240
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 9:50 PM ET / August 27, 2026, 01:50 UTC. ClawSweeper reviewWhat this changesThe branch makes the dashboard Worker convert rejected or malformed 5xx ExactReviewQueue responses into sanitized JSON while preserving 4xx and valid JSON error responses. Merge readinessThe PR remains necessary: current main still forwards ExactReviewQueue failures directly, while this branch adds the missing Worker-side sanitized JSON boundary. The refreshed head has a focused implementation, supplied real Worker-to-Durable-Object recovery proof, and no actionable patch defect found. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe dashboard Worker authenticates and forwards internal exact-review requests to the SQLite-backed ExactReviewQueue Durable Object. Queue results feed automation callers and observer-only Bay projections; this change standardizes unexpected failure responses at that Worker boundary. flowchart LR
A[Signed exact-review caller] --> B[Dashboard Worker]
B --> C[Queue request bridge]
C --> D[ExactReviewQueue Durable Object]
D --> E{Response or rejection}
E --> F[Original 4xx or valid JSON 5xx]
E --> G[Sanitized JSON 5xx]
F --> H[Queue clients and Bay projections]
G --> H
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep Durable Object storage failures fail-closed and land the Worker-boundary normalization after ordinary maintainer approval of the shared 5xx response contract. Do we have a high-confidence way to reproduce the issue? Yes. The PR records an exact-head local Wrangler Worker and SQLite Durable Object run that injects the failing storage read, observes sanitized JSON 500, and confirms the next request recovers with 200. Is this the best way to solve the issue? Yes. Normalizing only at the Worker transport boundary preserves the Durable Object’s rejection and rollback behavior while giving callers the parseable redacted error contract they require. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a2641b27c403. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
…rable Object The exact-review Durable Object fetch handler had no error boundary, so any exception thrown by a route handler escaped to the Workers runtime and became a plain-text 500. Callers that parse the response body as JSON then failed with errors such as "returned invalid JSON (HTTP 500)", which is the shared root cause of two observed production failures: the batch publication fetch and the state-writer coordinator ticket recovery. Wrap the handler so a thrown exception is returned as a JSON 500 built with the existing json helper and sanitizedServerError, which redacts credentials. Intentional non-200 responses still pass through unchanged. The client-side status-before-parse ordering in the batch and coordinator callers is a separate follow-up and is not changed here.
dc76448 to
60b0278
Compare
|
Refreshed head 60b0278: rebased onto current main (d616643) and replaced the memory-storage evidence with real Workers Durable Object boundary proof, item by item:
Both rank-up moves from the review are covered by the above. The regression tests run green through the repository runner on this head, and oxlint on the changed files is clean. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer rewrite completed at signed head The contributor's original commit and credit remain intact. The correction moves error normalization to the dashboard Worker so Hosted |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review The implementation and main-body proof remain on The proof remains the real local Wrangler Worker → SQLite Durable Object storage rejection, sanitized JSON 500, and successful next-request recovery, with the six transaction-rollback regression controls. This is host-local proof, not a production deployment or closure replay; OpenClaw Bay's observer contract is unchanged. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Squash-merged as 4a6f9ecb165e; verified on remote Landing gates matched head Bounded rerun caveat: the refreshed review's Live Verification wrapper remains FAIL / exit 1. Its first real Worker invocation emitted PASS for all five assertions (baseline 200, recovery 200, failure 500, JSON contract, token redaction); repeating the fixed output-directory command then correctly refused to overwrite existing proof output. This was an artifact collision, not a failed runtime boundary assertion; the collision-refusal guard is unchanged. Maintainer acceptance relies on the independently recorded exact-head proof and current sufficient-proof review, not a green wrapper. Proof is host-local macOS only; no deployed Cloudflare verification or live production replay/closure is claimed. |
What Problem This Solves
Fixes an issue where signed exact-review Worker callers could receive an unparseable 500 response when the ExactReviewQueue Durable Object rejected or returned a malformed server-error body.
Why This Change Was Made
The Durable Object remains fail closed: route and storage exceptions still reject directly, preserving SQLite and durable-storage rollback behavior. The dashboard Worker now owns the transport contract and converts rejected stub calls or malformed 5xx bodies into sanitized JSON while preserving intentional 4xx responses and already-valid JSON 5xx responses.
User Impact
Exact-review queue clients receive parseable, redacted JSON for unexpected queue failures without weakening queue transaction semantics.
OpenClaw Bay Impact
OpenClaw Bay is unaffected. Its queue projections already map non-OK responses to unavailable states; this change only makes the shared Worker-facing failure envelope parseable and sanitized.
Documentation Impact
The active proof harness under
docs/proof/exact-review-do-json-errors/now documents the Worker as the normalization owner and the Durable Object as the fail-closed transaction owner. No operator setup or public API documentation changes are required.Evidence
Current head:
0e6ef72c14bfbfe25d8a5ac247d95787563e82f5tsconfig.json,tsconfig.repair.json, andtsconfig.dashboard.jsonpassed.git diff --checkpassed.dashboard/proof-entry-do-error.tsanddashboard/wrangler.proof.tomlsentinels caused an immediate refusal and remained unchanged.Real Behavior Proof
Claim: a real Worker-to-Durable-Object storage rejection crosses the Worker boundary as sanitized JSON, while the Durable Object still rejects and a following request recovers.
Surface: local Wrangler dashboard Worker, ExactReviewQueue Durable Object, HMAC-authenticated
/internal/exact-review/publications/list, and SQLite-backed Durable Object storage.Scenario: a proof-only wrapper arms one marked
SELECT item_key, item_jsoncall to throw an error containing a planted GitHub token. Baseline and recovery requests use the unmodified production route.Command and environment:
Run on macOS with Node 26.7.0 and Wrangler 4.107.0 against exact head
0e6ef72c14bfbfe25d8a5ac247d95787563e82f5.Observed result:
Before evidence: on base
d61664303d1bcab286362c8386cc2b5cb77e2c7f, the same marked request escaped the Worker as a non-JSON 500.Limits: the Docker-backed Crabbox rerun was unavailable because the local Docker daemon was stopped. The exact-head proof above used the same committed Wrangler harness directly on the host. It proves the Worker/DO failure contract and recovery path, not a deployed Cloudflare revision.