[Bug] 自动化定时派发从不自主触发:nextRunAt 指针冻结、边界零派发(v3.11.2,附两日受控测试)
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
环境
- ZCode 桌面客户端 v3.11.2 (3.11.2.6792),macOS darwin 25.6.0 arm64
- 通过会话内 CronCreate/CronUpdate/CronList 工具创建与管理自动化
- 平台日志:
~/.zcode/v2/logs/
摘要
自动化任务的定时派发从未在无人为干预下发生。两天内所有观察到的"触发"(约 6 次)全部紧跟设置 UI 的编辑或手动执行(±1 分钟);6 次受控的分钟边界测试全部缺席,且平台日志在边界时刻没有任何派发执行记录。
复现步骤
- CronCreate(或设置 UI)创建 recurring 任务,cron
* * * * *(每分钟),nextRunAt 正确指向未来分钟边界 - 客户端保持运行、窗口聚焦、机器未休眠(
pmset -g log确认整夜无睡眠记录) - 等待边界通过
期望行为
边界时刻任务自动派发:runCount +1、nextRunAt 前进到下一档。
实际行为(2026-09-15 13:44–13:56 的 1 分钟探针测试,共 6 个边界)
| 边界 | 指针来源 | 会话状态 | 结果 |
|---|---|---|---|
| 13:45:00 | API CronUpdate 设置 | 空闲 | ❌ 未派发,nextRunAt 冻结在过去、runCount 不变 |
| 13:46 | 冻结指针 | 空闲 | ❌ 未派发 |
| 13:49:04 | API 等价表达式切换重算 | 会话活跃 | ❌ 未派发 |
| 13:49:45 | 用户设置 UI 自建的任务 | 会话活跃 | ❌ 未派发(runCount=0) |
| 13:52:00 | API 等价切换重算 | 短暂空闲 | ❌ 未派发 |
| 13:55:10 | API 等价切换重算 | 空闲 | ❌ 未派发 |
平台日志在上述全部边界时刻仅有 listAllAutomations / updateAutomation 等管理调用记录,无任何 dispatch/trigger 执行条目。
关联缺陷(同期观察到)
- nextRunAt 冻结:每次(罕见的)派发或 UI 编辑后,nextRunAt 停在已过去的时戳不重算,后续所有档位静默失效。9/13–9/15 期间确认 6 个时期(09:15 / 18:20 / 00:25 / 09:00 / 11:10 / 13:55 的任务指针均出现此现象)
- runCount/lastRunAt 记账不一致:有一次实际派发未计入 runCount;lastRunAt 有时记录的是配置更新时间而非运行时间
- scheduleRule 残留:UI 编辑后 scheduleRule 残留
hour:9, minute:0, weekdays:[1], monthDays:[1]等过期锚定字段,界面显示为"每天早上 9 点",与 cronExpr*/15不符 - API 与 UI 写入互相覆盖:CronUpdate 必然连调度参数一起提交,会覆盖用户在设置 UI 里的修改(cronExpr 与 scheduleRule 双轨不同步)
备注
- #430 提到归档会话的 Automation 会持续运行,说明部分环境下定时派发是工作的——本问题可能是环境/状态相关的,愿意配合提供进一步日志
- 临时绕过:唯一可靠触发是设置 UI 的"立即执行"或任意编辑动作(编辑后约 1 分钟内触发一次)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the recurring-task case with CronCreate or CronUpdate using * * * * *, while monitoring ~/.zcode/v2/logs/ at the minute boundary. Compare the management calls with dispatch or trigger records, then verify whether nextRunAt advances and runCount/lastRunAt reflect the run. Done means unattended dispatch occurs reliably without UI edits and the reported scheduling state stays consistent.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100