#17606: feat(ui): add Edit button for cron jobs in Control UI [AI-assisted]
app: web-ui
stale
size: S
Cluster:
Cron Job UI Enhancements
## Summary
The cron jobs list in the Control UI currently supports Disable/Enable, Run, History, and Remove — but **not editing**. To change a job's prompt, schedule, or delivery config, users must remove and recreate the job via the CLI (`openclaw cron edit` works, but the dashboard has no equivalent).
This PR adds an **Edit** button to each cron job row that:
- Populates the "New Job" form with the selected job's current values
- Switches the card title to "Edit Job"
- Replaces "Add job" with "Save changes" + "Cancel"
- Calls the existing `cron.update` Gateway API with a patch object on save
### Files changed
| File | Change |
|------|--------|
| `ui/src/ui/ui-types.ts` | Add `editingJobId: string \| null` to `CronFormState` |
| `ui/src/ui/app-defaults.ts` | Add `editingJobId: null` default |
| `ui/src/ui/controllers/cron.ts` | Add `startEditCronJob()`, `editCronJob()`, `cancelEditCronJob()` |
| `ui/src/ui/views/cron.ts` | Add Edit button, dual-purpose form, Save/Cancel, new props |
| `ui/src/ui/app-render.ts` | Wire new callbacks, import `DEFAULT_CRON_FORM` |
| `ui/src/ui/views/cron.test.ts` | Add new props to test helper |
### Behavior
- Edit button is placed left of Disable in the job action row
- Clicking Edit populates the form at the top with the job's current values
- Cancel resets the form back to blank "New Job" mode
- Save sends a `cron.update` RPC with the full patch, then refreshes the job list
- No backend changes needed — uses the existing `cron.update` API which already supports all fields
## AI-assisted PR
- [x] Marked as AI-assisted
- [x] Built with Cursor + Claude
- [x] Locally tested: built UI, deployed to running gateway, verified Edit/Save/Cancel flow works in the dashboard
- [x] Automated tests pass (5/5 cron view tests, oxlint 0 errors, oxfmt clean)
- [x] I understand what the code does — it adds form-population logic to reuse the existing "New Job" form for editing, and a controller function that calls the already-supported `cron.update` Gateway API
## Test plan
- [x] All 5 existing cron view tests pass (`pnpm exec vitest run` in `ui/`)
- [x] oxlint: 0 warnings, 0 errors
- [x] oxfmt: auto-formatted via pre-commit hook
- [x] Manual: click Edit on an existing job -> form populates correctly
- [x] Manual: modify prompt text -> Save -> job list reflects new prompt
- [x] Manual: Cancel -> form resets to empty "New Job" mode
- [x] Manual: edit a job with delivery config -> delivery fields populate correctly
Made with [Cursor](https://cursor.com)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR adds edit functionality to the cron jobs list in the Control UI, allowing users to modify existing jobs without removing and recreating them. The implementation reuses the existing "New Job" form by populating it with the selected job's values and calling the existing `cron.update` Gateway API.
**Key changes:**
- Added `editingJobId` field to track edit mode state
- Implemented `startEditCronJob()`, `editCronJob()`, and `cancelEditCronJob()` controller functions
- Added Edit button to job action row, Save/Cancel buttons for edit mode
- Form dynamically switches between "New Job" and "Edit Job" modes
**Issue found:**
- Critical bug in `startEditCronJob()` conversion logic (line 163-171): the `everyAmount` calculation always divides by 60_000 regardless of the determined unit, causing incorrect values when editing jobs with hours or days schedules
<h3>Confidence Score: 2/5</h3>
- This PR contains a critical logic bug that will cause data loss/corruption when editing jobs scheduled in hours or days
- Score reflects a well-structured implementation with good test coverage and proper API integration, but the unit conversion bug in `startEditCronJob()` is critical and will cause incorrect behavior when editing jobs with non-minute schedules. The bug must be fixed before merging.
- Pay close attention to `ui/src/ui/controllers/cron.ts` lines 163-171 - the conversion logic bug must be corrected
<sub>Last reviewed commit: 43e2215</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#20368: feat(cron): add UI edit flow for existing scheduled jobs
by PetrouilFan · 2026-02-18
88.6%
#6408: feat(ui): add job filtering and improve run history display
by Cassius0924 · 2026-02-01
79.0%
#5977: fix(ui): handle optional agentId and add updateCronJob function
by xpnobug · 2026-02-01
76.9%
#7024: feat(ui/cron): add silent job indicator and no-runs hints
by sergi039 · 2026-02-02
76.5%
#2071: fix: accept JSON string for cron.add job parameter (#1940)
by andrescardonas7 · 2026-01-26
76.3%
#19998: macOS: harden cron editor updates and compatibility
by tobiasbischoff · 2026-02-18
75.0%
#8698: fix(cron): default enabled to true for new jobs
by emmick4 · 2026-02-04
74.8%
#12303: fix(cron): correct nextRunAtMs calculation and prevent timer stall
by colddonkey · 2026-02-09
74.7%
#9510: Feature/cron UI filter bar
by guxu11 · 2026-02-05
74.6%
#16888: fix(cron): execute missed jobs outside the lock to unblock list/sta...
by hou-rong · 2026-02-15
74.5%