Repository navigation
fix(observability): retain queue failure source locations - #1319
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 4:12 AM ET / 08:12 UTC. ClawSweeper reviewWhat this changesThe PR adds sanitized Durable Object logs containing a failure phase and deployed-bundle source coordinates while preserving the fixed public queue-error response. Merge readiness✅ Ready for maintainer review Keep open: this diagnostic behavior is not on current main. The prior double-logging concern is resolved by the supplied same-head native workerd trace, which shows one correctly phased initialization event after deferred initialization fails; no blocking defect was found in the introduced patch. Priority: P2 Review scores
Verification
How this fits togetherThe exact-review queue is a Cloudflare Durable Object behind the Worker’s internal review-publication routes. Requests enter through the Worker, the queue initializes and reads durable storage, and failures return a fixed unavailable response while operator logs retain diagnostics. flowchart LR
A[Internal review request] --> B[Worker route]
B --> C[Exact-review queue]
C --> D[Initialization and storage]
D --> E[Sanitized failure log]
E --> F[Fixed unavailable response]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Land the sanitized in-Durable-Object diagnostic event so operators can map queue faults to the matching deployed bundle without exposing error text or changing client recovery behavior. Do we have a high-confidence way to reproduce the issue? Yes. The supplied workerd trace runs the signed Worker-to-Durable-Object SQLite route against the base and candidate revisions, injects the relevant failure, and records the changed log and unchanged response behavior. Is this the best way to solve the issue? Yes. Capturing a tightly constrained numeric location before remote transport replaces the stack is the narrowest solution and preserves the existing Worker response boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 62241350beef. LabelsLabel changes:
Label 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)
|
|
@clawsweeper re-review The main PR body now contains an executed native workerd proof for the reported deferred-initialization case, on the unchanged current head. It asserts exactly one |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Landed as e3ebd2b. Validation: Repeated the native workerd/SQLite proof on merged main in Crabbox provider aws, lease The automatic Worker deployment passed, including live smoke: https://github.com/openclaw/clawsweeper/actions/runs/33372016381. The public health endpoint reports the merge SHA. This ships diagnostics only; the underlying intermittent queue failure is still being investigated. No live apply/close or queue-recovery mutation was performed. |
What Problem This Solves
Resolves a problem where operators investigating exact-review queue failures can see that a Durable Object threw, but cannot locate the original failure. The remote call replaces the originating stack before the outer Worker receives it.
Related: #1317
Why This Change Was Made
Record only the first numeric source coordinates inside the Durable Object, before rethrowing the original exception. Cover both initialization barriers and request handling. Keep the fixed public error response and existing retry policy. This is a diagnostic prerequisite; it does not claim to fix the underlying intermittent queue failure.
User Impact
Operators can map a failure to the matching deployed worker bundle. Error messages, SQL, paths, raw stacks, request payloads, and credentials are excluded from these application logs. Clients retain the same response and recovery behavior.
OpenClaw Bay Impact
Bay is unaffected: no queue, lifecycle, telemetry data contract, public response, or browser behavior changes. The new event is a server-only diagnostic log.
Documentation Impact
Updated the active
docs/live-dashboard.mdoperator runbook with the event shape and requirement to match coordinates to the exact deployment bundle. The Worker and queue implementation own this contract; changes to the log shape, module name, or bundling require the runbook to be updated. Added a changelog entry.Evidence
pnpm run checkpassed on Node 24.18.1: 4,152 unit tests passed, 8 skipped, plus all 13 static checks. The 11 focused tests passed. Codex precommit and committed-branch reviews found no actionable findings at their configured P0 scope.Real Behavior Proof
Claim and surface: the real Worker -> Durable Object -> SQLite failure path retains originating coordinates before remote transport replaces the stack, without changing the public failure or leaking error text.
Revision/environment: candidate
61e6308bac3e83dcd3808b712cace125fec7dea7, tested treed5b37aee2a51c962df0b4972e0c1680ce73745b2, compared with main62241350beef738542b4802c172c28d7a8013db7. Crabbox provider aws, leasecbx_500a9817fb0b, runrun_2c0cbab8167d, imageami-0461d919be7deb53c; Node 24.18.1, pnpm 11.10.0, Miniflare 4.20260701.0, workerd 1.20260701.1, esbuild 0.28.1. The instance had no instance role or production credentials.Scenario: bundle the actual Worker and queue into workerd with real SQLite Durable Objects. Send a signed publications-list POST, inject one native SQL failure on the next request, and retry the same request after that fault. Separately inject a native SQL failure in the constructor schema barrier. The fault contains a synthetic private marker. Only the fixture captures application log events into a response header for assertions.
Observed before: healthy 200 -> failure 500 -> recovery 200. Request and initialization failures expose only the outer
{remote:true,retryable:false,overloaded:false}flags; the original SQL location is absent.Observed after: the same 200 -> 500 -> 200 sequence and identical public
{error:"exact_review_queue_unavailable"}body. Each failure additionally logsexact_review_queue_handler_failed, phasefetchorinitialize, and[38412,44], exactly matching the injected native SQL line in the generated bundle. The outer flags remain intact. Assertions reject private marker text and private paths in application logs.Commands/artifact: the standalone reproducible driver and exact normalized trace are included below. Save the driver as
/tmp/clawsweeper-queue-locations-proof.mjs. Install the pinned fixture tools outside the repository, then run it from the relevant checkout:Limits: controlled native-runtime fault injection, not reproduction of the unknown production cause. No live queue mutation or apply/close action was performed. A stack without a matching deployed module frame logs
null. Production coordinates must be matched to that deployment's bundle, not the fixture's line numbers. This change does not add retries or alter alarm handling.Normalized before/after trace
{"phase":"before","faultLine":38388,"healthy":200,"failure":{"status":500,"body":{"error":"exact_review_queue_unavailable"},"logs":[["exact_review_queue_request_failed",{"remote":true,"retryable":false,"overloaded":false}]]},"recovery":200,"initialization":{"status":500,"body":{"error":"exact_review_queue_unavailable"},"logs":[["exact_review_queue_request_failed",{"remote":true,"retryable":false,"overloaded":false}]]}} {"phase":"after","faultLine":38412,"healthy":200,"failure":{"status":500,"body":{"error":"exact_review_queue_unavailable"},"logs":[["exact_review_queue_handler_failed",{"phase":"fetch","location":[38412,44]}],["exact_review_queue_request_failed",{"remote":true,"retryable":false,"overloaded":false}]]},"recovery":200,"initialization":{"status":500,"body":{"error":"exact_review_queue_unavailable"},"logs":[["exact_review_queue_handler_failed",{"phase":"initialize","location":[38412,44]}],["exact_review_queue_request_failed",{"remote":true,"retryable":false,"overloaded":false}]]}}Standalone native-runtime proof driver (includes deferred initialization)
Review Finding Disposition
The reported P2 duplicate initialization log was investigated on the exact candidate in real workerd, rather than treating a Promise-only test double as the Durable Object runtime. Rejected for the deployed path: a failure inside
blockConcurrencyWhileterminates/resets the object, so the surrounding request catch does not run. Cloudflare documents this reset behavior.The extended driver above adds
FaultingDeferredQueue: the constructor lifecycle schema barrier succeeds, then the first publications-list request fails native SQLite specifically atCREATE TABLE IF NOT EXISTS exact_review_queue_metainside deferred full initialization.verifyFailureasserts exactly one origin event, phaseinitialize, coordinates matching the actual injected SQL line, the unchanged public 500, the existing transport flags, and no private marker/path. This directly covers the missing scenario and both proposed Rank-up moves' underlying concern. No production error-deduplication state is needed. The lightweight direct-call unit harness does not implement platform reset semantics, so it is not the oracle for this lifecycle claim.The constructor, deferred initialization, request fault, and recovery cases were rerun together on unchanged head
61e6308bac3e83dcd3808b712cace125fec7dea7in AWS leasecbx_500a9817fb0b, runrun_ef8740eb29bd, with the same pinned environment. No source changed after the two Codex autoreviews or full check. Current CI passed: https://github.com/openclaw/clawsweeper/actions/runs/33370859506 ; CodeQL passed: https://github.com/openclaw/clawsweeper/actions/runs/33370859425.Extended exact trace:
{"phase":"after","faultLine":38412,"healthy":200,"failure":{"status":500,"body":{"error":"exact_review_queue_unavailable"},"logs":[["exact_review_queue_handler_failed",{"phase":"fetch","location":[38412,44]}],["exact_review_queue_request_failed",{"remote":true,"retryable":false,"overloaded":false}]]},"recovery":200,"initialization":{"status":500,"body":{"error":"exact_review_queue_unavailable"},"logs":[["exact_review_queue_handler_failed",{"phase":"initialize","location":[38412,44]}],["exact_review_queue_request_failed",{"remote":true,"retryable":false,"overloaded":false}]]},"deferred":{"status":500,"body":{"error":"exact_review_queue_unavailable"},"logs":[["exact_review_queue_handler_failed",{"phase":"initialize","location":[38412,44]}],["exact_review_queue_request_failed",{"remote":true,"retryable":false,"overloaded":false}]]}}