# ADR 0005 — DBOS Durable Workflows

**Status:** Accepted

## Context

Factory, agent, publication, CI, deployment, enrollment and resolver operations survive process/control-plane failure and long waits. AWP should not build its own generic durable workflow engine.

## Decision

Use DBOS TypeScript + PostgreSQL behind `DurableWorkflowProvider`. DBOS owns checkpoint/recovery/timer/replay mechanics. AWP owns IDs, lifecycle meaning, authorization, events/audit and provider coordination.

## Consequences

Long-running orchestration gains durable recovery without adding a second queue/workflow stack. Application code still defines idempotency, external side-effect reconciliation, attempts and cancellation semantics.

## Rejected Alternatives

- hand-built leases/job engine as baseline;
- multiple workflow authorities;
- in-process timers/sleeps for durable waits.

## Increment Realization

I0 provider/bootstrap; I1 Factory/Agent/publication; later CI/deployment/enrollment/incidents use same seam.