#22609: feat(cron): add directText flag for text message dilivery and historyLimit flag
app: web-ui
gateway
cli
agents
size: S
Cluster:
Cron Job Enhancements
## Summary
- Problem: add direct-text flag to deliver text message directly
- Why it matters: For text-only results, cron uses the subagent announce flow to deliver a user-facing update rather than raw output. This path intentionally asks the main agent to “convert the result into your normal assistant voice”, which tends to summarize.
- What changed: add direct-text flag to deliver text message directly, skip subagent announce flow
- What did NOT change (scope boundary):
## AI-assisted
- Prompt: add a flag to delivers text payloads directly without the announce conversion path
## Change Type (select all)
- [ ] Bug fix
- [x ] Feature
- [ ] Refactor
- [ ] Docs
- [ ] Security hardening
- [ ] Chore/infra
## Scope (select all touched areas)
- [x ] Gateway / orchestration
- [ ] Skills / tool execution
- [ ] Auth / tokens
- [ ] Memory / storage
- [ ] Integrations
- [ ] API / contracts
- [ ] UI / DX
- [ ] CI/CD / infra
## Security Impact (required)
- New permissions/capabilities? (`No`)
- Secrets/tokens handling changed? (`No`)
- New/changed network calls? (`No`)
- Command/tool execution surface changed? (`No`)
- Data access scope changed? (`No`)
- If any `Yes`, explain risk + mitigation:
## Human Verification (required)
What you personally verified (not just CI), and how:
- Verified scenarios:
- Edge cases checked:
- What you did **not** verify:
## Compatibility / Migration
- Backward compatible? (`No`)
- Config/env changes? (`Yes`)
- Migration needed? (`No`)
## Human Verification (required)
- Verified scenarios: set direct-text to true; set history-limit to 0;
- Edge cases checked: Yes
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR adds two new features to cron jobs: a `directText` delivery flag to bypass the announce conversion path for text-only payloads, and a `historyLimit` parameter to control conversation history retention per job (0 = unlimited).
**Major changes:**
- Added `directText` boolean field to `CronDelivery` type and schema, with CLI flags `--direct-text` in both `cron add` and `cron edit` commands
- Added `historyLimit` number field to `CronJob` type and schema, with CLI flag `--history-limit <n>` supporting 0 for unlimited history
- Updated delivery routing logic in `src/cron/isolated-agent/run.ts:635` to respect `directText` flag
- Threaded `historyTurnLimit` parameter through the embedded agent runner stack to support per-job history limits
- Renamed `getDmHistoryLimitFromSessionKey` to `getHistoryLimitFromSessionKey` (kept deprecated alias)
**Issues found:**
- Critical logic error in `src/agents/pi-embedded-runner/history.ts:19` breaks documented behavior for `historyLimit=0` (should mean unlimited, but will actually limit to 0 turns)
- Unrelated change to `src/agents/system-prompt.ts` removes `isMinimal` guard for skills section, changing minimal prompt behavior without explanation
- PR title contains typo: "dilivery" should be "delivery"
<h3>Confidence Score: 1/5</h3>
- This PR is unsafe to merge due to a critical logic error that breaks documented behavior
- Score of 1 reflects a critical logic bug in `history.ts` that violates the documented contract (`historyLimit=0` should mean unlimited) and will cause existing tests to fail. The implementation adds valuable functionality but the history limiting logic must be fixed before merge.
- Pay special attention to `src/agents/pi-embedded-runner/history.ts` (critical logic error) and `src/agents/system-prompt.ts` (unrelated behavioral change needs justification)
<sub>Last reviewed commit: c1ef5f8</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#21485: feat(cron): add direct-text flag to deliver text message directly [...
by bydsky · 2026-02-20
91.0%
#13383: fix(cron): route text-only payloads through direct delivery
by Masha-L · 2026-02-10
80.8%
#6522: fix(cron): deliver original message when agent response is heartbea...
by sidmohan0 · 2026-02-01
75.9%
#11216: Fix nightly failures: cron webchat delivery result + media cleanup ...
by DeanoC · 2026-02-07
75.0%
#13638: fix: pass delivery context to cron isolated agent subagents
by dario-github · 2026-02-10
74.9%
#23329: feat: Add Markdown support for cron job payload
by HeXavi8 · 2026-02-22
74.6%
#14391: feat(cron): add raw delivery mode for verbatim output
by therealZpoint-bot · 2026-02-12
74.0%
#8097: fix: auto-convert one-shot reminders for reliable delivery
by Gerrald12312 · 2026-02-03
73.9%
#21896: fix(cron): disable messaging tool when delivery.mode is none
by lailoo · 2026-02-20
73.2%
#16996: fix(cron): parse Telegram topic target format for announce delivery
by Glucksberg · 2026-02-15
72.8%