Skip to content

fix(observability): retain durable queue failure flags - #1317

Merged
steipete merged 1 commit into
mainfrom
codex/queue-failure-diagnostics
Aug 31, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/queue-failure-diagnostics

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Intermittent canonical-record, publication-batch, and completion requests return HTTP 500 exact_review_queue_unavailable, but the Worker currently discards every property of the caught Durable Object exception. A filtered live trace captured two failed completion requests with only the generic exact_review_queue_request_failed log. That makes it impossible to distinguish platform overload, retryable infrastructure failure, and a remote exception from the application log.

The existing catch now logs only Cloudflare's documented remote, retryable, and overloaded boolean flags. Strict === true checks prevent arbitrary thrown values from becoming log content. The public status/body and queue retry behavior stay unchanged. No exception message, stack, request payload, target identity, or credential is logged.

This is diagnostic instrumentation for the ongoing availability investigation; it does not claim to fix the underlying 500s. The public-error boundary introduced by #1263 is preserved. Cloudflare documents these flags and cautions against retrying overloaded objects: https://developers.cloudflare.com/durable-objects/best-practices/error-handling/.

Real behavior proof

Candidate: fe32ede4edba7a8f77465a3d422e4dad32008b2a; baseline: c377cfc04209464760ed5a1537fa693c71e77cf5.

AWS Crabbox, lease cbx_a1bfe9a2fb09, image ami-0461d919be7deb53c, Node v24.18.1, pnpm 11.10.0. The isolated checkout has no production credentials, instance role, or Tailscale. The production Worker code on the baseline is byte-identical to the current deployed Worker code from 9f343df8bfd7e852a7e10601a6a9ea7345af6f60.

The production dashboard/worker.ts is bundled with the repository-pinned Wrangler 4.107.0 toolchain and executed in real workerd through Miniflare. A fixture Durable Object deliberately throws a private marker; the actual signed /internal/exact-review/publications/list request crosses the Durable Object boundary, and Cloudflare supplies the remote exception property. A fixture-only response header captures the Worker's console call without changing its response body or status.

node .artifacts/queue-failure-proof.mjs before
node .artifacts/queue-failure-proof.mjs after

Baseline output: HTTP 500, body { "error": "exact_review_queue_unavailable" }, log ["exact_review_queue_request_failed"].

Candidate output: the same HTTP status/body, log ["exact_review_queue_request_failed", { "remote": true, "retryable": false, "overloaded": false }].

Both runs assert that the planted private marker is absent from the response and captured application log. The faulting Durable Object is controlled; workerd, the binding transport, signature validation, production Worker routing, and error catch are real. This proves diagnostic preservation and the privacy boundary, not a production outage reproduction. Retryable/overloaded variants are covered by the focused unit controls below.

The focused regression covers primitive errors, a remote exception, a retryable exception, overload with a retryable flag, and nonboolean properties. It checks the exact fixed response and exact allowed log fields, including exclusion of a planted private error marker.

Full pnpm run check passed: 4,145 passing tests, 8 skipped, plus the 13 static test cases. The initial full check identified an existing record-export log-shape assertion, which was aligned and then passed with the full suite. The privacy behavior itself remains unchanged.

The proof ran before commit; tree 669ef7ddfc2ee7b59b5f6d66ea0ef28d5ec6f0ca is unchanged in the candidate commit. Runtime proof: run_813448cd63cd; final focused/full check: run_706c563bed55. Toolchain: Wrangler 4.107.0, Miniflare 4.20260701.0, workerd 1.20260701.1, esbuild 0.28.1.

Fresh pre-commit and committed-branch Codex Autoreview against the stated base both completed with no accepted/actionable P0 findings, the configured review scope.

OpenClaw Bay is unaffected: this changes only server-side diagnostic logging. No public schema, route, display, or browser action changes.

Standalone workerd reproduction driver

Install the repository-pinned proof toolchain with npm install --prefix /tmp/clawsweeper-queue-proof-tools --no-audit --no-fund [email protected]. Save the following as .artifacts/queue-failure-proof.mjs and run the commands above from the baseline and candidate checkout respectively. The driver is included here so the runtime proof remains reproducible without adding one-off harness code to the product.

import assert from 'node:assert/strict';
import {createRequire} from 'node:module';
import {createHmac} from 'node:crypto';
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs';
import {execFileSync} from 'node:child_process';
import {resolve} from 'node:path';
const require=createRequire('/tmp/clawsweeper-queue-proof-tools/package.json');
const {build}=require('esbuild');
const {Miniflare,Log,LogLevel}=require('miniflare');
const phase=process.argv[2];
const output=resolve('.artifacts/queue-failure-'+phase+'.mjs');
mkdirSync('.artifacts',{recursive:true});
await build({stdin:{contents:`
import worker from './dashboard/worker.ts';
const events=[];
console.error=(...args)=>events.push(args);
export class FaultingQueue {
 async fetch(){throw new Error('synthetic-private-error-marker');}
}
export default {
 async fetch(request,env,ctx){
  const response=await worker.fetch(request,env,ctx);
  response.headers.set('x-proof-console',JSON.stringify(events.splice(0)));
  return response;
 }
};`,resolveDir:process.cwd(),sourcefile:'queue-failure-proof-entry.ts',loader:'ts'},bundle:true,format:'esm',platform:'neutral',target:'es2022',external:['cloudflare:workers'],outfile:output});
const mf=new Miniflare({modules:true,scriptPath:output,compatibilityDate:'2026-05-11',durableObjects:{EXACT_REVIEW_QUEUE:{className:'FaultingQueue',useSQLite:true}},bindings:{CLAWSWEEPER_WEBHOOK_SECRET:'synthetic-proof-secret'},log:new Log(LogLevel.NONE)});
try {
 const body=JSON.stringify({limit:100});
 const response=await mf.dispatchFetch('https://clawsweeper.openclaw.ai/internal/exact-review/publications/list',{method:'POST',headers:{'content-type':'application/json','x-clawsweeper-exact-review-signature':'sha256='+createHmac('sha256','synthetic-proof-secret').update(body).digest('hex')},body});
 const result={phase,head:execFileSync('git',['rev-parse','HEAD'],{encoding:'utf8'}).trim(),status:response.status,body:await response.json(),logs:JSON.parse(response.headers.get('x-proof-console'))};
 assert.equal(result.status,500);assert.deepEqual(result.body,{error:'exact_review_queue_unavailable'});
 const expected=phase==='before'?[['exact_review_queue_request_failed']]:[['exact_review_queue_request_failed',{remote:true,retryable:false,overloaded:false}]];
 assert.deepEqual(result.logs,expected);assert.ok(!JSON.stringify(result).includes('synthetic-private-error-marker'));
 writeFileSync('.artifacts/queue-failure-'+phase+'.json',JSON.stringify(result,null,2)+'\n');console.log(JSON.stringify(result));
} finally {await mf.dispose();}

@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Current-head workerd proof, privacy controls, full check results, and the diagnostic-only scope are recorded in the PR body. Please review the current head and body.

@clawsweeper

clawsweeper Bot commented Aug 31, 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.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 2:21 AM ET / 06:21 UTC.

ClawSweeper review

What this changes

The PR records three strict Cloudflare Durable Object failure flags in exact-review queue logs while preserving the bounded public error response.

Merge readiness

✅ Ready for maintainer review

The current head makes a narrow, privacy-preserving observability change with sufficient production-shaped boundary proof and no introduced correctness finding. It remains appropriate for ordinary maintainer review once the in-progress required check completes.

Priority: P2
Reviewed head: fe32ede4edba7a8f77465a3d422e4dad32008b2a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused production-shaped proof, regression coverage, and a small privacy-conscious patch provide normal merge-ready evidence.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR records a current-head before/after workerd proof through the production Worker route and Durable Object boundary: a controlled thrown fault preserves the fixed HTTP 500 response, adds the allowed remote flag, and excludes the planted private marker from both observable outputs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR records a current-head before/after workerd proof through the production Worker route and Durable Object boundary: a controlled thrown fault preserves the fixed HTTP 500 response, adds the allowed remote flag, and excludes the planted private marker from both observable outputs.
Evidence reviewed 5 items Introduced failure projection: The changed catch projects only strict boolean remote, retryable, and overloaded values, then retains the fixed exact_review_queue_unavailable response.
Focused privacy and flag coverage: The focused test covers primitive, remote, retryable, overloaded, and non-boolean thrown values, asserting the fixed public response and the exact bounded log payload.
Current-head behavior proof: The PR body records a before/after workerd-through-Miniflare run on the stated base and head: both return the same HTTP 500 JSON body, while the candidate retains remote:true and excludes the planted private marker from response and logs.
Findings None None.
Security None None.

How this fits together

The dashboard Worker forwards signed internal exact-review requests to a Durable Object queue. Queue transport failures return a fixed JSON error to callers and produce bounded server-side diagnostics for operators.

flowchart LR
A[Signed internal request] --> B[Dashboard Worker]
B --> C[Exact-review queue]
C --> D{Transport failure}
D --> E[Bounded JSON error]
D --> F[Filtered server flags]
C --> G[Queue response]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Change scope 1 production handler; tests +36/-15; docs +8; 5 files The implementation is confined to queue-failure logging, with focused coverage and operator documentation.

Technical review

Best possible solution:

Keep the fixed public error boundary and land the bounded diagnostic flags after normal maintainer approval and the current required check.

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

Yes. The supplied current-head proof exercises the signed Worker-to-Durable-Object failure path in workerd, showing the preserved response and the added filtered diagnostic output; it does not claim to reproduce a production outage.

Is this the best way to solve the issue?

Yes. Strictly projecting the documented boolean flags preserves the existing public privacy boundary while adding the smallest useful diagnostic distinction.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded reliability and observability improvement for exact-review queue failures.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR records a current-head before/after workerd proof through the production Worker route and Durable Object boundary: a controlled thrown fault preserves the fixed HTTP 500 response, adds the allowed remote flag, and excludes the planted private marker from both observable outputs.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR records a current-head before/after workerd proof through the production Worker route and Durable Object boundary: a controlled thrown fault preserves the fixed HTTP 500 response, adds the allowed remote flag, and excludes the planted private marker from both observable outputs.

Label justifications:

  • P2: This is a bounded reliability and observability improvement for exact-review queue failures.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR records a current-head before/after workerd proof through the production Worker route and Durable Object boundary: a controlled thrown fault preserves the fixed HTTP 500 response, adds the allowed remote flag, and excludes the planted private marker from both observable outputs.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR records a current-head before/after workerd proof through the production Worker route and Durable Object boundary: a controlled thrown fault preserves the fixed HTTP 500 response, adds the allowed remote flag, and excludes the planted private marker from both observable outputs.

Evidence

What I checked:

Likely related people:

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

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-31T06:17:31.477Z sha fe32ede :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. 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 Aug 31, 2026
@steipete
steipete merged commit ddc7560 into main Aug 31, 2026
17 checks passed
@steipete
steipete deleted the codex/queue-failure-diagnostics branch August 31, 2026 06:23
@steipete

Copy link
Copy Markdown
Contributor Author

Landed as ddc7560. The merged tree matches the reviewed candidate exactly. CI passed at https://github.com/openclaw/clawsweeper/actions/runs/33363416657, and the current-head hosted review passed with sufficient proof and no actionable findings at https://github.com/openclaw/clawsweeper/actions/runs/33363425833.

The Worker deployment and live smoke test passed at https://github.com/openclaw/clawsweeper/actions/runs/33364036024. The public health endpoint reports the merged deployment SHA. The real workerd exception replay also passed on merged main in AWS Crabbox (cbx_a1bfe9a2fb09, run run_efdaea409c86), preserving the fixed HTTP 500 response while recording only the three boolean fields. Full validation passed with 4,145 tests and 8 skips, plus 13 static tests.

This lands the diagnostic prerequisite. The intermittent backend availability failure remains under investigation; this PR does not change retry, publication, or queue policy.

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. 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