Gate a stage with checks
Register a check, gate a stage on it, and advance the task automatically once it passes.
This guide makes a stage that a task cannot leave until a check has passed, and that advances the task on its own once it does. You will register a check, add rules to two stages, and see honestly where the task will wait for a person.
If checks and rules are new, read What moves a task without a person first.
Before you start
Every step here needs admin on the space. See
Authentication. You also need a workflow with two
stages in sequence — this guide uses In review and Done — and, for the
automatic move in step 4, the workflow's auto_advance_enabled turned on (see
Workflows).
The examples use MCP tools; the reference pages list every field.
1. Register the check
Define the check in the space's registry with checks_registry_create:
// checks_registry_create
{ "space_key": "OPS", "code": "reviewed", "description": "A reviewer approved the work" }2. Create the check when a task reaches the stage
check_rules_create identifies a stage by its numeric stage_id, not by name.
Get the ids for your workflow's stages with stages_list:
// stages_list
{ "space_key": "OPS", "workflow_slug": "delivery" }The response lists each stage with its id:
{ "stages": [ { "id": "148", "name": "In review", "group": "Doing" }, { "id": "149", "name": "Done", "group": "Done" } ] }Add a create check rule on In review
(here stage_id 148), so that entering the stage puts a pending reviewed
check on the task:
// check_rules_create
{ "space_key": "OPS", "check_code": "reviewed", "stage_id": 148, "effect": "create" }3. Gate the next stage on it
Add a require check rule on Done (here stage_id 149), so a task cannot
enter Done until reviewed has passed:
// check_rules_create
{ "space_key": "OPS", "check_code": "reviewed", "stage_id": 149, "effect": "require" }Now a transition into Done while reviewed is not passed is refused with
requires check reviewed to be passed (currently pending).
4. Advance the task automatically once it passes
Add a sentinel rule on In review that
moves the task to Done once its checks all pass:
// sentinel_rules_create
{ "space_key": "OPS", "workflow": "delivery", "stage": "In review", "predicate": "all_passed", "action": "transition", "target_stage": "Done" }When reviewed passes, the sentinel can move the task to Done with no person
involved, and because reviewed is passed, the require gate on Done lets it
in. The move is not instant: it happens on the next sentinel sweep, which runs
every 30 seconds and again shortly after a check is set. It happens only while
all of these hold:
- the task has no blocking hold
- no lease of a pool named by an assignment rule at
In reviewthat applies to the task, created since the task enteredIn review, is still active - a WIP constraint on
Done, if there is one, has room; while it is full, the sentinel tries again on each sweep - the space, the stage and the task are not archived, and the task has not
been resolved since it entered
In review
The full list is in What moves a task without a person § A sentinel rule advances or holds the task.
Where the task waits for a person
Be clear about the limits before you rely on this:
- A check only passes when someone sets it. Nothing in Cadence passes
reviewedon its own; a worker on the stage or an operator sets it topassed(see Checks). Until then the task waits inIn reviewindefinitely — the sentinel'sall_passedpredicate is not true whilereviewedis still pending. - A blocking hold stops the move. The sentinel never moves a task with a
blocking hold, and Cadence never clears one on its own. A person clears it,
or a worker whose lease reaches the task replaces it with an advisory hold
and clears that (see
Hold a task and clear a hold). Cadence
places some blocking holds itself, for example when a worker's lease fails,
so a task can stop in
In reviewwithreviewedpassed until you clear the hold. - An admin can force past the gate. A transition with
force: truebypasses therequiregate. Forcing needs admin, and the bypass is recorded.
For the full account of what runs on its own and what does not, read What moves a task without a person.
Give a worker a secret it needs
Store a secret as a credential, scope it to a space or a single pool, and have a worker version read it as an environment variable.
Take work in with an inbound webhook
Register a webhook token, point an inbound rule at the receiver, and turn an outside delivery into a task.