Schedules
Schedules let you start workflow runs on a recurring basis using cron expressions. Each schedule is a named, durable entity that the engine evaluates on every tick to determine whether a new run should be triggered.
Creating a schedule
Use ScheduleManager::create() to define a named schedule:
use Workflow\V2\Enums\ScheduleOverlapPolicy;
use Workflow\V2\Support\ScheduleManager;
$schedule = ScheduleManager::create(
scheduleId: 'daily-invoice-sync',
workflowClass: InvoiceSyncWorkflow::class,
cronExpression: '0 2 * * *',
arguments: ['nightly'],
timezone: 'America/New_York',
overlapPolicy: ScheduleOverlapPolicy::Skip,
labels: ['team' => 'billing'],
memo: ['origin' => 'scheduled'],
searchAttributes: ['tenant_id' => '42'],
notes: 'Runs every night at 2 AM ET.',
executionTimeoutSeconds: 120,
runTimeoutSeconds: 60,
);
The scheduleId is a unique, user-chosen identifier for the schedule. A run started for a schedule occurrence gets a deterministic workflow instance ID derived from the namespace, the schedule ID and the occurrence time. See Run IDs.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
scheduleId | string | required | Unique identifier for the schedule |
workflowClass | string | required | The workflow class to start |
cronExpression | string | required | Standard cron expression (5 fields) |
arguments | array | [] | Arguments passed to the workflow's handle() method |
timezone | string | 'UTC' | Timezone for evaluating the cron expression |
overlapPolicy | ScheduleOverlapPolicy | Skip | What to do when the previous run is still active |
labels | array | [] | Visibility labels applied to each triggered run |
memo | array | [] | Memo fields applied to each triggered run |
searchAttributes | array | [] | Search attributes applied to each triggered run |
jitterSeconds | int | 0 | Maximum random delay in seconds added to each fire time (thundering-herd mitigation) |
maxRuns | int|null | null | Maximum number of runs before auto-deleting the schedule |
connection | string|null | null | Queue connection for triggered runs (overrides the workflow class default) |
queue | string|null | null | Queue name for triggered runs (overrides the workflow class default) |
notes | string|null | null | Free-form operator notes |
namespace | string|null | null | Namespace for the schedule (defaults to the configured workflows.v2.namespace or 'default') |
executionTimeoutSeconds | int|null | null | Timeout for each logical workflow execution across retries and continue-as-new |
runTimeoutSeconds | int|null | null | Timeout for each individual run, resetting on continue-as-new |
Time zones and daylight saving time
Cron expressions select local times in the schedule's timezone. Clock
changes follow these rules:
- When the hour field selects fewer than all 24 hours, a repeated local time
fires once, at its first occurrence. In New York,
30 1 * * *fires at 01:30 EDT on the day clocks go back. - A local time skipped when clocks go forward fires once, shifted by the
size of the gap. New York
30 2 * * *fires at 03:30 on that day. - An hour field selecting all 24 hours, including
*,*/1and0-23, keeps elapsed-time behavior through the repeated hour. For example,*/15 * * * *keeps firing every 15 real minutes through both passes of New York's repeated hour.
Use timezone: 'UTC' to avoid local clock changes. Use an interval spec when
a fixed elapsed duration matters more than local wall-clock time.
Workflow timeouts
The execution timeout covers one logical execution across retries and continue-as-new. The run timeout limits an individual run and resets on continue-as-new. A run cannot exceed the remaining execution budget. Each scheduled occurrence starts a new execution budget, measured from the actual workflow start rather than its scheduled fire time.
Both options accept positive integer seconds or null. Omitted or null
options leave the corresponding limit unset. Manual triggers, automatic ticks,
buffered starts and backfills apply the stored limits through the default PHP
starter.
For createFromSpec(), put the limits in the action:
$schedule = ScheduleManager::createFromSpec(
scheduleId: 'hourly-invoice-sync',
spec: ['intervals' => [['every' => 'PT1H']]],
action: [
'workflow_class' => InvoiceSyncWorkflow::class,
'input' => ['hourly'],
'execution_timeout_seconds' => 120,
'run_timeout_seconds' => 60,
],
);
Creation and action updates validate PHP workflow timeouts using the same
StartOptions rules as direct starts. No custom starter is needed.
Change limits for future starts by updating the action:
$schedule = ScheduleManager::update($schedule, action: [
...$schedule->action,
'execution_timeout_seconds' => 240,
'run_timeout_seconds' => 90,
]);
The action is replaced, so preserve its workflow class and input as shown.
Previously started runs keep their original deadlines. Set a timeout field to
null to remove that limit from subsequent starts.
Advanced scheduling
The sections below cover scheduling features you will reach for when the basic cron pattern is not enough: fixed-interval firing, mixing cron and interval specs, and overlap policies. Skip ahead unless you need one.
Interval-based schedules
In addition to cron expressions, schedules support interval-based firing using ISO 8601 duration syntax. Use ScheduleManager::createFromSpec() for full control over the schedule spec:
use Workflow\V2\Support\ScheduleManager;
$schedule = ScheduleManager::createFromSpec(
scheduleId: 'health-check-30m',
spec: [
'intervals' => [
['every' => 'PT30M'],
],
],
action: [
'workflow_type' => 'health-check',
'workflow_class' => HealthCheckWorkflow::class,
'input' => ['region' => 'us-east-1'],
],
);
Interval spec fields
| Field | Type | Description |
|---|---|---|
every | string | ISO 8601 duration (e.g., PT30M for 30 minutes, PT1H for 1 hour, P1D for 1 day) |
offset | string|null | Phase offset as ISO 8601 duration — shifts the alignment point of the interval |
The offset parameter controls where in the interval cycle the schedule fires. For example, an hourly interval with a 5-minute offset fires at :05, :05+1h, etc.:
$schedule = ScheduleManager::createFromSpec(
scheduleId: 'offset-hourly',
spec: [
'intervals' => [
['every' => 'PT1H', 'offset' => 'PT5M'],
],
],
action: [
'workflow_type' => 'sync-workflow',
'workflow_class' => SyncWorkflow::class,
'input' => [],
],
);
Mixed cron and interval specs
A single schedule can combine cron expressions and intervals. The engine evaluates all specs and uses the earliest upcoming fire time:
$schedule = ScheduleManager::createFromSpec(
scheduleId: 'mixed-schedule',
spec: [
'cron_expressions' => ['0 12 * * *'], // noon daily
'intervals' => [['every' => 'PT6H']], // every 6 hours
'timezone' => 'America/Chicago',
],
action: [
'workflow_type' => 'report-workflow',
'workflow_class' => ReportWorkflow::class,
'input' => [],
],
);
The createFromSpec method accepts all the same lifecycle parameters as create() (overlapPolicy, jitterSeconds, maxRuns, connection, queue, namespace, etc.) as separate named arguments.
Overlap policies
When a schedule fires and the previous run is still active, the overlap policy controls behavior:
| Policy | Behavior |
|---|---|
Skip | Do not start a new run (default) |
BufferOne | Buffer one pending trigger; skip further triggers until the buffer is drained. On the next tick() after the active run completes, the buffered trigger fires automatically. |
BufferAll | Buffer all pending triggers with no cap; each buffered trigger drains sequentially as previous runs complete. |
AllowAll | Start the new run regardless of the previous run's state |
CancelOther | Cancel the previous run, then start the new run |
TerminateOther | Terminate the previous run, then start the new run |
Managing schedules
Pause and resume
ScheduleManager::pause($schedule);
// The schedule will not trigger while paused.
ScheduleManager::resume($schedule);
// next_fire_at is recalculated from now.
Update
ScheduleManager::update(
$schedule,
cronExpression: '30 3 * * *',
timezone: 'America/Chicago',
overlapPolicy: ScheduleOverlapPolicy::AllowAll,
notes: 'Moved to 3:30 AM CT.',
);
Only a change to the spec (cron expressions, intervals or timezone) or to the jitter recalculates next_fire_at. Other updates keep it, so they cannot skip a due fire. The ScheduleUpdated event lists in changed_fields only the fields whose stored value changed.
An update that changes nothing records no event and keeps next_fire_at, including its jitter. On a schedule loaded fresh, wasChanged() on the returned model is false.
Changing the action (workflow type, arguments, queue routing or timeouts) drops triggers buffered under BufferOne or BufferAll, because they were captured for the old action. Each dropped trigger is recorded as a ScheduleTriggerSkipped event with reason action_changed and its occurrence_time.
Delete
ScheduleManager::delete($schedule);
Deleting is soft — the row remains with status deleted and a deleted_at timestamp. A deleted schedule cannot be paused, resumed, updated, or triggered. Its id stays taken. See Apply from configuration.
Apply from configuration
Deploy tooling can apply the same schedule definitions on every deploy. Create each schedule, and update it when its id is taken:
use Workflow\V2\Exceptions\ScheduleAlreadyExistsException;
use Workflow\V2\Support\ScheduleManager;
try {
ScheduleManager::create(
scheduleId: 'daily-invoice-sync',
workflowClass: InvoiceSyncWorkflow::class,
cronExpression: '0 2 * * *',
timezone: 'America/New_York',
);
} catch (ScheduleAlreadyExistsException $e) {
if ($e->existingStatus === 'deleted') {
throw $e; // The id belonged to a deleted schedule. Pick a new id.
}
ScheduleManager::update(
ScheduleManager::findByScheduleId($e->scheduleId, $e->namespace),
cronExpression: '0 2 * * *',
timezone: 'America/New_York',
);
}
Re-applying an unchanged definition records nothing, so this is safe to run on every deploy.
Schedule ids are not reusable. A deleted schedule, including one deleted when its max_runs ran out, keeps its id. Creating a schedule with that id raises ScheduleAlreadyExistsException with existingStatus deleted. Use a new id instead.
Native Server applies the same id rule: creating a schedule with a taken id returns 409 schedule_already_exists. Since native Server 3.6.0, re-applying an unchanged schedule is also a no-op: it records no ScheduleUpdated event and keeps next_fire_at. The response outcome is still updated. Native Server releases before 3.6.0 record ScheduleUpdated and recompute next_fire_at on every update, including an unchanged one.
Describe
$description = ScheduleManager::describe($schedule);
$description->scheduleId; // 'daily-invoice-sync'
$description->namespace; // 'default'
$description->status; // ScheduleStatus::Active
$description->spec; // ['cron_expressions' => ['0 2 * * *'], 'timezone' => 'America/New_York']
$description->overlapPolicy; // ScheduleOverlapPolicy::Skip
$description->firesCount; // 47
$description->nextFireAt; // DateTimeInterface|null
$description->lastFiredAt; // DateTimeInterface|null
$description->latestInstanceId; // 'schedule:daily-invoice-sync:...'
$description->jitterSeconds; // 0
$description->note; // 'Runs every night at 2 AM ET.'
$description->toArray(); // full array representation
Find by schedule ID
$schedule = ScheduleManager::findByScheduleId('daily-invoice-sync');
Triggering schedules
Manual trigger
$instanceId = ScheduleManager::trigger($schedule);
This immediately evaluates the overlap policy and, if allowed, starts a new workflow run. Returns the instance ID of the started workflow, or null if the trigger was skipped.
Tick (evaluate all due schedules)
$results = ScheduleManager::tick();
// Returns rows with schedule_id, instance_id, outcome, occurrence_time,
// last_fired_at, and next_fire_at when those fields apply.
tick() triggers due schedules, which are active schedules whose next_fire_at is in the past. Each call starts at most $limit of them (tick(int $limit = 100)), oldest first and shared round-robin across namespaces. Due schedules beyond the limit stay due for the next call. The occurrence_time field is the due fire time the scheduler observed. After each trigger, next_fire_at advances from the current clock to the next cron or interval occurrence.
Missed-fire policy
Live schedule evaluation uses fire once, then resume semantics. If the scheduler is down across one or more nominal fire times, the first tick after recovery starts one workflow for the overdue next_fire_at, records that due time as occurrence_time, and then advances next_fire_at from the current clock. Additional nominal occurrences that passed while the scheduler was down are skipped by live evaluation.
The same rule applies when the scheduler is running but cannot keep up. A schedule that is still waiting for a pass when its next nominal time arrives fires once and skips the occurrences in between. See Pass size and bursts.
Use backfill() when every missed occurrence must run. Backfill enumerates the requested window explicitly and records each occurrence separately.
Artisan command
Run a single tick from the command line:
php artisan workflow:v2:schedule-tick
php artisan workflow:v2:schedule-tick --json
php artisan workflow:v2:schedule-tick --limit=500
To evaluate schedules continuously, call this command from Laravel's task scheduler:
// app/Console/Kernel.php
$schedule->command('workflow:v2:schedule-tick')->everyMinute();
Pass size and bursts
Each workflow:v2:schedule-tick pass starts at most limit due schedules and,
separately, drains at most limit buffered actions. limit comes from the
--limit option, otherwise from workflows.v2.schedules.tick_limit
(DW_V2_SCHEDULE_TICK_LIMIT), and defaults to 100. A value that is not a
positive integer makes the command fail without evaluating any schedule; it is
never replaced by another size. The setting and the option need Workflow 2.16.0
or later.
Both batches are shared round-robin across namespaces, oldest first, so one busy
namespace cannot hold back another. Due schedules beyond limit stay due and are
picked up by the next pass. When N schedules fall due together, nothing older
is due and every start succeeds, all of them fire within ceil(N / limit)
passes. With the every-minute recipe, the last one starts up to
ceil(N / limit) - 1 minutes after the first. Set limit at or above the
largest burst you expect.
The bound is longer when:
- a start fails: the occurrence stays due and is retried on later passes, so a schedule that keeps failing keeps taking a slot while it is the oldest;
- schedules that became due earlier, or more schedules falling due before the burst clears, are selected first;
- ticks run late or are skipped.
Under sustained overload, a schedule that waits past its next nominal time
fires once and skips the occurrences in between, as described in
Missed-fire policy. Use backfill() if those occurrences
must run.
Alert on the operator metrics schedules.missed, schedules.oldest_overdue_at
and schedules.max_overdue_ms, and on increases in schedules.failures_total.
Laravel merges a package's config into a published config file one top-level key
at a time. An app that published config/workflows.php before 2.16.0 keeps its
own v2 array, so DW_V2_SCHEDULE_TICK_LIMIT is not read: the command uses 100
and still accepts --limit. To use the setting, re-publish the config file, or
add this entry to the v2 array of your published file:
'schedules' => [
'tick_limit' => env('DW_V2_SCHEDULE_TICK_LIMIT', 100),
],
Native Server
Native Server 3.x evaluates schedules itself, so there is no command to run or
schedule. Each Server process runs a maintenance loop: it waits 250 ms, then
drains up to 100 buffered actions and starts up to 100 due schedules, ordered by
next_fire_at, then waits again. The batch size is fixed; there is no setting
for it. Schedule passes serialize across Server nodes, so adding nodes does not
raise throughput. A burst of N due schedules fires within ceil(N / 100)
passes, in due order.
A start that Server refuses is recorded as a failure, and the schedule moves on
to its next occurrence, so a failing schedule does not keep its slot. A schedule
whose spec cannot be evaluated stays due and is retried on every pass. The
schedule:evaluate --limit command of the frozen PHP Server does not apply to
native Server.
Max runs
When maxRuns is set, the schedule tracks remaining_actions. After the last allowed trigger, the schedule is automatically soft-deleted.
$schedule = ScheduleManager::create(
scheduleId: 'one-shot-retry',
workflowClass: RetryWorkflow::class,
cronExpression: '*/5 * * * *',
maxRuns: 3,
);
// After 3 triggers, the schedule status becomes 'deleted'.
Backfill
Backfill triggers workflows for past cron occurrences that were missed (e.g., after a schedule was paused, a deployment outage, or late creation):
$results = ScheduleManager::backfill(
$schedule,
from: new DateTimeImmutable('2026-04-10 00:00:00'),
to: new DateTimeImmutable('2026-04-14 00:00:00'),
);
// Returns: [['schedule_id' => '...', 'instance_id' => '...|null', 'cron_time' => '...'], ...]
Each missed cron occurrence is triggered sequentially. The schedule's overlap policy applies to each occurrence, with one exception: buffer policies (BufferOne, BufferAll) are treated as AllowAll during backfill. Buffering is a real-time flow-control mechanism that has no meaning for catch-up operations — backfill should start every missed occurrence, not queue them into a buffer that will never drain. You can also override the policy explicitly:
$results = ScheduleManager::backfill(
$schedule,
from: new DateTimeImmutable('2026-04-10 00:00:00'),
to: new DateTimeImmutable('2026-04-14 00:00:00'),
overlapPolicyOverride: ScheduleOverlapPolicy::AllowAll,
);
Backfill respects maxRuns — if the schedule's remaining actions are exhausted mid-backfill, the operation stops and the schedule is auto-deleted.
Run IDs
A run started for a schedule occurrence, whether a scheduled fire, a backfill or a buffered action, gets a deterministic workflow instance ID:
schedule.ns:{namespace hash}:{schedule ID length}:{schedule ID}:backfill:{occurrence}
{namespace hash}is the first 32 hex characters of the SHA-256 of the schedule's namespace.{schedule ID length}is the length of the schedule ID in bytes.{occurrence}is the occurrence time in Unix seconds. The suffix readsbackfillfor every occurrence, not only for backfills.- If the whole ID would be longer than 191 characters, or the schedule ID
contains a character outside
[A-Za-z0-9._:-], the{schedule ID length}:{schedule ID}part is replaced byh:{SHA-256 of the schedule ID}(64 hex characters).
For example, schedule nightly in namespace default firing at
2026-11-18 09:00 UTC starts
schedule.ns:37a8eec1ce19687d132fe29051dca629:7:nightly:backfill:1794992400.
The namespace is part of the ID, so schedules with the same ID in different
namespaces start separate instances. An occurrence whose run has already
started is not started again; the repeated fire is skipped and recorded as
already_fired_occurrence.
Where the format applies:
- Embedded Workflow 2.15.15 and later. A manual
trigger()has no occurrence, so its ID ends with the trigger time in Unix milliseconds instead ofbackfill:{occurrence}. Runs started by earlier releases keep theirschedule:{scheduleId}:{suffix}IDs. - Native Server 3.13.0 and later. Manual triggers have no occurrence and keep server-generated IDs. Runs started by earlier Server releases keep their generated IDs.
Reading the occurrence in workflow code
A schedule passes the same arguments to every run, including backfilled ones.
To learn which occurrence a run stands for, call $this->scheduleOrigin() in
the workflow. It returns a Workflow\V2\Support\ScheduleOrigin, or null
for a run that no schedule started. It is available in embedded Workflow
2.30.0 and later.
scheduleIdis the schedule's identifier.occurrenceTimeis the time the scheduler evaluated, as aDateTimeImmutable. For a tick it is the jittered fire time. For a backfill it is the enumerated past occurrence. It isnullfor a manualtrigger(), which has no occurrence.triggerNumberis which fire of the schedule this was, starting at 1.
The value comes from the run's own ScheduleTriggered history event, which is
committed with the run's start. It is available on the first workflow task and
is the same on every replay. It is not the run's start time or Workflow::now(),
so it does not drift with jitter, scheduler delays or buffered starts.
A daily report that processes the day before its occurrence:
use Workflow\V2\Workflow;
final class DailyReportWorkflow extends Workflow
{
public function handle(): mixed
{
$windowEnd = $this->scheduleOrigin()?->occurrenceTime
?? throw new LogicException('Start this workflow from a schedule.');
$windowStart = $windowEnd->modify('-1 day');
return Workflow::activity(
BuildReport::class,
$windowStart->format(DATE_ATOM),
$windowEnd->format(DATE_ATOM),
);
}
}
With a 0 0 * * * cron and jitter, a tick that fires at 00:00:12 UTC on
2026-11-18 reports 2026-11-17T00:00:12 to 2026-11-18T00:00:12. A backfill
covering the midnight occurrences of November 1, 2 and 3 starts three runs
whose windows end at those midnights, even though all three start now.
Which runs keep the origin:
- Continue-as-new. The successor is the same scheduled execution. It
records its predecessor's
ScheduleTriggeredright after its start and reads the same origin. Native Server has done this since 3.5.0. - Retries and redrive. Activity retries happen inside the run, so they
see the same origin. A schedule-started run is never retried as a new run,
and redriving a failed schedule-started run is refused with
unsupported_history. No retried run can lose the origin. - Later fires. Each fire, tick or backfill, starts its own run with its own origin.
Runs started before this API existed already have the event, so they read their
origin too. Histories without the event read null.
Service-mode workers read the same value from their workflow context. Use them
with native Server 3.13.0 or later, which records the ScheduleTriggered event
they read.
- PHP SDK 3.13.0 and later:
WorkflowContext::scheduleOrigin(). - Python SDK 2.19.0 and later:
ctx.schedule_origin. - Rust SDK 4.19.0 and later:
ctx.schedule_origin().
Queue routing
When connection or queue is set on a schedule, triggered workflows dispatch to that connection and queue instead of the workflow class default:
$schedule = ScheduleManager::create(
scheduleId: 'priority-sync',
workflowClass: InvoiceSyncWorkflow::class,
cronExpression: '0 * * * *',
connection: 'redis',
queue: 'high-priority',
);
// Every triggered run dispatches to redis/high-priority,
// regardless of InvoiceSyncWorkflow's default routing.
The routing precedence is: schedule fields → workflow class defaults → global queue config.
Jitter
When multiple schedules share the same cron expression, they all fire at the exact same instant, creating a thundering-herd spike. The jitterSeconds parameter spreads triggers across a random window to smooth the load.
$schedule = ScheduleManager::create(
scheduleId: 'hourly-report',
workflowClass: ReportWorkflow::class,
cronExpression: '0 * * * *',
jitterSeconds: 300, // fire within 0–300 seconds after the top of the hour
);
When jitterSeconds is set, each computed next_fire_at is offset by a random value between 0 and jitterSeconds (inclusive). The jitter is re-rolled every time the next fire time is calculated — after a trigger, after a resume, or after an update.
Jitter applies only to the tick-evaluation fire time stored in the database. Backfill enumeration always uses canonical (unjittered) cron times so that backfilled occurrences land on exact cron boundaries.
Setting jitterSeconds to 0 (the default) disables jitter entirely — fire times are exact cron matches.
History event types
Schedule lifecycle events are recorded on two separate event streams:
- Workflow-run lineage. When a schedule triggers a workflow, a
ScheduleTriggeredevent is appended to the started run's history (workflow_history_events). This gives the run a verifiable link back to the schedule that started it. - Schedule audit stream. Every schedule lifecycle transition is
recorded in the per-schedule audit log
(
workflow_schedule_history_events) under a monotonically increasingsequencefield. The audit stream is authoritative for "what happened to this schedule"; the run history is authoritative for "why this run was started".
Both streams use the same HistoryEventType enum and the same
HistoryEventPayloadContract payload-key registry, so event names and
payload shapes stay in sync across streams.
Run-lineage event (on the started workflow run)
ScheduleTriggered is appended to the triggered workflow run's history
with the following payload keys:
schedule_id— schedule's user-facing identifier.schedule_ulid— schedule's internal ULID primary key.cron_expression,timezone,overlap_policy— the schedule's primary cron expression, IANA timezone, and active overlap policy at trigger time.trigger_number— which trigger this was (1-indexed).occurrence_time— the schedule fire time the scheduler evaluated. Tick-driven triggers record the duenext_fire_at; backfill triggers record the enumerated backfill occurrence. With jitter enabled, the tick-driven value includes the jittered fire time stored on the schedule.
Schedule audit stream (on the schedule itself)
Every schedule lifecycle transition is recorded on the schedule's own
audit stream. Sequences start at 1 for ScheduleCreated and increment
monotonically per schedule.
| Event | When recorded | Payload keys |
|---|---|---|
ScheduleCreated | Schedule was created | spec, action, overlap_policy, next_fire_at, command_context |
SchedulePaused | Schedule was paused | reason, paused_at, command_context |
ScheduleResumed | Schedule was resumed | next_fire_at, command_context |
ScheduleUpdated | Schedule cron, timezone, spec, action, or policy was changed | changed_fields, spec, action, overlap_policy, next_fire_at, command_context |
ScheduleTriggered | A workflow run was started from the schedule | workflow_instance_id, workflow_run_id, outcome, effective_overlap_policy, trigger_number, occurrence_time, command_context |
ScheduleTriggerSkipped | A trigger was skipped due to overlap policy, non-triggerable status, or exhausted actions | reason, skipped_trigger_count, last_skipped_at, occurrence_time, command_context |
ScheduleDeleted | Schedule was soft-deleted — either by an explicit delete call or by exhausting max_runs (reason: max_runs_exhausted) | reason, deleted_at, command_context |
command_context carries the principal, request id, source, and reason
attributes recorded by ScheduleManager when the caller passes a
CommandContext. It is optional — events recorded without a context
omit the key rather than writing a blank value.
Payload contract stability
The payload keys in both tables above are declared in
Workflow\V2\Support\HistoryEventPayloadContract, asserted on every
write, and pinned by test coverage in the workflow package. Adding a
new key to any schedule event is a wire-format change and follows the
history-event change rules in the
version compatibility contract.
Retention
In embedded Laravel, Workflow 2.29.0 and later keep up to 1,000 audit snapshots per schedule by
default. The first event, usually ScheduleCreated, and the newest events keep their original
sequence numbers. Set DW_V2_SCHEDULE_AUDIT_HISTORY_LIMIT or
workflows.v2.schedules.audit_history_limit to an integer of at least 2 to change the cap.
Each audit append prunes up to 100 old snapshots. To reduce an existing schedule's history manually,
run the following command repeatedly until retained_events is at or below configured_limit.
php artisan workflow:v2:schedule-audit-prune --namespace=orders --schedule=daily-invoices
Deleting a schedule through the API records ScheduleDeleted and keeps its retained audit history
and firing receipts. After physically removing the schedule row, clean up its orphaned records in
that exact namespace.
php artisan workflow:v2:schedule-audit-prune --namespace=orders --limit=500
The cleanup limit applies to audit events and firing receipts combined. Repeat until both
audit_events_deleted and occurrences_deleted are zero. Use --null-namespace in place of
--namespace for legacy rows whose namespace is SQL NULL.
Before enabling the cap, run the schedule occurrence migration and stop older scheduler processes
and schedule writers. For a staged upgrade, set workflows.v2.schedules.audit_history_limit to PHP
null until those processes have stopped. Firing receipts survive snapshot pruning and continue to
prevent duplicate starts. Upgrade
instructions
Visibility
The audit stream is exposed through every operator surface:
- In-process (Eloquent).
WorkflowSchedule::historyEvents()(resolved throughConfiguredV2Models::query( 'schedule_history_event_model', ...)) returns the stream for a schedule from within the host application. - Waterline HTTP.
GET /waterline/api/v2/schedules/{scheduleId}/historyreturns the stream withlimit(1–500, default 100) andafter_sequencecursor pagination. The response is scoped to the Waterline namespace so multi-tenant deployments only see their tenant's audit rows. - Waterline UI. The History action on each row in the Waterline schedule registry opens a modal that renders the stream for that schedule. Events are shown with their sequence, recorded timestamp, event type, linked workflow instance and run IDs, and formatted payload, with a Load more control that advances the cursor in batches of 100.
- Standalone server HTTP.
GET /api/schedules/{scheduleId}/historyon the standalone server returns the same stream with the same pagination contract and the sameX-Namespacescoping rules. History remains available after a schedule is soft-deleted, since the audit trail is what operators reach for to reconstruct a removed schedule. - CLI.
dw schedule:history <schedule-id>prints the stream as a table (Seq,Event,Recorded At,Workflow Refs) with a More events available hint whenhas_moreis true.--limitand--after-sequenceforward to the server endpoint,--allpages through every remaining event, and--output=json/--output=jsonlemit structured output (jsonldrops the cursor envelope so each line is a self-contained event). - Python SDK.
Client.get_schedule_history(schedule_id, *, limit=None, after_sequence=None)returns a singleScheduleHistoryPage, andClient.iter_schedule_history(schedule_id, *, limit=None, after_sequence=None)is anAsyncIterator[ScheduleHistoryEvent]that pages through the full stream with the same keyword arguments.ScheduleHandleexposes matching.history(...)and.iter_history(...)convenience methods.limitis clamped server-side between 1 and 500 (default 100) andafter_sequenceis a non-negative cursor obtained from the previous page'snext_cursor.
All of these surfaces read from the same workflow_schedule_history_events
table; the payload-key contract in
Payload contract stability applies
regardless of which surface the operator uses.
Migration behavior for pre-audit schedules
The schedule audit stream was introduced together with the
workflow_schedule_history_events table. Schedules that were
created before that migration ran have no retroactive
ScheduleCreated event — ScheduleManager records audit events
only as lifecycle transitions happen, and the migration does not
synthesize a backfilled event for existing schedules.
What this means for operators:
- A pre-existing schedule's stream is empty until its next lifecycle transition. Pausing, resuming, updating, triggering, skipping a trigger, or deleting the schedule appends events as normal from that point on.
- Sequence numbers still start at
1and increment monotonically per schedule. A pre-existing schedule whose first recorded event is aSchedulePausedwill havesequence = 1on that row; the absence of a precedingScheduleCreatedis expected. ScheduleTriggeredandScheduleTriggerSkippedevents are written every time a tick evaluates the schedule, so any schedule that fires on a cron cadence after the migration will accumulate audit rows without operator intervention.- No operator action is required to opt a schedule into the audit stream. The stream is always on; it simply has no rows until the first post-migration event is written.
Skip tracking
When a trigger is skipped (due to overlap policy, non-triggerable status, or exhausted actions), the schedule tracks the skip:
last_skip_reason— why the most recent trigger was skipped (e.g.,overlap_policy_skip,status_not_triggerable,remaining_actions_exhausted)last_skipped_at— when the skip occurredskipped_trigger_count— cumulative number of skipped triggers
These fields are included in ScheduleManager::describe() and the Waterline schedule detail API.
Namespace scoping
Schedules belong to a namespace. When namespace is passed to create() or createFromSpec(), the schedule is scoped to that namespace. When omitted, the schedule inherits the configured workflows.v2.namespace (defaulting to 'default').
Schedule IDs are unique within a namespace — the same scheduleId can exist in different namespaces without conflict.
The standard PHP schedule starter passes the schedule's stored namespace to the workflow instance, run and durable tasks. A later change to the application's default namespace does not move an existing schedule's executions. Use Workflow 2.4.2 or newer for this namespace propagation.
$schedule = ScheduleManager::create(
scheduleId: 'daily-sync',
workflowClass: SyncWorkflow::class,
cronExpression: '0 2 * * *',
namespace: 'billing',
);
// Find by schedule ID within a namespace:
$found = ScheduleManager::findByScheduleId('daily-sync', namespace: 'billing');
When Waterline is configured with a namespace (waterline.namespace), the schedule list and detail endpoints automatically scope to that namespace. This ensures multi-tenant deployments show only the schedules belonging to the operator's namespace.
Database
The schedule table (workflow_schedules) is created by migration 2026_04_14_000157. The model class is configurable via workflows.v2.schedule_model.
If your deployment runs package migrations alongside application migrations, migration 157 detects a pre-existing workflow_schedules table and handles it gracefully: if the table already matches the package schema it is left as-is; if it was created by an earlier shim migration with a different schema, it is replaced.