#8307: fix(cron): improve tool description with reliable reminder guidance
agents
stale
Cluster:
Cron Enhancements and Fixes
Fixes #8298
## Problem
Users reported cron reminders failing with:
1. **Silent failures**: Status shows "ok" but no message is delivered to the user
2. **"Skipped" status**: Jobs get stuck in "skipped" state with retry spam in the UI
3. **Configuration confusion**: Unclear which parameters ensure reliable delivery
### Root Causes Identified
- `sessionTarget="main"` + `wakeMode="next-heartbeat"`: Marks job as "ok" immediately but the systemEvent sits in queue until the next natural heartbeat occurs. If there's no user activity, the message never gets delivered.
- `sessionTarget="main"` + `wakeMode="now"`: Can get stuck waiting for the main lane to become idle (up to 2 minutes), often resulting in "skipped" status and retry spam.
- The working pattern (`sessionTarget="isolated"` + `payload.kind="agentTurn"` + `deliver=true`) was not documented in the tool description.
## Solution
**Updated the cron tool description** to guide agents toward the reliable pattern:
1. ✅ Added **"RECOMMENDED PATTERN FOR REMINDERS"** section with the proven configuration
2. ✅ Clarified that `wakeMode="next-heartbeat"` may delay delivery indefinitely
3. ✅ Documented `wakeMode` and `deleteAfterRun` in the job schema section
4. ✅ Added code comment explaining the delivery timing nuance in `timer.ts`
### Recommended Pattern (now documented)
```json
{
"sessionTarget": "isolated",
"wakeMode": "now",
"deleteAfterRun": true,
"payload": {
"kind": "agentTurn",
"deliver": true,
"message": "<your reminder text>"
}
}
```
This pattern ensures reminders:
- Execute immediately (`wakeMode="now"`)
- Deliver reliably via auto-routing (`deliver=true`)
- Clean up after completion (`deleteAfterRun=true`)
## Changes
- `src/agents/tools/cron-tool.ts`: Enhanced tool description with recommended pattern and clearer wake mode documentation
- `src/cron/service/timer.ts`: Added comment explaining why `next-heartbeat` mode may not deliver messages
## Impact
- **No behavioral changes** to the cron execution logic
- Guides AI agents toward the working configuration pattern
- Reduces user frustration with failed reminders
- Better aligns agent behavior with user expectations
🤖 Generated with AgentGit
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the Cron agent tool description to document a recommended, reliable reminder configuration (isolated session + agentTurn + deliver) and clarifies wake modes and `deleteAfterRun`. It also adds an inline comment in the cron timer execution path explaining why `next-heartbeat` can lead to “ok” status while messages remain queued until a heartbeat occurs.
Overall this is a documentation-focused change that should reduce user confusion around reminder delivery semantics, with no intended behavioral changes to cron execution.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge since it primarily updates documentation/comments and does not change cron behavior.
- Review focused on the two modified files; changes are confined to tool description text plus a code comment. The only issue spotted is a likely mismatch between the description claiming `wakeMode` is required for job creation and the actual tool schema/runtime behavior where it appears optional for jobs.
- src/agents/tools/cron-tool.ts (tool description accuracy)
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#8097: fix: auto-convert one-shot reminders for reliable delivery
by Gerrald12312 · 2026-02-03
83.9%
#6522: fix(cron): deliver original message when agent response is heartbea...
by sidmohan0 · 2026-02-01
80.7%
#5498: Cron: honor next-heartbeat
by sebslight · 2026-01-31
79.8%
#18743: Cron Tool Hardening: Normalize Gateway Params and Enforce Valid Sch...
by cccat6 · 2026-02-17
79.4%
#12086: fix(cron): ensure timer callback fires for scheduled jobs
by divol89 · 2026-02-08
79.1%
#12303: fix(cron): correct nextRunAtMs calculation and prevent timer stall
by colddonkey · 2026-02-09
78.5%
#6801: docs: add token optimization guidance for isolated cron sessions
by ProofOfReach · 2026-02-02
78.2%
#9088: fix(cron): ensure nextRunAtMs is computed when enabled is undefined...
by divol89 · 2026-02-04
78.2%
#8701: fix: default enabled to true for cron jobs created via tool API
by maximus-claw · 2026-02-04
78.0%
#20559: Feature/cron tool control
by loeclos · 2026-02-19
77.9%