Repository navigation
improve: build queue status from one census - #1130
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 12:14 AM ET / 04:14 UTC. ClawSweeper reviewWhat this changesThe PR replaces repeated exact-review queue scans with one shared census that feeds status, admission, wake timing, and the observer-only Bay projection. Merge readinessKeep open: this is a coherent, current performance refactor not yet on main, with no actionable patch defect found and strong committed-head Worker proof. Priority: P2 Review scores
Verification
How this fits togetherThe Exact Review Durable Object reads durable queue records to build operator status and scheduling information. Those read models feed public queue/status responses and the observer-only OpenClaw Bay projection. flowchart LR
A[Durable queue records] --> B[Shared queue census]
B --> C[Status read model]
B --> D[Admission and wake logic]
B --> E[Bay projection]
C --> F[Queue and status responses]
D --> F
E --> G[Observer-only Bay]
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Land the focused census refactor after normal PR status review while preserving byte-compatible queue and Bay responses. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a performance refactor rather than a bug report; the PR supplies a committed-head local Worker comparison for the changed runtime path. Is this the best way to solve the issue? Yes. Reusing one census while retaining existing public read-model behavior is narrower and more maintainable than adding a parallel queue-status path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9c7445bdca92. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
The frequently polled exact-review queue status path repeatedly scanned and materialized the full durable queue to produce counts, lane health, admission, wake timing, and the public Bay projection.
/statsalso built the Bay projection twice.Why This Change Was Made
One queue traversal now builds an internal census containing lane/state counts, oldest records, active targets, ready work, wake inputs, and Bay candidates. Existing public read-model functions consume that census without changing their signatures, and the Durable Object reuses the stats census for its priority/batch-aware Bay projection.
User Impact
There is no user-visible behavior change. Operators receive byte-identical queue and status responses with substantially less queue-size-dependent read work.
OpenClaw Bay Impact
OpenClaw Bay is unaffected. The real-Worker proof shows its queue projection remains byte-identical, and the observer-only Bay boundary gains no queue, workflow, GitHub, recovery, deploy, or rollback action.
Documentation Lifecycle
The new proof package is historical verification evidence bound to commit
e94f3ca1eccfd88f497ea1934e7378ea20957c8f; it is not an active runbook. No documentation lifecycle or ownership contract changes.Evidence
pnpm run check: 3,337 tests passed, 9 skipped, 0 failed; static checks, all builds, lint, formatting, and coverage thresholds passed./stats+ customized Bay path: 12 → 1 full queue traversals, 7 → 1Object.valuesmaterializations, and 21.250 → 1.667 equivalent queue passes.Real Behavior Proof
Claim: Merge-base and candidate Workers return byte-identical normalized
/api/exact-review-queueand/api/statusresponses while the candidate performs a single full census traversal.Exercised surface: Real
wrangler dev --localWorker and SQLite-backedExactReviewQueueDurable Object at merge-base9c7445bdca92d05b5a38317b498d7f41fc19bc2band candidatee94f3ca1eccfd88f497ea1934e7378ea20957c8f.Scenario and fixture: Fixed seed
1592639710; independent 0, 24, and 96-item queue populations submitted through the signed enqueue route; public responses normalized only for volatile timestamps, request/lease identifiers, and nondeterministic diagnostic error ordering. Traversal instrumentation ran only in the proof over a separate 1,200-item state.Command and environment: Crabbox provider
aws, leasecbx_4650d7912abb(amber-prawn-e3e1), runrun_8fc3339ec3bc;node:24-bookwormDocker container; proof commanddocs/proof/single-census-read-model/run-proof.shfrom an independent clone of the pushed branch.Observable result:
PROOF_RECEIPT=COMMITTED,PROOF_HEAD=e94f3ca1eccfd88f497ea1934e7378ea20957c8f, all six route/population comparisons byte-identical,PROOF_RC=0, CrabboxrunStatus=succeeded, exit0.Artifact or trace: Crabbox artifact
run_8fc3339ec3bc-artifacts.tgzcontainsproof-summary.json; the reproducible harness and contract are indocs/proof/single-census-read-model/.Limits: Synthetic pending reviews and a deterministic loopback GitHub error stub only. The proof does not contact GitHub, acquire review leases, publish records, or mutate production. Randomized active, parked, publication, capacity, circuit, and wake combinations are covered by the property test.