feat(ckpt): add cron-based scheduled checkpoint snapshots#819
Open
Ziqi002 wants to merge 1 commit into
Open
Conversation
- add CrontabManager for hermes and openclaw plugin - add cronSchedules config key with add/remove/set sub-actions and 5-field cron expression validation - move singleton and workspace helpers from __init__.py to checkpoint_manager.py to resolve circular imports Signed-off-by: Ziqi Huang <ziqi02@alibaba-inc.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
cronSchedules配置项,支持 add/remove/set 子操作和 5 字段 cron 表达式校验hermes 插件
cron.py模块,实现CrontabManager管理定时快照调度;tools.py新增 cron 相关 tool 注册;config.py扩展支持 cronSchedules 配置。__init__.py移至checkpoint_manager.py,解决循环导入问题openclaw 插件
cron.ts模块,实现 TypeScript 版CrontabManager;commands.ts和handlers.ts新增 cron 相关命令和事件处理;openclaw.plugin.json注册新 tool。为什么用系统 crontab 而非进程内定时器或 daemon 内调度
进程内定时器不可行。 hermes 只在 tool call 时激活,openclaw 随 Gateway 重启丢状态,进程退出即失效。
daemon 内调度可行但代价偏高。 daemon 是常驻的,但它的职责是管理 btrfs 子卷生命周期。加调度意味着新增配置通道(daemon 要感知 cron 表达式和 schedule 增删改)和新的故障面(重启后恢复定时器、精度依赖事件循环)。对于「按固定间隔调 CLI」的需求,这些复杂度不必要。
系统 crontab:
crontab -l即可审计,无需任何进程在线ws-ckpt checkpointCLI,复用已有的错误处理和并发控制设计决策
per-workspace schedule 列表
配置以
{workspace_path: [cron_expr]}存储。切换 workspace 时CrontabManager.migrate()自动清理旧条目、安装新条目。sub-action 增量更新
通过
add/remove/set子操作修改 schedule,LLM 无需先读完整列表再整体回写。crontab 并发保护
hermes 用
fcntl.flock,openclaw 用mkdirSync目录锁,共享/tmp/ws-ckpt-cron.lock,防止 TOCTOU 竞态。循环导入重构
_get_manager()/cwd_inside_workspace()从__init__.py移至checkpoint_manager.py,消除tools.py的反向 lazy import。Related Issue
no-issue: 新功能,无对应 tracking issue
Type of Change
Scope
cosh(copilot-shell)sec-core(agent-sec-core)skill(os-skills)sight(agentsight)tokenless(tokenless)memory(agent-memory)ckpt(ws-ckpt)Checklist
cosh: Lint passes, type check passes, and tests passsec-core(Rust):cargo clippy -- -D warningsandcargo fmt --checkpasssec-core(Python): Ruff format and pytest passskill: Skill directory structure is valid and shell scripts pass syntax checksight:cargo clippy -- -D warningsandcargo fmt --checkpasstokenless:cargo clippy -- -D warningsandcargo fmt --checkpassmemory(Linux only):cargo clippy --all-targets -- -D warnings,cargo fmt --check, andcargo testpasspackage-lock.json/Cargo.lock)Testing
Additional Notes