You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config-reference.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -257,6 +257,33 @@ timezone = "UTC"
257
257
258
258
The external `cronjob.toml` uses `[[jobs]]` (same fields). See [Usercron docs](cronjob.md#usercron--hot-reload-with-cronjobtoml) for details.
259
259
260
+
### Usercron-only `[[jobs]]` fields
261
+
262
+
These fields are valid only in the external usercron file, for example `$HOME/.openab/cronjob.toml`. They are rejected in baseline `[[cron.jobs]]` because OpenAB only writes state back to the user-managed cron file.
263
+
264
+
| Key | Type | Default | Description |
265
+
|-----|------|---------|-------------|
266
+
|`id`| string |*required with `disable_on_success`*| Stable job ID used when the scheduler writes `enabled = false` or `thread_id` back to `cronjob.toml`. |
267
+
|`disable_on_success`| string | — | Command to run before sending the scheduled prompt. |
268
+
|`disable_on_success_match`| string |*required with `disable_on_success`*| Marker that must appear in stdout or stderr, in addition to exit code `0`, before the job is considered complete. |
269
+
|`disable_on_success_timeout_secs`| integer |`60`| Timeout for the completion check command. |
270
+
|`disable_on_success_working_dir`| string | — | Working directory for the completion check command. |
271
+
272
+
Example:
273
+
274
+
```toml
275
+
[[jobs]]
276
+
id = "fix-unit-tests"
277
+
enabled = true
278
+
schedule = "*/10 * * * *"
279
+
channel = "123456789"
280
+
message = "Unit tests are still failing. Continue fixing them."
281
+
disable_on_success = "npm test && echo OPENAB_GOAL_SUCCESS"
Copy file name to clipboardExpand all lines: docs/cronjob.md
+29-1Lines changed: 29 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -256,6 +256,33 @@ Agent: ✅ Written to cronjob.toml, takes effect within 1 minute
256
256
257
257
This enables mobile-friendly schedule management — talk to your agent from your phone, and it updates the cron file for you.
258
258
259
+
### Goal-Driven Auto-Disable
260
+
261
+
Usercron jobs can stop themselves once a goal is complete. Add `disable_on_success` to run a command before the scheduled prompt is sent. The job is considered complete only when the command exits `0` **and** stdout or stderr contains `disable_on_success_match`.
262
+
263
+
```toml
264
+
[[jobs]]
265
+
id = "fix-unit-tests" # required for scheduler writeback
266
+
enabled = true
267
+
schedule = "*/10 * * * *"
268
+
channel = "1490282656913559673"
269
+
message = "Unit tests are still failing. Continue fixing them and report progress."
270
+
271
+
disable_on_success = "npm test && echo OPENAB_GOAL_SUCCESS"
3. If the command exits `0` and output contains `disable_on_success_match`, OpenAB posts `✅ Goal achieved`, writes `enabled = false` back to `$HOME/.openab/cronjob.toml`, and skips the regular prompt.
282
+
4. Otherwise, OpenAB sends the regular `message` and the agent continues working.
283
+
284
+
`disable_on_success` is supported only in usercron `[[jobs]]`, not baseline `[[cron.jobs]]`. This keeps scheduler writeback limited to the user-managed cron file.
285
+
259
286
### Kubernetes Deployment
260
287
261
288
Mount `cronjob.toml` on a PVC so it persists across pod restarts, and set `usercron_path` in your config.toml:
-**Minute-aligned**: The scheduler aligns to minute boundaries (`:00`), so `0 9 * * *` fires at exactly 09:00:00, not at whatever second the process started.
274
301
-**Overlap protection**: If a previous execution of the same job is still running, the next tick is skipped.
275
302
-**Isolation**: Cron failures are logged but never block interactive chat traffic.
276
-
-**Stateless**: No persistence needed. Schedules are re-evaluated from config on restart.
303
+
-**Usercron persistence**: For usercron jobs, the scheduler may write `thread_id` and `enabled = false` back to `cronjob.toml`.
277
304
-**Graceful shutdown**: In-flight cron tasks are waited on (up to 30 seconds) during shutdown.
278
305
279
306
## Sender Identity
@@ -320,3 +347,4 @@ See [Kubernetes CronJob Reference Architecture](cronjob_k8s_refarch.md) for the
320
347
| Channel not found | Bot not in channel | Invite the bot to the target channel |
321
348
| Usercron not reloading | File not saved / wrong path | Check logs for `usercron file changed, reloading`|
322
349
| Usercron parse error | Invalid TOML syntax | Check logs for `failed to parse usercron file`|
350
+
| Goal job does not auto-disable | Command did not exit `0` or output did not include `disable_on_success_match`| Run the command manually and confirm both conditions |
0 commit comments