Skip to content

User Tasks

A user task is assigned work that waits in storage. Completing it records a typed response and drives replay.

dart
final decision = await flow.userTask(
  approve,
  reservation,
  id: 'approve',
  title: 'Approve order',
  assignment: Assignment(roleIds: ['order-approver']),
  priority: UserTaskPriority.high,
);

Assignment and Inbox

Assignment is persisted on the command and projected to workflow_user_tasks. The product inbox reads that projection. cdx_feature_workflows renders actions from the sealed UserTaskAction list supplied by the server. It does not infer approval semantics from schema strings.

Claiming a human task never leases the workflow command to a worker. Human claim state lives on the user-task row. Command fencing is for activity workers.

Time

User tasks have no timeout by default. They can remain pending for years using only database state.

  • dueAt is an informational deadline.
  • expiresAt is an optional hard boundary. Recovery records userTaskExpired; workflow code can catch UserTaskExpiredException.

Completion

The service API performs, in one path:

  1. scope and run-visibility authorization;
  2. assignment eligibility;
  3. response validation through the registered codec;
  4. electronic-signature verification when required;
  5. atomic completion, attribution, and replay.

See Also