feat(workflow): add optional precheck gate to skip empty runs - #2303
Open
Bartok9 wants to merge 1 commit into
Open
feat(workflow): add optional precheck gate to skip empty runs#2303Bartok9 wants to merge 1 commit into
Bartok9 wants to merge 1 commit into
Conversation
Bartok9
force-pushed
the
bartok9/workflow-precheck-gate
branch
5 times, most recently
from
July 29, 2026 13:18
188c593 to
18924a7
Compare
Bartok9
force-pushed
the
bartok9/workflow-precheck-gate
branch
7 times, most recently
from
August 5, 2026 13:19
46debf0 to
4a379a6
Compare
Bartok9
force-pushed
the
bartok9/workflow-precheck-gate
branch
3 times, most recently
from
August 14, 2026 13:27
e0d77f5 to
a5c19b3
Compare
Bartok9
force-pushed
the
bartok9/workflow-precheck-gate
branch
2 times, most recently
from
August 19, 2026 13:22
d495c95 to
0bd0d7b
Compare
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 block#2297
Signed-off-by: Bartok9 <danielrpike9@gmail.com>
(cherry picked from commit d495c95)
Signed-off-by: Bartok9 <259807879+Bartok9@users.noreply.github.com>
Bartok9
force-pushed
the
bartok9/workflow-precheck-gate
branch
from
August 19, 2026 16:55
0bd0d7b to
a53cee2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2297
Problem
Schedule-triggered workflows fire on a cron/interval. Today the only convergence control is per-stepif:conditions. A poller workflow ("every 15m, check X, and if there's new work have an agent summarize it") still spins up the step chain — and any agent/webhook/message action — on every tick even when there's nothing to do. On a busy relay with many scheduled agent workflows that's a real, silent cost and a source of empty-run channel noise.Why it matters
Buzz makes agents first-class; scheduled agent workflows are a natural pattern. A cheap gate that decides whether there's work before doing expensive work makes them affordable and quiet. This is the same zero-cost-gate idea we contributed to the OpenClaw (
job.precheck) and Hermes (NO_WORKwake gate) cron systems.What this adds
A workflow-level
precheckevalexpr gate, evaluated once at run start, before any step:precheckfalse → run short-circuits with zero step actions, returnsCompletedwith a skipped-precheck trace entry.precheck→ unchanged behavior (serde defaultNone).Design / safety
evaluate_condition— inherits the same 4 KB expression cap + 100 ms timeout envelope as stepif:. No new execution surface, no shell.if:.How to test
The gate's decision uses the same
evaluate_conditionprimitive that's already covered by the executor condition tests (condition_*).Notes / open to maintainer direction
if:" for clean single-skip semantics + a place to hang a skipped metric later.Scheduletriggers only, or add a dedicated skipped run-status/metric, if preferred (see issue [Proposal] Scheduled-workflow precheck gate: skip runs with zero token/action cost #2297 comment).Signed-off-by DCO.