Repository navigation
fix(bay): keep lifecycle history visible beyond 10,000 records - #1362
Conversation
Replace the 10,000-record history cap and JavaScript identity sets with SQL inventory counts and a streaming validation pass. Keep only the bounded lane samples, then resolve current revisions for the public 24-card sample in the same read transaction. Preserve fail-closed malformed-history handling and read-only durable facts. Accept safe integer inventory counts through the Worker and browser, and document the remaining linear validation cost. Cover growth beyond 10,000 records, earlier revisions across fences, rare lanes, and corrupt historical rows. Verified paired native workerd behavior and synthetic Chrome rendering. The full current-head CI gate remains required before landing.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 2, 2026, 6:10 PM ET / 22:10 UTC. ClawSweeper reviewWhat this changesThe PR removes Bay’s 10,000-record lifecycle cap, streams and validates historical lifecycle rows with bounded samples, and briefly caches the sanitized public response. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this current, meaningful PR fixes Bay’s known 10,000-record failure and is not on current main. The previous scan-cost finding is addressed by a short-lived cache and an explicit acceptance of the remaining full-history cache-miss cost. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw Bay reads lifecycle history from the queue Durable Object and exposes aggregate counts plus a small sanitized sample through a public Worker endpoint. The browser validates that endpoint before rendering the read-only lifecycle board. flowchart LR
History[Lifecycle history]
Reader[Durable Object reader]
Validation[Validation and lane reducer]
Snapshot[Sanitized lifecycle snapshot]
Cache[Short-lived edge cache]
Api[Public Bay API]
Browser[Bay board]
History --> Reader --> Validation --> Snapshot --> Cache --> Api --> Browser
Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the complete, fail-closed lifecycle projection with the scoped short-lived cache, while monitoring cold-read cost and revisiting the storage design if the accepted full-history scan exceeds Durable Object limits. Do we have a high-confidence way to reproduce the issue? Yes, at high confidence: the prior capped reader and the supplied native proof establish the over-10,000-row failure path, while the current branch exercises the repaired Worker and Durable Object route. Is this the best way to solve the issue? Yes. The implementation removes the incorrect history-size cap while preserving fail-closed validation and bounded retained samples; the remaining cold-read availability tradeoff is explicitly documented and accepted in the PR body. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 24231b22bc24. 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)
|
Cache sanitized lifecycle responses for up to 20 seconds, scoped by origin and the verified public repository set. Preserve the original observation time and remaining 60-second freshness allowance, and read the current owner when cache entries expire or the cache fails. This reduces repeated history scans from public refreshes without adding stored aggregates or another recovery path. Native workerd proof covers snapshot reuse, scope isolation, real expiry, historical corruption, and recovery on the unchanged lifecycle reader.
|
Maintainer disposition: accepted the remaining full-history cost on cache misses, including the possibility of unavailability at substantially greater scale. The scoped native cache reduces repeated viewer work while preserving the existing validator and complete totals; it is not a global work budget. The current review explicitly considers the former P2 addressed and reports no code or security findings. This records the owner decision already present in the PR body. No further author change is requested for that tradeoff. Current-head CI passed, and the native Worker/cache proof is accepted. Proceeding with the reviewed |
|
Post-merge production verification passed for Before deployment, the public lifecycle endpoint returned The first observed request took 7.184 seconds. A subsequent request took 0.311 seconds and returned exactly the same body and generation timestamp; both responses were HTTP 200 with Verification used public GET requests. The separate post-deploy Chrome inspection was inconclusive because the browser inspection connection timed out. The synthetic before/after browser proof and native runtime proof recorded in the PR remain the completed UI and runtime checks. |
Related: #1180
What Problem This Solves
Resolves a problem where OpenClaw Bay's durable lifecycle board becomes unavailable once accumulated history exceeds 10,000 records, even while the active queue is healthy. The production endpoint returned
unknown / over_capwith null inventory, lanes, and sample at 2026-09-02T21:20:53Z on deploymentff071968ca4e3fa62c364f9642e10a03c2fda025.Why This Change Was Made
SQLite supplies complete inventory counts while the existing validator/reducer streams every selected historical row in one synchronous transaction. Only 24 candidate cards per lane survive, and current revisions are resolved for the final 24-card sample. Worker and browser counts accept safe integers. Invalid historical facts still make the whole projection unavailable; reads never prune or rewrite history.
The public route caches its sanitized response through Cloudflare's native Cache API for up to 20 seconds, scoped by origin and the normalized verified-public repository set. Hits preserve
generated_at; expiry never exceeds the remaining 60-second freshness allowance. Cache failures use a fresh read, and failed refreshes never resurrect an expired success. Clients still receiveCache-Control: no-store.Maintainer disposition of the scan-cost P2: the response cache addresses repeated viewer amplification. We explicitly accept the remaining O(history) work per cache miss and its cost on the shared queue Durable Object to preserve complete totals and full historical validation without another stored summary or duplicated validator. Per-data-center caching, eviction, and simultaneous misses do not provide a hard global request budget or constant scan cost.
User Impact
Maintainers retain complete lifecycle counts and a small public card sample as history grows. Earlier revisions and rare terminal/acknowledgement lanes remain represented. Repeated views reuse a recent observation, with up to 20 seconds of cache delay. Queue behavior and GitHub mutation authority are unchanged.
OpenClaw Bay Impact
This fixes the durable lifecycle Kanban API and browser consumer. Native Worker proof covers inventory, historical validation, and response caching. Real Chrome captures separately show the same synthetic input rejected by the old renderer and displayed with all six lanes, counts, and 24 cards by the current renderer. The final renderer and assets are byte-identical to the captured candidate.
Before:
After:
Documentation Impact
Updated the active
docs/openclaw-bay-demo.mdobserver guide with streaming validation, bounded samples, linear miss cost, 20-second per-data-center caching, and the unchanged 60-second freshness contract. ClawSweeper maintainers own it; production projectors/renderer remain authoritative. Its verification metadata points to this PR's exact revision and proof. Validation, sampling, public projection, and freshness changes require corresponding guide updates.Evidence
Final head
ea9853f2a67980b488c0ee2cc61440fef6cd81d4, treede4fa470c9388d236bca3e4b1ce3d01f21eadb9d. Managed Codex P0 reviews of the staged candidate and complete committed branch againstff071968ca4e3fa62c364f9642e10a03c2fda025passed with no actionable findings. Six focused lifecycle-route tests passed, including reuse, expiry/scoping, malformed/stale cache, remaining-age TTL, and cache failure controls. Repair/dashboard builds, targeted lint, pinned formatting, and documentation checks passed; the existing native SQLite regression also passed.The previous green CI and hosted review applied to
ee6d9f, not this cache follow-up. The current head and body require fresh hosted review and a successful fullpnpm run checkbefore landing; neither is claimed complete here.Real Behavior Proof
Executed production
worker.fetch, the inherited lifecycle Durable Object reader, SQLite, and native Cache API on local macOS arm64, Node 24.20.0, Wrangler 4.107.0, and workerd 1.20260701.1. The command wasnode native-proof.mjs CANDIDATE WRANGLER FRESH_OUTPUT. The 2026-09-02T21:59–22:00Z run tested staged treede4fa470…, subsequently committed unchanged as the final head above. All 1,344 tracked contents/modes and the index matched before/after; source-manifest SHA-256 is95e9928921739393e1928d20662bcce0ce414eda5afea01562dd7409e66284b8.The fixture seeded 10,001 primary-scope rows plus three secondary-scope rows through the production store. Sixteen public HTTP observations required six inherited lifecycle reads, excluding the separately recorded empty seeding barrier. The primary response contained 10,001 records / 10,000 target revisions / 9,999 targets, all six lanes, and 24 sanitized cards. Immediate and ignored-query repeats retained identical bodies/timestamps without another read. Different scope/origin required their own reads; equivalent normalized repository sets reused entries. Every response was client
no-store.After corrupting an old row outside the sample, the immediate request retained the cached success. Following a real 21.512-second wait, the owner returned
unknown / malformed; its repeat cached that unknown response. After restoration and another 21.513-second wait, complete counts/lanes/cards returned with a new timestamp. Every public GET preserved row/byte/DML counters; only the two explicit corruption/restore writes changed storage. The process group stopped, its listener refused connections, and its runtime directory was removed.The earlier uncached baseline/candidate proof at
ee6d9fremains applicable to the unchanged reader: baselineunknown / over_cap, complete candidate inventory, older-current-revision handling, malformed/missing-fact rejection, and restoration on the same instance. Observed 10,001-row reads were approximately 55–85ms on misses and 4–6ms on hits, locally. Two 100,001-row stress attempts were inconclusive during fixture setup/state observation, before any production lifecycle API read; they provide no reader performance or capacity evidence.Cache proof SHA-256 identifiers:
Retained evidence includes exact HTTP responses, reader counters, native runtime identity, source manifests, and cleanup receipts. Limits: controlled local native proof, not production deployment, multi-data-center behavior, or an OS-level network sandbox. No real credentials, GitHub writes, model inference, or natural backlog convergence were involved. Chrome used separate synthetic presentation fixtures, not replayed native HTTP traces; captures were inspected for sensitive content. Cache rejection and remaining-age caps were tested separately in focused unit tests.