#7367: refactor(cron): rename wakeMode to postRun
docs
app: macos
app: web-ui
gateway
cli
commands
agents
Cluster:
Cron Job Enhancements
## Summary
- Renames the confusing `wakeMode` field to `postRun` across the entire codebase
- `wakeMode: "now"` → `postRun: "trigger-heartbeat"` and `wakeMode: "next-heartbeat"` → `postRun: null`
- Adds backwards-compatible migration so existing `jobs.json` configs are automatically upgraded on load
## Motivation
The `wakeMode` name misleadingly suggests it controls *whether* cron jobs run, when it actually only controls post-execution heartbeat behavior. `postRun` with explicit values makes the purpose clear at a glance.
## Changes
- **Core types**: `CronWakeMode` → `CronPostRun`, old type kept as deprecated alias
- **Migration** (`normalize.ts`): reads legacy `wakeMode`, maps to `postRun`, deletes old key
- **Schemas** (TypeBox + Zod): accept both old and new field names for backwards compat
- **CLI**: `--post-run` flag added, `--wake` kept as deprecated alias
- **Gateway hooks**: configs accept both `wakeMode` and `postRun`
- **Swift macOS app**: `CronWakeMode` enum → `CronPostRun` with coding key migration
- **Web UI**: labels updated ("Post-run" / "Trigger heartbeat" / "None")
- **Tests**: all updated (804/805 pass — sole failure is unrelated macOS-only launchd test)
- **Docs**: English + Chinese updated with new naming and backwards compat notes
## Testing
- `bun test` passes 804/805 test files (4996/4999 tests)
- Only failure: `launchd.test.ts` — macOS-specific, pre-existing, unrelated to this change
- TypeScript build (`bun run build`) passes cleanly
> 🤖 This PR was AI-assisted. All changes were reviewed and the full test suite was run.
Most Similar PRs
#5498: Cron: honor next-heartbeat
by sebslight · 2026-01-31
70.7%
#11657: fix(cron): treat skipped heartbeat as ok for one-shot jobs
by DukeDeSouth · 2026-02-08
69.2%
#19998: macOS: harden cron editor updates and compatibility
by tobiasbischoff · 2026-02-18
68.5%
#14667: fix: preserve missed cron runs when updating job schedule
by WalterSumbon · 2026-02-12
65.1%
#11813: fix(cron): ensure 'at' schedule type correctly registers nextWakeAt...
by leo-reifying · 2026-02-08
64.8%
#17064: fix(cron): prevent control-plane starvation during startup catch-up...
by donggyu9208 · 2026-02-15
64.7%
#8307: fix(cron): improve tool description with reliable reminder guidance
by vishaltandale00 · 2026-02-03
63.6%
#8701: fix: default enabled to true for cron jobs created via tool API
by maximus-claw · 2026-02-04
63.4%
#17801: fix(heartbeat): enforce interval guard for non-interval wake reasons
by aldoeliacim · 2026-02-16
62.9%
#17561: fix(cron): add runtime staleness guard for runningAtMs (#17554)
by robbyczgw-cla · 2026-02-15
62.6%