Commit a5c19b3
Bartok9
feat(workflow): add optional precheck gate to skip empty runs
Adds a workflow-level `precheck` evalexpr gate evaluated once at run start,
before any step executes. When it evaluates to false the run short-circuits
with zero step actions (no messages, webhooks, or agent turns) and returns a
completed result with a skipped-precheck trace entry.
This lets a scheduled poller workflow ("every 15m, if there's new work, have
an agent summarize it") cheaply skip empty ticks instead of spinning up the
step chain each time — the same zero-cost-gate pattern we contributed to the
OpenClaw and Hermes cron systems.
- Additive: workflows without `precheck` are unchanged (serde default None).
- Reuses the existing `evaluate_condition` machinery (4 KB expr cap + 100 ms
timeout), so no new execution surface and no shell — same safety envelope
as step `if:` conditions.
- Fail-open: a precheck that errors runs the steps (a bad gate never silently
disables a workflow) and logs a warning.
- Tests: precheck field parse + JSON round-trip + default-None.
Refs #2297
Signed-off-by: Bartok9 <danielrpike9@gmail.com>1 parent df9e773 commit a5c19b3
2 files changed
Lines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1022 | 1052 | | |
1023 | 1053 | | |
1024 | 1054 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
23 | 30 | | |
24 | 31 | | |
| |||
298 | 305 | | |
299 | 306 | | |
300 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
301 | 323 | | |
302 | 324 | | |
303 | 325 | | |
| |||
0 commit comments