docs/7-DEVELOPMENT/decisions/ADR-004-background-workers.md
Open Notebook routinely processes work that takes seconds to minutes: ingesting and embedding large volumes of content, generating insights, producing podcast episodes. Users run it on machines of very different sizes — from small home servers to beefy workstations — so the same job can be fast on one deployment and slow on another. None of that may lock product usage: the API and UI must stay responsive while heavy work happens (async-first principle).
Long-running operations run as background jobs on a dedicated worker process, never inline in the API request cycle. Submission is fire-and-forget (returns a job id immediately), status is observable (/commands/{id}), failures are explicit (permanent vs. retriable), and the UI polls or resumes rather than blocking.
The queue implementation is deliberately an implementation detail behind this decision. Today it's surreal-commands — chosen because it reuses the SurrealDB we already run, adding zero infrastructure for self-hosters (ADR-001). A move to Celery is under evaluation as part of the Platform v-next cluster (#381); if it happens, it replaces the implementation, not this decision.
AGENTS.md; forgetting it is a silent-queue failure mode).ValueError → no retry), status exposed to the UI (e.g. podcasts use max_attempts: 1 + an explicit retry endpoint).