Repository navigation
refactor(cron): deslop cron service, core, store and isolated agent - #160788
Conversation
Simplify helper indirection, repeated branches, and unused parameters. Reuse existing types and constants; trim redundant comments.
Consolidate normalization branches, schema types, and delivery coercion. Reuse store persistence and stream helpers; remove redundant wrappers.
Inline one-use helpers, consolidate delivery branches, and infer duplicate types. Remove redundant casts and comments while preserving named-session workspace resolution, admission, worktree leases, and persistent session restrictions.
The policy stamp, capture provenance, and exec pin reconciliation stay separate documented helpers; folding them into one nested function saved a few lines at the cost of reviewability in security-relevant code.
|
🦞👀 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 28, 2026, 8:21 PM ET / September 29, 2026, 00:21 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch simplifies cron scheduling, SQLite persistence, isolated-agent delivery, and related types while shrinking the unsafe-assertion baseline. Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open. Current main still uses the older cron store path, and the merged named-session workspace repair addresses different work. The reported published-updater exercise and the unchanged SQLite save sequence address the prior review concern; this review found no concrete introduced defect. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw automations feed saved jobs into the Gateway cron scheduler, which admits runs and records their state in SQLite. Isolated runs then route their output to chat or webhook destinations. flowchart LR
A[Saved automation jobs] --> B[Cron scheduler]
B --> C[Run admission]
C --> D[Agent execution]
D --> E[Delivery routing]
E --> F[Chat or webhook]
C --> G[SQLite jobs and receipts]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1076, Tests 0, Other -5. Total -1081 across 61 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep Doctor and regular cron writes on one SQLite save path while preserving existing quarantine, receipt, runtime-state, and delivery behavior. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes behavior-preserving cleanup, not a reported defect. The contributor reports focused tests and an existing-state upgrade exercise. Is this the best way to solve the issue? Yes: reusing the existing SQLite writer and removing forwarding helpers fits the current owner boundaries; the reviewed paths show no distinct replacement implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 27de2f87db28. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
The pass removed 17 grandfathered assertions across seven cron files.
The helper's key parameter now types both the source and target, satisfying no-unnecessary-type-parameters without restoring a cast.
|
Merged via squash.
|
…penclaw#160788) * refactor(cron): deslop cron service Simplify helper indirection, repeated branches, and unused parameters. Reuse existing types and constants; trim redundant comments. * refactor(cron): deslop cron core and store Consolidate normalization branches, schema types, and delivery coercion. Reuse store persistence and stream helpers; remove redundant wrappers. * refactor(cron): deslop isolated cron agent Inline one-use helpers, consolidate delivery branches, and infer duplicate types. Remove redundant casts and comments while preserving named-session workspace resolution, admission, worktree leases, and persistent session restrictions. * refactor(cron): keep cap authority reconciliation steps named The policy stamp, capture provenance, and exec pin reconciliation stay separate documented helpers; folding them into one nested function saved a few lines at the cost of reviewability in security-relevant code. * refactor(cron): drop exports orphaned by the deslop pass * chore(cron): shrink assertion-safety baseline for the deslop pass The pass removed 17 grandfathered assertions across seven cron files. * fix(cron): type copied session fields by their key set The helper's key parameter now types both the source and target, satisfying no-unnecessary-type-parameters without restoring a cast. * Merge remote-tracking branch 'origin/main' into steipete/cron-deslop Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
src/cron(about 41k production lines) had never had a dedicated deslop pass; it only picked up incidental edits from the agent-tools passes. It carried forwarding wrappers, duplicated local types, repeated result projections, re-normalization of already-normalized values, and dead exports across the service, the isolated cron agent, and the core/store modules.User Impact
None intended. This is a behavior-preserving refactor. Scheduling, timing, run admission, delivery text, error and log messages, persisted SQLite rows and JSON shapes, quarantine keys, transaction boundaries, the config schema, CLI output, and gateway results are unchanged. No migration or operator action.
Why This Change Was Made
The pass removes 1,076 net production lines (565 added, 1,641 removed) across 59 production files, all inside
src/cron. Test lines are unchanged (+4/-4, import renames only). It also removes 17 grandfathered unsafe assertions, soconfig/assertion-safety-baseline.txtshrinks for seven cron files (shrink-only; no other entries touched).refactor(cron): deslop cron servicerefactor(cron): deslop cron core and storerefactor(cron): deslop isolated cron agentrefactor(cron): keep cap authority reconciliation steps namedrefactor(cron): drop exports orphaned by the deslop passfix(cron): type copied session fields by their key setchore(cron): shrink assertion-safety baseline for the deslop passWhat was removed:
resolveJobPayloadTextForMainexport, single-implementation callback injection in job validation, duplicated validation-context and mutation-option types, and repeated filter whitelists.normalize.tsandnormalize-payload.tsare consolidated;saveCronJobsStoreWithMetadatareusessaveCronStoreInDatabaseinside the same metadata transaction instead of repeating its quarantine and row-replacement steps; and history, diagnostics, and stream-schedule projections are shared.Two decisions worth reviewing:
Equivalence notes for the input normalization changes:
allowNulloption that its only caller always set.argvtruthiness check matches the old non-empty-array check, becausenormalizeCronCommandArgvreturns only a non-empty array orundefined.cronStoreKeyispath.resolve, so the store save keeps the same quarantine key.Evidence
Base
a980ef32a98f, heada84b5a6ec2b2. All checks ran locally on macOS with Node 26.oxfmt --checkon all changed files; type-awarenode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.jsonon all 60 changed cron filespnpm tsgo:corepnpm tsgo:core:test35cfe24d2a19)node scripts/run-vitest.mjs <325 explicit files>: every non-E2E test undersrc/cronplus every outside test importing a changed modulerun-vitestfor the cron tool-policy, scheduled-policy, job, and validation suites after the cap-authority revertpnpm check:import-cycles,pnpm check:madge-import-cyclespnpm deadcode:exports,pnpm deadcode:unused-filescheck-assertion-safety-ratchet,check:max-lines-ratchet,config:docs:check,plugins:inventory:checkOPENCLAW_UPGRADE_SURVIVOR_SCENARIOS=legacy-operator-state pnpm test:docker:published-upgrade-survivor, publishedopenclaw@latest(2026.9.6) updated to candidate89ff68620cabsurvivor-default-owner=main,survivor-ops-owner=ops). No scenario seeds quarantine entries; the store writer keeps the samepath.resolvekey and transaction, and thestore.test.tsquarantine cases pass.No tests were added or removed; the only test edits are four import renames, so per-PR test cost is unchanged. E2E cron suites were not run locally; hosted CI covers them.