Skip to content

feat(cron): isolated cron runner on current SQLite base (re-port, supersedes #4)#5

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

feat(cron): isolated cron runner on current SQLite base (re-port, supersedes #4)#5
Desicool wants to merge 6 commits into
desicool-releasefrom
cron-on-desicool-release-v2

Conversation

@Desicool

@Desicool Desicool commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

Re-ports the isolated-only cron feature onto the current SQLite desicool-release base (supersedes #4, which was built on an older, since-force-pushed base).

Cron is narrowed to an isolated agent-turn runner only: sessionTarget:"isolated" + payload.kind:"agentTurn" (drops kind:"every", schedule tz, main/current/session: targets, and systemEvent create/run). Adds: detached openclaw run-cron-job subprocess (gateway is the sole SQLite writer), cross-process scheduler lock, boot-time reconcile of in-flight subprocess jobs, idempotencyKey dedup, cron purge, doctor --fix legacy migrations (every→cron, strip tz, non-isolated→isolated, disable legacy systemEvent jobs), and the bundled weekly-report plugin. Also fixes a plugin regression where scheduled-turn cleanup matched the removed sessionTarget==="session:<key>" instead of sessionKey.

⚠️ Diff size caveat — read the commits, not the file count

desicool-release is a continuously force-pushed fork-overlay branch (the ci: re-apply fork overlay commits) — it was rewritten twice while this work was in progress, so this branch and the base share only a far-back merge-base. GitHub therefore shows a bloated diff (~hundreds of files) that is mostly history-rewrite noise, not real change. The actual cron work is the 5 commits on this branch:

  • feat(cron): isolated cron runner — subprocess exec, scheduler lock, boot reconcile
  • feat(doctor): cron purge + legacy schema migrations for isolated-only
  • feat(weekly-report): add bundled plugin
  • fix(plugins): match scheduled-turn cleanup by sessionKey
  • test(cron): migrate fixtures and suites to isolated-only runner

This branch cannot be cleanly fast-forward-merged while the overlay keeps rewriting the base; the intent is for whoever runs the overlay pipeline to incorporate these commits (or fold the cron feature into the overlay source).

Verification (green on the base this was built on)

  • pnpm tsgo:core 0 errors · pnpm tsgo:core:test 0 errors
  • src/cron 957 · doctor/cron 136 · gateway cron: server.cron 36 / server-cron 32 / -lazy 14 / -notifications 2 / server-methods/cron.validation 74 · cron-tool 95 · cron-cli 86 · scheduled-turns.contract 25 · weekly-report 84 · logging 24 · tasks 19

Behavior addressed: cron runs as isolated agent turns, survives gateway restart via subprocess reconcile; legacy stores migrate via doctor --fix; plugin scheduled turns clean up by sessionKey.
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 listed 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, live restart-survival / doctor --fix repro — deferred to Crabbox/Testbox.

🤖 Generated with Claude Code

actions-user and others added 6 commits June 5, 2026 05:37
…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 cleaned
up. Filter by sessionKey.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
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 (the
isolated runner cannot execute them) so upgraded stores stay runnable.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…oot reconcile

Re-port the isolated-only cron feature onto the SQLite (codec-store) base:
detached `openclaw run-cron-job` subprocess (gateway is sole SQLite writer),
cross-process scheduler lock, boot-time reconcile of in-flight subprocess jobs,
and idempotencyKey dedup. Narrows cron to isolated/agentTurn only (drops
every/tz/main/current/session from the create+run surface); recovers
idempotencyKey from job_json on load. Removes tests for the deleted paths.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Re-port cron tests for the isolated-only model on the SQLite base: every→cron,
drop tz, main/current/session→isolated, systemEvent→agentTurn; preserve
intentional legacy shapes via casts in doctor/store migration tests; drop tests
for removed paths. Clean under tsgo:core/tsgo:core:test and vitest.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@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 8 times, most recently from e3ac144 to 6605894 Compare June 28, 2026 05:38
@github-actions
github-actions Bot force-pushed the desicool-release branch 2 times, most recently from ac431f9 to 8b7e1cd Compare June 30, 2026 05:31
@github-actions
github-actions Bot force-pushed the desicool-release branch 7 times, most recently from d9067f9 to 93379db Compare July 7, 2026 07:41
@github-actions
github-actions Bot force-pushed the desicool-release branch 8 times, most recently from dd0a38b to 3032eca Compare July 15, 2026 06:18
@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 4 times, most recently from f9fbd00 to 6a44021 Compare July 26, 2026 06:41
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