Repository navigation
refactor(cron): deslop shared history ordering - #160897
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 10:26 PM ET / September 29, 2026, 02:26 UTC. ClawSweeper reviewWhat this changesCron history paging, retention, and recovery use one newest-first record comparison, with tests for ascending and descending pages. Merge readiness✅ Ready for maintainer review Current main has not absorbed this work. The shared ordering appears equivalent for normalized cron records, and this review found no blocking defect. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw stores automation run records in shared SQLite state. Gateway requests page those records, while maintenance prunes old history and recovery identifies completed runs. flowchart LR
A[Automation runs] --> B[SQLite run records]
B --> C[Shared recency order]
C --> D[Gateway history pages]
C --> E[History retention]
C --> F[Run recovery]
F --> G[Recovered result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -4, Tests +22. Total +18 across 5 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one record-ordering rule for the three cron consumers while preserving their existing paging, retention, and exact-receipt recovery contracts. Do we have a high-confidence way to reproduce the issue? Not applicable: this refactor reports no failing user flow. Source comparison and the added page cases provide the relevant ordering check. Is this the best way to solve the issue? Yes: the existing timestamp owner is a narrow home for the shared comparison, and the consumers retain their distinct rules. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3b5043053a91. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
#160897 (27aa621) built the ordering fixture with a spread inside .map, which oxlint's no-map-spread rejects; check-lint-core-1 failed on hourly 36518039325 at src/cron/run-history.test.ts:65. Build each record through a small typed factory instead. The records, their order, and every assertion are unchanged. Proof: oxlint clean on the file; run-history.test.ts 10/10.
Centralize recency ordering for history pages, retention, and recovery while preserving timestamp precedence and tie-breaks. Validation: 37 focused tests and independent P2 review passed. Exact-head CI types, guards and security passed. The admin merge exception covers only two unrelated max-lines failures reproduced on clean main 25055f0; evidence is recorded in the PR body.
openclaw#160897 (b1b7546) built the ordering fixture with a spread inside .map, which oxlint's no-map-spread rejects; check-lint-core-1 failed on hourly 36518039325 at src/cron/run-history.test.ts:65. Build each record through a small typed factory instead. The records, their order, and every assertion are unchanged. Proof: oxlint clean on the file; run-history.test.ts 10/10.
What Problem This Solves
Cron history pages, retention, and recovery repeated the same recency order in three modules, allowing their timestamp and tie-break rules to drift.
User Impact
No deliberate behavior change. History ordering, retention thresholds, exact-receipt recovery, and recovery's separate preference for unfinished runs are preserved.
Why This Change Was Made
The existing timestamp owner now also owns newest-first record comparison. Paging, retention, and recovery consume that comparison; ascending pages reverse its direction. A small page-level table test covers timestamp precedence and creation/id ties in both directions.
Evidence
pnpm test <file> --maxWorkers=1ontbx_01m3nadhyxv9k98c5g1hhk2nw1, exact head3b474a5638609efca4b9efe8a785fcbe0076332fmaterialized from its verified Git bundle in an isolated checkout.pnpm test src/cron/run-history.test.ts --maxWorkers=1passed 10 tests in 37.13s wall;pnpm test src/cron/run-history-detail.test.ts --maxWorkers=1passed 27 tests in 36.58s wall. The existing history suite covers worker-backed persistence, retention and exact-receipt recovery; the two added cases are pure in-memory page projections with no new fixture, import, timer, or process. CI timing will be recorded once available.src/gateway/talk/relay/session-create.tsis 702/700 lines and untouchedsrc/gateway/server-methods/sessions.dispatch.device.test.tsis 1002/1000. A clean detached main checkout at4187710037fc88b467b9a6017c069c833e6d6f10reproduced both exact errors on Testboxtbx_01m3njdxea14ksvwtdhc0h0rmzwithnode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json <the two files>(10.2s). CI linted the merge ref, including main's newer device-test additions. These inherited size failures qualify for the requested pinned-head admin exception. The duplicate Testbox type pass was stopped after exact-head hosted type/guard/security checks passed; its partial run is not claimed as a full changed-gate pass.Merged with the documented pinned-head admin exception as
27aa6213dfaad8223b8d8b3df55799358037729e; main ancestry and reviewed patch identity verified.Correction from the complete CI log: core lint also reported an introduced
oxc(no-map-spread)error in the new test fixture, omitted from the annotations used in the initial summary. Concurrent main repair743c2ceb72ereplaced that fixture builder and preserved its assertions. This error was caused by this PR and is not covered by the inherited-size exception. A duplicate candidate was independently reviewed and passed focused lint (14.27s) and 10 tests (31.17s), then discarded in favor of the landed main repair. The two added CI cases took 0.004s and 0.002s in run36512203161.