Durable Operations Runbook
When a process stops making progress, inspect its Run state and Timeline first. Determine whether it is waiting for an external result, an available worker, or recovery from a fault. This runbook covers the PostgreSQL and MySQL Stores provided by the project.
| Symptom | Start here |
|---|---|
| Many Runs cannot continue and database errors appear | Store outage |
| A Run has not completed within the expected time | Stuck Run or missing capability |
| An external call timed out and its outcome is unknown | UNKNOWN Effect |
| An approval or completion notification did not arrive | Outbox failure |
| The database must be restored or the process stopped | PITR, graceful shutdown |
Back up or restore the selected Store’s tables, migration history, and schema objects together. Read the safety rules before following a recovery procedure.
1. Safety rules
Section titled “1. Safety rules”- Use one Durable Store for a set of Runs. Workers read execution records from this database and commit their results to it. Never use PostgreSQL and MySQL to drive the same Runs at the same time.
- Before restoring the database or repairing its schema, stop every process that can write to the Store: Start and Wait completion endpoints, operator adapters, workers, Outbox publishers, and maintenance. Coordinate manual inspections that take locks so they do not block active work.
- Change execution state through the APIs. Do not edit Process, Run, recovery-reference, Wait, Effect, Effect attempt, Emission, Journal, Outbox, or PostgreSQL Run hold rows by hand.
- Use the audited operator API to pause or resume Runs, resolve Effects, or manage Outbox delivery.
- Keep snapshots, Effect payloads, Wait tokens, transport credentials, and page tokens out of logs.
- Changing an Alias affects future Runs. Existing Runs keep the version selected at Start.
2. Routine health checks
Section titled “2. Routine health checks”Check whether work is progressing
Section titled “Check whether work is progressing”Alert on:
- the number of eligible
RUNNABLEtasks and how long the oldest has waited; RUNNINGtasks whose lease has passedlease_until;- active Timers that are due but have not been handled;
PENDING,RUNNING, orUNKNOWNEffects, especially how long they have awaited operator review;PENDING,DELIVERING, orABANDONEDOutbox events;- Store transaction latency, exhausted connection pools, deadlocks, and migration validation failures;
- Durable health reports of
workerMachinery=degradedorleaseRenewal=degraded, active leases and consecutive faults for each worker lane, and stale last-success or progress timestamps; - repeated failures to prepare the runtime for the same stored Process ID.
Distinguish task failures from full capacity
Section titled “Distinguish task failures from full capacity”Use the sanitized Run, Timeline, and Outbox APIs to investigate problems; they do not expose raw state payloads. Distinguish a worker failure from a missing implementation required by one Process. A worker failure can degrade the node. An unavailable Action or script executor affects the specific stored Process ID.
For worker machinery, lastSuccessfulCycle includes an idle but successful cycle; lastProgress changes only when the lane reports progress. A successful cycle clears consecutiveFaults, but the last fault time and failure type remain as historical diagnostics. Three consecutive unexpected faults in an enabled operation degrade worker machinery. These timestamps are local worker observations, not database commit times. A lane with no work may have no progress timestamp.
Inspect capacity, inFlight, available, and saturated for effect_dispatch and effect_reconcile separately. These count local slots for claiming and executing work, including claims still in progress. Sustained saturation means that lane has no free slots; it does not by itself indicate a worker failure.
Check how long UNKNOWN Effects have awaited a confirmed result and how much work is queued to identify stuck tasks or decide what to investigate. Healthy lease renewal and zero faults do not remove the need for these checks. Dispatch and reconciliation have separate slots and cannot borrow from each other.
Set lease and database timeouts
Section titled “Set lease and database timeouts”Run, Effect, and Outbox leases use independent renewal lanes. Their scheduled interval is max(1, floor(leaseMillis / 3)) milliseconds. Set each lease duration above the sum of observed JVM pauses and tail database latency. Configure connection acquisition, network, lock, and statement timeouts so a failed renewal returns before the next renewal is due. These settings belong to the DataSource and database.
Verify PostgreSQL commit durability
Section titled “Verify PostgreSQL commit durability”Store-owned transactions and first-party admission transactions require local WAL flush before commit acknowledgement. An inherited synchronous_commit=off becomes transaction-local on; local, remote_write, on, and remote_apply are preserved. The setting is established before the transaction body and disappears on commit or rollback. Plain connection reads keep the inherited session configuration. Standby waiting follows the selected mode and synchronous_standby_names; in particular, upgrading off to on can wait for configured synchronous standbys. Include measured commit latency in pool and lease sizing.
This transaction setting does not configure replication or make unsafe storage durable. Verify fsync, full_page_writes, synchronous standby configuration, storage guarantees, and the intended failover policy separately. A successful local test of remote_apply without a synchronous standby proves configuration preservation only. It does not qualify standby visibility, failover, or point-in-time recovery. See PostgreSQL’s WAL settings and transaction-local settings.
Configure Spring metrics
Section titled “Configure Spring metrics”Spring health and metric adapters read the selected engine’s health snapshots and counters. Applications should use the documented Spring API/SPI beans and exported metrics. The adapters’ observation views and binder classes are internal to the same-version first-party integration; they do not give applications control of the Store, caches, or workers.
First-party engine metrics include a resource.domain label, which defaults to default. When internal integrations share a registry across engines, assign a distinct domain to each engine and keep the number of domains small. Rebinding the same binder is harmless; a second binder for the same domain is rejected. JVM-wide dropped-event counts are registered once, without CompileFlow-added engine tags.
Meter filters may add common tags or disable meters. They must preserve metric names and the required domain, operation, and outcome tags, or binding fails. Metric labels do not identify Runs and are not stored in recovery state.
3. Store outage
Section titled “3. Store outage”- Workers use the Store to claim tasks, renew leases, and commit progress. During an outage, these operations may fail or have an unknown outcome; callbacks already in progress may continue running. Do not treat local records as committed state.
- Restore connectivity, then check database time, the primary role, migration checksums, and the connection pool.
- Let maintenance reclaim expired Run, Effect, and Outbox leases.
- Confirm that expired tokens cannot authorize new external calls or Turn commits. An Effect call that already began may still return a result; the Store validates that result against its original attempt.
- Watch the backlog until waiting times return to normal.
Do not manually change RUNNING to RUNNABLE. Lease reclamation lets another worker claim the task. The old token cannot authorize a new call or Turn commit. A call that already began may still return a result, which must be checked against its original attempt.
4. Coordinated PITR
Section titled “4. Coordinated PITR”- Stop every process that can write to the Store, including Start, Wait completion, cancellation, operator commands, worker claims, Outbox delivery, and maintenance. Confirm that these processes have exited; a stop request alone is insufficient.
- Record the restore point. Close the original engines and create new engines in the restored processes so no local program cache from before the restore is reused.
- Restore all tables, migration history, and schema objects managed by the selected provider together. Include Effect attempt evidence and PostgreSQL’s
cf_durable_run_hold. Restore application admission, projection, and accounting tables consistently with the references they retain. - Check the Flyway version, checksums, and database constraints.
- Keep application write endpoints closed and start a controlled management process with
compileflow.durable.worker.enabled=false. This engine starts no Turn, Effect, Outbox, maintenance, or retention tasks. Itsdurable.operator()API remains available to inspect Runs, saved definitions, active work, and Outbox records. - Use Effect occurrence IDs, event IDs, and business keys to reconcile results with external systems and Outbox consumers. Establish which Runs and external operations may resume. Where a record needs an operator decision, follow UNKNOWN Effect or Outbox failure, supplying the required revision and audit information. Restoring the database does not undo external operations. Use application records to investigate operations performed after the restore point whose records are absent from the restored database.
- Once retries and duplicate deliveries can be handled safely, enable one worker. Check definition loading, lease reclamation, Effect recovery, and Outbox delivery. If those results are as expected, start the remaining workers and watch the backlog decrease.
Restoring only some tables can leave execution records inconsistent. Keep the pre-restore processes stopped; they must not run alongside the restored system. Pausing a Run cannot replace external reconciliation: a pause request may not yet have reached PAUSED, and PAUSED proves neither that an external operation stopped nor that its outcome is known. See Pause and cancel.
5. UNKNOWN Effect
Section titled “5. UNKNOWN Effect”An UNKNOWN Effect may already have changed the external system. For example, a payment may have succeeded before its response was lost. Check with that system before deciding to retry. A timeout does not prove failure, and cancelling the Run does not settle the external result.
To investigate:
- Read the sanitized Effect and Timeline views, and record the
reviewRevisionfor this investigation. - Confirm that the Store still retains the Effect’s Process and that the current deployment provides its Action and reconciliation implementations. An Effect awaiting review does not need to remain in the runtime cache.
- Query the external system using the Effect occurrence ID or mapped business key.
- Prefer automatic reconciliation when it can prove success or prove that the operation did not execute.
- When an operator must decide, authenticate and authorize the operator in the outer adapter, then call
resolveEffectwith thereviewRevisionrecorded for that investigation, actor, specific reason, and optional audit-context ID. If the revision conflicts, investigate again as described below. - Read the Effect and Timeline again. Confirm that the decision was recorded, whether review is still required, and whether other calls remain unresolved. Resolving one Effect does not mean that the entire Run has completed.
Investigate again after a revision conflict
Section titled “Investigate again after a revision conflict”Record the reviewRevision when investigating the external result. A new dispatch authorization or operator review can increase it. Returning an attempt to the budget because an implementation is unavailable does not restore the old revision.
If the revision has changed, reload the Effect and check the external result again. Do not simply put a newer revision on the old command: that could apply one attempt’s findings to a different attempt. A reconciliation Action checks the original operation; it must not repeat it.
If an Action or reconciliation implementation is missing, add it to the application’s configuration and deployment, then recreate the engine or restart the affected nodes as required. Durable does not use stored state to select a different application build.
A PENDING Effect can also need review
Section titled “A PENDING Effect can also need review”An Effect can require review while it is PENDING. This happens when reconciliation has confirmed that the operation did not execute, but no automatic dispatch attempts remain. In this case, unknownSince is cleared. Keep the confirmed result instead of changing the Effect back to UNKNOWN. An audited operator retry can authorize another dispatch; cancellation can end the task that is known not to have executed.
unknownSince records when the current wait for a confirmed result began. If this field is empty on a RUNNING Effect, the external call may still have taken effect.
Operator audit records retain the target type and ID, expected pre-decision revision, decision, actor, reason, and optional context. They explain the decision even after consumed occurrence rows have been deleted.
For PauseRunCommand, ResumeRunCommand, ResolveEffectCommand, and ResolveOutboxEventCommand, the actor and optional auditContextId are limited to 128 Unicode code points each. These identities must be non-blank, without surrounding whitespace, control or Unicode format characters. Use null to omit the context ID. The required reason is non-blank, limited to 2,048 Unicode code points, and preserved without trimming. It must be valid Unicode without NUL. These fields are audit evidence, not authorization; do not put secrets or raw business payloads in them. Native execution holds have their own audit contract.
6. Outbox failure
Section titled “6. Outbox failure”A terminal Run transition or an Effect review transition creates an Outbox notification even if the local node has no publisher or sink configured. Another node sharing the Store can deliver it. An unclaimed PENDING event stays in the Store until delivery or an allowed operation settles it.
- Record the stable
eventId, owning Run, event type, attempt count, status, and the revision used for this investigation. - If the event is never claimed, check that at least one node sharing the Store has workers enabled and declares a
DurableOutboxSinkin the standard Extension service file. No sink means no publisher. Declaring a Spring bean alone does not register this extension. - If delivery attempts keep failing, check that a sink’s
support(event)accepts the event, then inspect downstream authentication, timeouts, and receipts. The first supporting sink in extension priority order handles the event; no matching sink is also a delivery failure. - Check downstream deduplication records before deciding that delivery is safe to retry. Submit
RETRYwith the revision recorded during the investigation throughdurable.operator().resolveOutboxEvent(...). If the event is alreadyPENDING, the repeated request returns without changing its scheduled delivery time or forcing immediate delivery. - For events other than
WAIT_COMMITTED, submit an authorized, auditedABANDONdecision through the same API when delivery is no longer needed. Supply the revision recorded during the investigation; the event must bePENDINGor alreadyABANDONED. For aDELIVERINGevent, wait for delivery to finish or its lease to be reclaimed. Then reread its state and revision, check downstream receipts, and decide whether abandonment is still appropriate. Abandoning delivery cannot recall an event already received downstream. - Read the event and downstream receipts again to verify the delivery outcome. Accepting a retry command does not prove receipt. Consumers must still deduplicate by event ID because a delivery timeout can occur after they have received the event.
If submission fails with a revision conflict, reread the event and check downstream records before deciding again. Do not merely update the revision and resubmit the old decision.
Delivery status and cleanup
Section titled “Delivery status and cleanup”Terminal retention sets the earliest time for cleanup; it does not guarantee deletion at that time. PENDING and DELIVERING events block cleanup. DELIVERED and ABANDONED settle only that event’s delivery. Effects with unconfirmed results, unacknowledged required emissions, and application references can still prevent cleanup.
After a non-Wait event exhausts its delivery attempts, the publisher may mark it ABANDONED. This stops delivery without proving downstream receipt or resolving an UNKNOWN Effect. Do not use a no-op sink to report a delivery that never happened.
A Wait notification cannot be abandoned separately
Section titled “A Wait notification cannot be abandoned separately”WAIT_COMMITTED carries the token needed to complete a Wait. Neither an automatic policy nor an operator can abandon this notification independently. Repair delivery while the Wait is active. Completing the Wait settles its notification. Wait timeout or Run cancellation or termination revokes the relevant active Wait tokens and settles their remaining notifications.
These state changes clear the stored token payload and reject late delivery acknowledgements, but cannot recall a request already in flight. A notification whose token has been revoked cannot be retried. Cancelling a Run does not resolve Effects with unconfirmed results; with the default WAIT_CONFIRMED stop policy, the Run may need to wait for those results before becoming terminal.
The Journal records execution history. It does not automatically republish its records to the Outbox.
Save the final result
Section titled “Save the final result”Terminal events have empty payloads. If a consumer needs the complete result, authorize the result read separately and query getRunResult. Persist the terminal Succeeded, Failed, or Cancelled result according to the application’s receipt policy before acknowledging the event. NotCompleted and NotFound do not establish receipt of a terminal result. A terminal result also does not prove that every external operation has settled; inspect active work and termination information when that matters. A non-Wait event can become ABANDONED after exhausting delivery attempts and later be removed by retention cleanup, even if the consumer never received it. Set retention to cover the required recovery window. Disable terminal cleanup until the application can enforce its own receipt policy. An event receipt alone is not an archive of the result.
7. Stuck Run or missing capability
Section titled “7. Stuck Run or missing capability”Check the Run’s control state first. An intentionally paused Run does not claim new business execution tasks; this alone is not a fault. Then use the Timeline and pending-work records to locate the delay:
| Observation | Check or action | What to verify afterward |
|---|---|---|
RUNNABLE with repeated retries |
Check loading and compilation, ScriptExecutor implementations and their service declarations, Java classes, and host components |
The preparation fault stops recurring and a worker can commit another Turn |
RUNNING with an expired lease |
Check maintenance, database time, and reclamation indexes | The expired lease is reclaimed and eligible work is claimed again |
WAITING for a Wait |
Check authenticated WAIT_COMMITTED delivery, token handling, and whether the business result exists yet |
After completion is committed, a worker can read the result and execute the next steps |
WAITING for an overdue Timer |
Check the timer sweep and database clock | The due Timer is handled and eligible paths can run |
WAITING for an Effect |
Distinguish pending dispatch, an unconfirmed result, and operator review; follow UNKNOWN Effect | The external result is confirmed, or outstanding work has an owner and next action |
Waiting is expected when the business result has not arrived or the Timer is not due. An unfinished Run alone is not a reason to retry or cancel it.
Do not mark a Run FAILED solely because infrastructure retries have been exhausted. To stop its business execution while investigating, pause it, repair the deployment, then resume it.
Original execution artifacts do not match the worker
Section titled “Original execution artifacts do not match the worker”Durable retains the original process definition and recovery position. It does not package application JARs, host components, script executors, or Java value types. Changing an Alias does not replace those dependencies for an existing Run. Keep the original artifacts while in-flight Runs, unresolved Effects, or result retrieval still need them.
- Use
durable.operator().getRunDefinition(runId)to inspect the saved root source and admission attribution. Authorize source access separately. This API does not return the complete child call graph. If diagnostics identify a child, use the failing Process ID from the logs in authorized Store-level diagnostics to check that saved definition and the Run’s frozen call bindings, rather than resolving the current Alias. - Check the worker’s application artifacts, Java types and serialization conventions,
ScriptExecutorimplementations, and component bindings. Preparing the exact original definition can check definitions, types, expressions, and scripts. The host must separately check Actions, reconciliation implementations, and external systems. - PostgreSQL integrations using
ExecutionRequirementRefshould derive the digest from immutable execution materials and add it toClaimSelector.registered(...)only on workers that actually have those materials. The defaultuntagged()claims only untagged work; a registered selector accepts at most 1,024 distinct requirements, and an empty set claims no work. The selector does not grant business permissions or download or install artifacts. - If a tagged Run has no matching worker, restore the original materials and a corresponding worker. Do not change the original digest, widen the selector, or replace an original call binding with the latest version just to make work claimable. MySQL currently rejects these PostgreSQL extensions; do not deploy them as capabilities shared by both stores.
- An unavailable runtime continues to use the existing capability backoff without increasing the execution fault count. The worker emits a rate-limited
Durable turn runtime not readydiagnostic with the Run ID, the actual unavailable Process ID, the failure phase, and a bounded diagnostic containing exception types and stack locations. It excludes exception messages, file names, process variables, and raw state. Turn fault and runtime-not-ready diagnostics share a limiter per worker, not per Run. The next emitted diagnostic includes the number suppressed since the previous one, so log counts are not failure counts. - After restoring the materials, verify that the same original Run can commit another Turn and check any unresolved Effects. Retire old artifacts under the application’s retention policy only after original execution and result delivery no longer need them. Clearing a local runtime cache does not discharge these obligations.
Damaged execution state
Section titled “Damaged execution state”If the saved continuation—the state needed for the next execution Turn—is structurally invalid, the runtime pauses the Run. It records retry.code=CONTINUATION_INVALID, the fault category, count, and database observation time. Recording this diagnostic does not require decoding the damaged state. Committed Wait or Effect results that fail structural decoding, or any committed occurrence result that conflicts with its retained Process invocation, frontier, or boundary, park the Run with OCCURRENCE_RESULT_INVALID. Ordinary application restoration failures still use fault backoff.
The Run’s execution status remains RUNNABLE, with control state PAUSED. If an issued Effect still has permission to execute, the control state is initially PAUSE_REQUESTED. The Run has not failed or been cancelled. Its TURN_FAULT_PARKED Journal record survives restart and resume. A callback failure, missing implementation, or temporary Store failure alone does not establish that the saved state is corrupt.
Check the original Run and Process and the sanitized worker logs. After repairing the problem, use the audited Resume command with the current control revision. Resume clears the current diagnostic and allows a worker to claim the Run immediately. The new worker must still load the Process and validate the original continuation and any results needed for execution. If either is still invalid, the Run pauses again and its control revision increases; an old Resume command cannot release this new pause.
With the default WAIT_CONFIRMED stop policy, cancellation can be processed using the work recorded in the database, without first decoding the damaged continuation. Whether the Run can terminate still depends on outstanding Effects and other stop conditions. Retention cleanup is a separate operation.
BOUNDED_DRAIN requires the saved continuation to pass validation first. If the continuation is invalid, even after the stop deadline the Run must be repaired and explicitly resumed before it can end. An invalid occurrence result does not itself prevent termination under the original stop policy, because termination does not apply the result.
Rejected publication
Section titled “Rejected publication”A definite Store refusal to seal publication early (PUBLICATION_SEAL_UNSUPPORTED) or append after sealing
(PUBLICATION_CLOSED) also parks the Run without accepting the proposed Turn. The original continuation and recorded
facts remain intact. Inspect the selected emission source and Store capabilities, correct the deployment or source, and use
the current control revision to resume. Do not remove or rewrite an accepted seal. These diagnostics are not evidence of
continuation corruption: an operator may still request stop settlement under the original stop policy.
8. Pause and cancel
Section titled “8. Pause and cancel”Pause prevents workers from claiming new business execution tasks. Wait completion, Timers, Effect recovery, Outbox delivery, and maintenance can continue.
PAUSE_REQUESTED means that the Store still records outstanding permission for a Turn or Effect to execute. PAUSED means no such permission is outstanding at that moment. Neither state confirms the outcome of external calls. Calls that already began may still return results, which are checked against their original attempts.
Cancellation also requires the runtime to act on the request. Before closing the incident, check whether any Effect still has an unconfirmed external result.
9. Capability and transport-secret incident
Section titled “9. Capability and transport-secret incident”Rotate HTTP/RPC credentials and page-token signing keys according to the owning adapter’s protocol. If a Wait token is exposed, block unauthorized completion requests at the application entry point and inspect the committed Wait and Run state. Stopping Outbox delivery does not revoke a leaked token.
If application policy permits cancelling the Run, cancellation revokes active Wait tokens. It does not undo a committed result or resolve Effects with unconfirmed results. Follow Wait-token security and keep a redacted incident record.
10. Graceful shutdown
Section titled “10. Graceful shutdown”Stop accepting new business requests before shutdown. Engine close() rejects new operations and drains already admitted application operations before the worker shutdown budget starts. Workers then stop acquiring tasks, cancel delayed probes, and wait for active Turn, Effect, and Outbox callbacks to return. After compileflow.durable.shutdown.timeout, the engine requests interruption and reports unfinished work.
An interruption request does not guarantee that a callback has exited. The engine keeps lease renewal, compilation, and runtime resources available until the calls it accepted actually finish. A previously requested stopWorkersAsync() stage and the Spring worker-stop callback complete only after the captured worker generation exits. Do not invoke stopWorkersAsync() on an engine that is already closing; it is an engine operation subject to the admission gate. If close() times out, the engine schedules deferred cleanup and remains in the closing state until cleanup finishes.
Even after every engine callback has exited, a remote task or asynchronous work started by a callback may still be running. The application must check those results with the external system.
Allow enough time for the longest in-flight call when setting the Durable shutdown budget, spring.lifecycle.timeout-per-shutdown-phase, and the container termination grace period. Keep the application-owned Store available until the calls have exited. After forced process termination, recovery relies on lease expiry and rejection of stale tokens; external operations still need to be idempotent.
If the host reaches its shutdown deadline and closes the DataSource first, calls still running may fail to renew leases or save late results. Recover as you would after forced process termination: wait for lease expiry, let another worker take over, and query external results using the original Effect ID. Expired tokens cannot authorize new calls or Turn commits; results from calls that already began are still checked against their original attempts. The engine can defer releasing its own resources, but cannot keep the host’s connection pool open.
The restored deployment must be able to execute stored Processes and provide their required application implementations. A Run with a missing implementation remains recoverable, but cannot continue until that implementation is available.
11. Incident completion
Section titled “11. Incident completion”An incident is complete only when:
- no unexpected expired leases remain;
- waiting times for eligible tasks are back to normal;
- every
UNKNOWNEffect or Effect awaiting review has an owner and a next action; - every abandoned Outbox event has an understood cause, and every operator decision has an audit record;
- the intended workers can prepare and execute the stored process definitions;
- external deduplication records use the same Effect IDs or event IDs as the Durable records;
- the timeline and change record contain no secrets.
See the architecture.