Skip to content

feat(cron): isolated cron runner on SQLite base (desicool-release) - #4

Open
Desicool wants to merge 8 commits into
desicool-releasefrom
cron-on-desicool-release
Open

Desicool wants to merge 8 commits into
desicool-releasefrom
cron-on-desicool-release

Conversation

@Desicool

@Desicool Desicool commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

Re-ports the openclaw_cron cron feature onto the SQLite desicool-release base as an isolated cron runner (isolated agent-turn jobs only), and completes the isolated-only narrowing the WIP branch had left half-finished.

  • Isolated runner — detached openclaw run-cron-job <jobId> --run-id <uuid> subprocess; the gateway stays the sole SQLite writer (subprocess reads the job and writes a unique result file), cross-process scheduler lock, and boot-time reconcile of in-flight subprocess jobs (replaces mark-as-failed). Adds idempotencyKey dedup.
  • Narrowed surface — cron is sessionTarget:"isolated" + payload.kind:"agentTurn" only. kind:"every", schedule tz, non-isolated session targets, and systemEvent reminders are removed from the create/run path.
  • Upgrade path — openclaw doctor --fix migrates legacy stores: every→cron, strips tz, rewrites non-isolated sessionTarget→isolated, and disables legacy systemEvent jobs (the isolated runner can't execute them) so upgraded stores stay runnable. Adds cron purge.
  • Plugin fix — scheduled session turns are created as isolated jobs bound via sessionKey, but tag-cleanup still filtered on the removed sessionTarget==="session:<key>", so turns were created yet never cleaned up. Now filters by sessionKey.
  • Tests — migrated the whole cron test suite to isolated-only fixtures; deleted tests for removed paths. The suite passed vitest but was fully red under tsgo:core:test (esbuild strips types) — now 0 type errors.

Verification

Local (linked worktree, node scripts/run-vitest.mjs + pnpm tsgo):

  • pnpm tsgo:core (prod) → 0 errors; pnpm tsgo:core:test → 0 errors (was 76)
  • src/cron 958 · doctor/cron 150 · gateway server.cron 17 / server-cron 16 / -lazy pass · cron-tool 82 · scheduled-turns.contract 25 · captured-registration 2 · weekly-report 84

Behavior addressed: cron jobs run as isolated agent turns and survive gateway restart; legacy stores migrate via doctor --fix; plugin scheduled turns clean up.
Real environment tested: not yet — unit + typecheck only.
Exact steps or command run after this patch: pnpm tsgo:core, pnpm tsgo:core:test, node scripts/run-vitest.mjs src/cron (+ the suites above).
Evidence after fix: all suites green; both tsgo lanes 0 errors.
Observed result after fix: green.
What was not tested: pnpm build, check:import-cycles, full pnpm check, extensions typecheck, and the live restart-survival / doctor --fix repro — deferred to Crabbox/Testbox before land (no module-boundary or dynamic-import changes, so low risk).

🤖 Generated with Claude Code

actions-user and others added 8 commits May 31, 2026 05:36
Ports the weekly-report cron-triggered plugin from openclaw_cron onto the
desicool-release (SQLite) base. No SDK import reconciliation needed; manifest
ships contracts.tools and minHostVersion is satisfied. Lockfile gains the
weekly-report workspace importer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Net-new infra util (Node built-ins only) used by the forthcoming subprocess
boot-reconcile to distinguish a live cron subprocess from a recycled pid.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…oot reconcile

Port the openclaw_cron feature onto the SQLite desicool-release base as an
isolated agent-turn runner. Detached `openclaw run-cron-job` subprocess (gateway
is the sole SQLite writer; subprocess reads job + writes a result file), a
cross-process scheduler lock, boot-time reconcile of in-flight subprocess jobs
(replacing mark-as-failed), and idempotencyKey dedup. Narrows cron to
isolated/agentTurn only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add `cron purge` (CLI + doctor --fix safe-subset) and fold legacy cron-schema
repair into the doctor pipeline: migrate kind:"every"→cron, strip tz, rewrite
non-isolated sessionTarget→isolated, and disable legacy systemEvent jobs (which
the isolated runner cannot execute) so upgraded stores stay runnable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ed-only cron

Scheduled session turns are created as isolated cron jobs with the session
binding in sessionKey, but the tag-cleanup filter still matched the removed
sessionTarget==="session:<key>" form, so turns were created yet never found or
cleaned up. Filter by sessionKey instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Re-port cron tests for the isolated-only model: kind:"every"→cron, drop tz,
sessionTarget:"main"/"session:*"→isolated, systemEvent→agentTurn; preserve
intentional legacy shapes via casts in doctor/store migration tests; drop tests
for removed paths (main-session routing, opaque session ids). Fixes the full
cron test suite under `tsgo:core:test` (76 type errors → 0) while keeping vitest
green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions
github-actions Bot force-pushed the desicool-release branch from a5ec9d5 to 4ba2396 Compare June 6, 2026 05:25
@github-actions
github-actions Bot force-pushed the desicool-release branch 7 times, most recently from 027abb3 to 787f6af Compare June 13, 2026 05:39
@github-actions
github-actions Bot force-pushed the desicool-release branch 7 times, most recently from 14c6006 to a4fb765 Compare June 20, 2026 05:37
@github-actions
github-actions Bot force-pushed the desicool-release branch 6 times, most recently from c026b30 to 3018bf1 Compare June 26, 2026 05:34
@github-actions
github-actions Bot force-pushed the desicool-release branch 7 times, most recently from b225548 to 13cc9d3 Compare July 22, 2026 06:33
@github-actions
github-actions Bot force-pushed the desicool-release branch 8 times, most recently from e7872c7 to 9a576e0 Compare July 30, 2026 06:32
@github-actions
github-actions Bot force-pushed the desicool-release branch 8 times, most recently from 55a73b0 to 2975fb9 Compare August 7, 2026 04:47
@github-actions
github-actions Bot force-pushed the desicool-release branch 7 times, most recently from d94a9b8 to 3f71e2d Compare August 14, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants