Repository navigation
refactor(cron): read run history through its worker - #158222
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: blocked before merge. Reviewed September 26, 2026, 2:33 AM ET / 06:33 UTC (Revision 17). ClawSweeper reviewWhat this changesMoves scheduled-job run-history reads into Cron’s read-only SQLite worker, then filters and pages the existing records for Gateway clients. Merge readiness⛔ Blocked before merge - 1 item remains Current main still reads Cron run history synchronously through Tasks, so this PR remains useful. The worker path preserves the history response and rechecks authority before replying. I found no introduced blocking defect, and published-updater acceptance passed for two released versions. Priority: P2 Review scores
Verification
How this fits togetherCron schedules jobs and stores their run records in the shared Tasks database. The Gateway receives history requests from clients and returns records after applying current access and paging rules. flowchart LR
A[History client] --> B[Gateway Cron request]
B --> C[Cron read worker]
C --> D[Tasks SQLite records]
D --> C
C --> E[Current access and paging]
B --> E
E --> F[History response]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +140, Tests +351, Other +118. Total +609 across 67 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep Cron’s existing worker as the history read boundary, preserve the released cron.runs response and live access checks, and leave row writing and retention with Tasks until their separate cutover. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor. Current main’s direct Tasks-backed history read and the branch’s worker entrypoint are source-verifiable. Is this the best way to solve the issue? Yes. Extending Cron’s existing read-only worker avoids a second ledger, while the Gateway applies current access rules after the awaited read. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 91264b958cf1. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (16 earlier review cycles; latest 8 shown)
|
|
The published-updater evidence is now running on the reviewed candidate in https://github.com/openclaw/openclaw/actions/runs/36175255389. Workflow and package identities both pin 7f27837. Two cells cover the actual storage contracts: 2026.9.4 retained legacy history imported by candidate Doctor, and 2026.9.6 native history authored by its real CLI before upgrade. Both query the installed candidate Gateway for exact retained fields, run filtering and pagination. The harness preserves successful readback artifacts and has 66 focused passing tests plus a clean P2 review. This remains a pre-merge gate; no hosted pass is claimed yet. CI type and shrink-only ratchet cleanup is also complete, with all 25 test type graphs and three unused-code scans passing. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Re-evaluate the unchanged reader against main after 7c4866c repaired the Team Reports test import. Production and upgrade-harness source remain unchanged.
|
The latest merge-ref CI failure was an unrelated main regression: #157819 removed the Team Reports source barrel while its scheduler test retained the import. The same defect was reproduced on current main, then fixed directly under the repository's broken-main procedure in 7c4866c. The exact extension typecheck, all 36 scheduler tests, changed checks, and independent P2 review pass. A fresh CI push will evaluate this PR against the repaired main. The reader product and upgrade harness remain unchanged from the Package Acceptance source 7f27837; the subsequent change only fixes a compile-only type-contract consumer. Current head is 7f43a20; its latest commit changes no source and refreshes the failed merge-ref check after the upstream fix. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
The retained-history upgrade requirement is now proven through both published drivers. The 9.4 cell passed in run 36175255389: the installed updater ran first, candidate Doctor imported two legacy records, and retained fields, run filters, pagination, and missing-run behavior matched after update and after candidate restart. The 9.6 replay passed in run 36197664173: two jobs authored and executed by the released CLI retained their native run IDs and complete fields through the same boundaries. Both used the verified product package built from 7f27837 (SHA-256 788ccac62377bd9212992833f9e8bff3789f9294af275e0629e5c8cf7e851c5a); the 9.6 replay harness was 6a6a5f9. Subsequent changes are test/tooling metadata and fixtures; this is scoped package evidence with separate product/harness identities. The original 9.6 fixture failed before candidate installation because its default announcement had no Discord recipient. The executed fixture jobs now explicitly disable delivery; history assertions are unchanged. The final 9.6 proof artifact is 10891687468, SHA-256 c5ff89f2bcd3a58bcdfa12319e0ce04c01ae7b6df0a12ec69b46b00bb9110e8b. Ordinary CI's original Bun Canary startup SIGSEGV remains unexplained. An exact-merge Linux replay passed all 92 Bun client cases, and the one exact-job replay passed in the original CI environment. Those passes show non-reproduction, not a claimed engine fix. Completing the cancelled coverage then exposed an inherited catalog test mixing fake timers with real performance.now(); a deterministic six-second monotonic-clock probe reproduced the exact failed host result. The fixture now uses one fake clock, preserving production deadlines and assertions. Focused tests, the 235-case catalog shard, scoped checks, and independent P2 review pass. The changed file costs 19.56 seconds wall; its optional benchmark remains skipped. The next run caught one remaining stale Cron invalid-ID expectation. It now matches the canonical owner wording while retaining all three invalid-ID rejection cases. The original full file failed; all 13 cases pass after the correction in 18.54 seconds. Fresh P2 review is clean. Current-head ordinary CI remains the landing gate. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
The required post-merge package proof is complete: Package Acceptance 36219323700 passed both published 9.4 and 9.6 legacy-operator-state cells. Product and harness are both Each actual released updater installed build Verified artifacts: 9.4 The main-merge conflict was only the retained diagnostic-log list. Its resolution is the additive union of both parents' Cron/Webhooks proof files. All 147 combined owner/harness tests and both affected type graphs pass, with a fresh clean P2 review. No removal-specific schema change was introduced. Ordinary CI exposed separate main-side Linux fixture and worker transfer races; those failures remain recorded, with reproduced owner repairs rather than weakened checks. Current-head CI remains required for landing. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* refactor(cron): read run history through its worker * refactor(cron): clean up retired history type exports * test(cron): finish history type and ratchet cleanup * test(cron): prove published upgrade history reads * test(cron): retain canonical failover type contract * ci: refresh Cron checks after main import repair Re-evaluate the unchanged reader against main after c54d53f repaired the Team Reports test import. Production and upgrade-harness source remain unchanged. * fix(cron): complete wrapper cutover and upgrade diagnostics * test(cron): complete source references and delivery-free upgrade seed * test(codex): keep catalog progress on one fake clock * test(cron): align invalid run id assertion with owner * ci: refresh Cron checks after async task main repair * ci: refresh Cron checks after main QA reference repair * ci: refresh Cron checks after Linux fixture repair * ci: refresh Cron checks after workspace quota repair * ci: refresh Cron checks after main progress type repair
Remove Tasks and TaskFlow runtime, APIs, CLI, SDK surfaces and panels after the Cron, session, native execution and media completion ownership cutovers. Preserve stored rows and import provable legacy native assignments through Doctor; ambiguous ownership stays untouched with a warning. Follows #158221, #158217, #158225, #158222, #158702 and #158776. Related: #156532. Task-specific public APIs retire immediately; retained responsibilities use their existing owners. Maintainer-authorized administrative landing after full CI run 36312986498 attempt 2 passed on 274595e, with subsequent actual conflicts reviewed and focused checks passing. Current PR CI preflight hits the 64 KiB changed-path metadata limit before tests (run 36335042695); its duplicate security-review status mirrors that planning failure. Review and scoped proof are recorded in the PR. Published 9.4 native import is proven; remaining native completion and 9.4 rollback witnesses are explicitly unproven.
Remove Tasks and TaskFlow runtime, APIs, CLI, SDK surfaces and panels after the Cron, session, native execution and media completion ownership cutovers. Preserve stored rows and import provable legacy native assignments through Doctor; ambiguous ownership stays untouched with a warning. Follows openclaw#158221, openclaw#158217, openclaw#158225, openclaw#158222, openclaw#158702 and openclaw#158776. Related: openclaw#156532. Task-specific public APIs retire immediately; retained responsibilities use their existing owners. Maintainer-authorized administrative landing after full CI run 36312986498 attempt 2 passed on 274595e, with subsequent actual conflicts reviewed and focused checks passing. Current PR CI preflight hits the 64 KiB changed-path metadata limit before tests (run 36335042695); its duplicate security-review status mirrors that planning failure. Review and scoped proof are recorded in the PR. Published 9.4 native import is proven; remaining native completion and 9.4 rollback witnesses are explicitly unproven.
Related: #156532
What Problem This Solves
Moves Cron run-history reads off the Gateway main thread and gives Cron its own history projection before the remaining Tasks runtime retires.
User Impact
cron.runsretains its response shape, filtering, pagination, retained history and access rules. Reads now recheck current authority, expiring self-management grants, job ownership and job names after awaiting the worker.Tasks remains the sole writer, cancellation and retention owner for the existing rows in this batch. Database schema and stored-data interpretation are unchanged.
Why This Change Was Made
The existing Cron read-only worker reads the canonical rows through the existing Tasks decoder, then projects them into neutral Cron history records. One narrow adapter serves remaining Task callers; the native Cron codec owns presentation and paging. This is the prerequisite for moving Cron transcripts away from Tasks RPCs without introducing a second ledger or maintenance loop.
Evidence
The later Cron writer/pruner cutover remains coupled to retirement of the old Task maintenance owner.
Follow-up CI cleanup removes an unused private failover type and makes the retained JSON type dependency explicit. Both full unused-code scans, core types, targeted lint, and fresh P2 review pass. Published-updater acceptance for retained Cron history has passed for both 9.4 and 9.6, with artifacts verified.
Published-driver upgrade proof was rebuilt after incorporating current-main Doctor/update changes. Package Acceptance 36219323700 passed both 9.4 and 9.6 cells with exact product/harness
8b693ecd25f277171c469b514cf3517f6547a4a3; the current head adds only an empty CI refresh. The 9.4 driver proves Doctor imports both retained legacy records; the 9.6 driver proves both native runs survive. Retained fields, filtering, pagination, and missing-run results match after update and candidate restart. Tarball SHA-256:060e7404f95def474a4217878b9d309740807734c49197d3f74f98a844ae7baa. Verified baseline artifacts and complete post-merge proof.Earlier runs and the fixture repairs remain described in the preceding evidence comment. They are not substituted for the rebuilt package. The sole merge conflict was an additive union of retained Cron/Webhooks diagnostic logs; 147 combined owner/harness cases, both affected type graphs, and fresh P2 review pass.
The remaining test-only failover type import now derives its identical union from the canonical constants. All 25 test type graphs and all three unused-code scans pass; assertion baselines only shrink for the deleted codec and simplified handler.