# Changelog Notable changes between releases. Detailed migration notes for storage transitions live in [`docs/upgrade-0.5-to-0.6.md`](docs/upgrade-0.5-to-0.6.md). ## [Unreleased] ### Upgrading - **Build the tag indexes after upgrading** (ADR-049). As the migrator, run `awa storage build-tag-index --wait`. There is no migration: empty partitions and new schemas are indexed during `awa migrate` and schema preparation, and the command covers populated partitions, each once pruning empties it. `--now` builds them immediately with `CREATE INDEX CONCURRENTLY`, at the cost of holding back vacuum and blocking pruning of each partition while it builds. See the [upgrade guide](docs/upgrade-0.6-to-0.7.md#tag-indexes-adr-049). - **Rust library users: `BatchOperationFilter` is now `JobFilter`.** Its `state` and `tag` fields become `states` and `tags` lists. Build a filter with `JobFilter::new().state(..).tag(..)` or `JobFilter { kind: .., ..Default::default() }`. Its JSON keeps ADR-030's keys, so stored batch operations still load. Several tags or states go under `tag` or `state` as a list, which 0.6's filter type rejects rather than ignoring (a unit test reads the new shape with a copy of that type). Unknown JSON fields are now an error rather than ignored. See [stability](docs/stability.md#job-filters-adr-049) for what is and isn't rehearsed across versions. - **HTTP: `GET /api/jobs`, `/api/jobs/count` and `/api/dlq` refuse unknown or empty query parameters** with a 400. A 0.6 server ignored unknown parameters, returning a wider list. Listing and counting jobs by filter now share one 30-second budget per request, across every candidate pass and row load; past it the request fails asking for a narrower filter. - **HTTP: DLQ retry and purge by the full filter use new endpoints, `POST /api/dlq/retry-matching` and `/api/dlq/purge-matching`, with body `{"filter": {...}}`.** `all: true` is accepted only with an empty filter. `/api/dlq/bulk-retry` and `/bulk-purge` keep their 0.6 body (`kind`, `queue`, one `tag`, `all`) and now refuse fields beyond it. A 0.6 server ignores body fields it doesn't know, so a richer body on the old paths could act on more rows there (a filter beside `all: true` would act on the whole DLQ); it answers the new paths with 405, and a v0.6.9 server was checked to. - **HTTP: `POST /api/dlq/retry-matching` and `/api/dlq/purge-matching` submit a batch operation and answer `202 Accepted` with it,** where they retried or purged the matching rows in one transaction and answered `{"count": n}`. The body and its validation are unchanged; the operation (`retry_from_dlq` or `purge_dlq`, `submitted_by: "http"`) has the shape `GET /api/batch-ops/{id}` returns, and the maintenance leader applies it a chunk at a time, so callers follow its `state` and `processed`, `skipped` and `errored` counters there instead of reading a count. Batch-operation submit rules now apply: a filter whose `state` names anything but `failed`, or with `dead_lettered: false`, is refused where it matched nothing or only the failed rows, and one with `dead_lettered: true`, several tags or several states is refused while a runtime older than 0.7.0-alpha.2 is live. The rows they retry or purge still count in `awa.job.dlq_retried` and `awa.job.dlq_purged`, now when the maintenance leader processes them. The admin UI's DLQ bulk actions submit through them and link to the batch operations page. `/api/dlq/bulk-retry` and `/bulk-purge` still answer with a count. - **CLI: `awa dlq retry-bulk` and `awa dlq purge` submit a batch operation and print its id,** where they retried or purged the matching rows in one transaction and printed a count. The filter flags, `--all` and the production confirmation are unchanged; the operation (`retry_from_dlq` or `purge_dlq`, `submitted_by: "cli"`) is applied by the maintenance leader a chunk at a time, so the command prints its id and state and how to follow it with `awa batch-ops get `. `--wait` polls it until it is finalized, prints its `processed`, `skipped` and `errored` counters, and exits non-zero if it failed. Batch-operation submit rules apply as they do for the HTTP endpoints, and the rows count in `awa.job.dlq_retried` and `awa.job.dlq_purged` when the maintenance leader processes them rather than in the CLI process. - **Python: `bulk_retry_from_dlq` and `purge_dlq` (on `AsyncClient` and `Client`) submit a `retry_from_dlq` or `purge_dlq` batch operation and return it,** where they retried or purged the matching rows in one transaction and returned their count. The returned dict (`submitted_by: "python"`) has the shape `submit_batch_operation` and `get_batch_operation` return, so callers follow its `state` and counters with `get_batch_operation` instead of reading an int, and submit rules and metrics change as for the CLI. `purge_dlq` no longer takes `before_id` or `before_dlq_at`: the cursor purge moved to the new `purge_dlq_before`, which takes the same arguments, needs at least one of `before_id` and `before_dlq_at` (`ValueError` otherwise), deletes in one transaction and returns the count. `python -m awa dlq retry-all` and `dlq purge` print the submitted operation. - **Finding, counting and batch-operating on jobs by filter require queue storage.** On the deprecated canonical engine (ADR-037), `find_jobs`, `count_jobs`, the deprecated `list_jobs`, `GET /api/jobs`, `awa job list` and batch-operation preview and submit return an error naming the missing queue_storage backend, as the DLQ APIs already did. In 0.7 a migrated cluster is finalized onto queue storage; only a fresh install that hasn't started a worker is still canonical. While it holds no jobs, listing and counting there return nothing rather than an error. - **A DLQ purge or bulk retry needs a filter that narrows the DLQ** (kind, queue, tag, ids or a created bound) unless `allow_all` is set; `state: failed` and `dead_lettered: true` alone are refused, since every DLQ row matches them. - **A batch operation needs the same:** a kind, queue, tag, ids or created bound, unless `allow_all` is set. In 0.6 a state alone was enough, so `{"state": "available"}` changed every available job; it is now refused. Stored operations are unaffected. An empty `ids` list is refused in any filter, since it would match nothing; omit `ids` to match any id. - **`awa storage status` prints one JSON document,** now with a `tag_indexes: {valid, total}` field; the build hint goes to stderr. - **Deprecated:** `admin::list_jobs` and `ListJobsFilter` (use `find_jobs` with `JobFilter` and `JobPage`), and `dlq::list_dlq`, `purge_dlq`, `bulk_retry_from_dlq` and `ListDlqFilter` (use `find_dlq`, `purge_dlq_matching` and `bulk_retry_from_dlq_matching`). They keep working through 0.8. - **A batch operation whose filter uses several tags, several states or `dead_lettered` is refused** while a runtime older than 0.7.0-alpha.2 is live, because an older runner can't read them. ### Forward-ported from 0.6.14 - Everything [0.6.14](https://github.com/hardbyte/awa/releases/tag/v0.6.14) shipped that this branch did not already have; see its release notes for the details. Promotion runs each enqueue lane in its own transaction, hands a busy lane to a dedicated waiter, and wakes claimers after the lanes commit; `awa.maintenance.promote.lane_contention` counts the hand-offs. Rescue skips an attempt whose retained ready bodies are ambiguous instead of stopping rescue of every other attempt. Lifecycle events no longer re-read a completed job, and a failed re-read no longer fails a committed callback wait. Admin job lists and kind counts find their candidates in read phases that release partition locks between them, and probe receipt closures more cheaply; a job list still loads each candidate with a point read, which holds `ACCESS SHARE` on every ready, lease and claim partition for the length of that read. `awa migrate` rejects `--sql` combined with `--extract-to`. The persona soak suite (`awa/tests/persona_soak_test.rs`, `scripts/persona-soak.sh`) is added. ### Forward-ported from 0.6.15 - Everything [0.6.15](https://github.com/hardbyte/awa/releases/tag/v0.6.15) shipped that this branch did not already have; see its release notes for the details. Lifecycle hooks hold their attempt's finalizer slot until they return, so hooks slower than job throughput slow claiming instead of growing worker memory, and maintenance keeps at most 1,024 detached `Rescued` and duplicate `Cancelled` hook tasks per worker. By-job lookups of compact receipt claims use a GIN index on `lease_claim_batches.job_ids` that claim prune builds on each partition as it empties it (migration v054). Compatibility COPY inserts go through `awa.insert_jobs_compat_batch` (migration v055), which takes each queue lane's enqueue lock only when it writes that lane rather than at the batch's first ready row (the lock is still held until the transaction ends), and the new `insert_many_skip_unique_conflicts` inserts a batch through it while skipping claimed unique keys. Rescue reaches stale attempts behind a full batch of ambiguous ones, `Completed` events and follow-ups carry the completed job without the attempt's heartbeat and deadline, slot-scoped admin receipt reads stay off other slots' closure partitions, and unfiltered receipt job lists select candidate IDs before loading bodies. v054 and v055 add functions only and take no table locks; a database coming from 0.6.15 already has both functions from its schema patches. See [v054](docs/upgrade-0.6-to-0.7.md#v054-claim-batch-job-index) and [v055](docs/upgrade-0.6-to-0.7.md#v055-batch-compatibility-insert) in the upgrade guide. ### Forward-ported from 0.6.16 - Queue-storage rescue drains a large backlog of abandoned claims in bounded time. A killed runtime leaves every attempt it claimed open, and until they close, queue prune skips the queue slots they reference and claim prune skips their claim slots, so neither ring can wrap. A rescue pass takes 500-attempt batches, each in its own transaction, until a batch comes back short, `rescue_pass_budget` (default 1 s, at most half the rescue interval) is spent, or it has rescued `rescue_pass_max_rows` (default 5,000), and while a backlog remains the next pass runs a second later. `ClientBuilder::rescue_pass_budget` and `rescue_pass_max_rows` (Python `rescue_pass_budget_ms` and `rescue_pass_max_rows`) set both; zero for either keeps one batch per interval. Deadline and callback rescue act on their expired deadlines; stale-heartbeat rescue takes more than one batch per pass only once runtime snapshots show the claims' owners gone. Rescue's cursor scans seek to their cursor through the index, including the compact deadline-batch scan that 0.6 does not have, and rescue transactions run without JIT. `awa.maintenance.rescue.pass_size` (by `awa.rescue.kind` and `awa.rescue.pass_end`) and `awa.maintenance.rescue.oldest_attempt_age` show a drain in progress. Heartbeats no longer queue behind a completion: an attempt whose closer holds its lock is skipped, lease and progress writes skip rows a finalizer has locked and retry them on the next pass, and a finished attempt stops flushing progress once its handler returns. A point read of a failed job that starts while queue prune moves its row out of the slot being pruned is covered by a test; on this branch the read already locks the ring before it takes its snapshot. See [draining a backlog of abandoned claims](docs/configuration.md#rescue-backlog). - Claim prune no longer treats a partial GIN index on `lease_claim_batches.job_ids` as the claim batch index (migration v056). It recognises only a valid, non-partial GIN index on `job_ids` alone. When another index or relation already has the index's name, `ensure_claim_batch_job_index` leaves it in place, returns false and raises a warning naming it, instead of reporting the slot indexed; the slot keeps scanning until an operator drops or renames it. Refreshing the function as a migration role that owns it but may only `SET ROLE` to the table owner (PostgreSQL 16+ membership `WITH INHERIT FALSE`) no longer leaves `EXECUTE` with `PUBLIC`: the refresh resets `EXECUTE` after it hands the function to the table owner, acting as the new owner when it cannot as itself. Migrations run with the owner as the effective role, as documented, were not affected. v056 replaces functions only and takes no table locks. See [v056](docs/upgrade-0.6-to-0.7.md#v056-claim-batch-index-recognition). - Creating a new queue lane through `QueueStorage` (its batch enqueues, and workers promoting scheduled or retried jobs) no longer deadlocks with a concurrent `insert`, `insert_many` or `insert_many_copy` that is also the first to use the same `(queue, priority)` (#692). `QueueStorage` took the lane's provisioning lock before writing its `queue_lanes` row, while SQL inserts write the row first and take the lock in the head-table trigger that creates the lane's sequences, so each transaction waited on the other and one failed with `40P01`. `QueueStorage` now writes the row first too, and so does the `provision_lane` function it calls (migration v058, [v058](docs/upgrade-0.6-to-0.7.md#v058-lane-row-before-lane-lock)). Lanes that already existed were never affected. `QueueStorage` processes on 0.6.15 or earlier, or on an earlier 0.7 build, keep the old order until they are upgraded. - `insert_many_copy` and `insert_many_skip_unique_conflicts` no longer deadlock with per-row producers (generic `insert_many`, single-job inserts, binaries before v055) that share their unique keys or lanes (migration v057). With the v055 function, when a per-row transaction held a lane and then inserted a key a waiting batch had claimed, PostgreSQL aborted one of the two with `deadlock detected` (`40P01`). The batch function now waits at most 500 ms (or half of its session's `deadlock_timeout`, if lower) while it holds claims or lanes: on a longer wait it releases them and tries again, so the per-row transaction proceeds and the batch then treats the keys it committed as already claimed. The same applies to a transaction that enqueues lanes in separate statements in the opposite order to a batch. This covers per-row sessions whose `deadlock_timeout` is above 500 ms, as PostgreSQL's default of 1 s is, and batches whose unique claims insert within that budget (10,000 to 20,000 keys on a fast server, fewer on a slow or busy one); larger batches behave as before. The protection lasts for 2 s of retries; then the batch makes one last attempt with ordinary lock waits. A per-row transaction that holds a lane for longer than that before it inserts one of the batch's keys can therefore still deadlock with it. A cycle through a lock the batch's own transaction took in an earlier statement also ends in `deadlock detected`, after about 3 to 4 s instead of 1 to 2 s, and usually aborts the batch's transaction. The caller's `lock_timeout` applies to each lock wait, as before. Results and the lane lock window are unchanged. v057 is one function replacement with no table locks, and producers that already call the function get the fix as soon as it commits. See [v057](docs/upgrade-0.6-to-0.7.md#v057-batch-inserts-give-way-to-per-row-producers). ### Forward-ported from 0.6.17 - Syncing a periodic job declaration that matches the stored schedule no longer rewrites its `awa.cron_jobs` row or moves `updated_at`, so a leader that syncs on a timer stops generating a row version per schedule per interval. A changed declaration, or an owned or retired schedule, is handled as before. - The architecture overview says that a worker still running a claim lost before its WAL flush is not fenced by its run lease, because the job's next claim reuses it, and describes queue-storage rescue passes and their bounds. The lifecycle hooks guide says a rescue pass can exceed `rescue_pass_max_rows` by nearly one batch. - Cleanup, cron sync, batch operations, metadata refresh, rollup and ring rotation no longer hold back promotion and rescue (#303). The maintenance leader ran every branch from one loop, so while one branch's statement waited on a lock or ran a long scan, scheduled and retryable jobs were not promoted and stale, overdue and timed-out attempts were not rescued. With one `awa.cron_jobs` row locked by another session, the leader's startup cron sync stalled both for as long as the lock was held, and stopped cron from firing. Promotion and the three rescues now run in their own loop within the leader term, the leader check runs beside both loops so a lost lock session is noticed while a branch is in flight, and the cron evaluator starts before the startup cron sync. A rescue pass still delays promotion, and the other branches still delay one another: a stuck cleanup or cron sync still holds back ring rotation and prune, and shutdown still waits for it. No configuration or schema change is needed. A leader holds one more pool connection at a time. While a rescue pass runs, lease prune may report more `blocked` outcomes and claim prune may wait out a rescue batch. See [ADR-051](docs/adr/051-maintenance-recovery-loop.md). - One completion waiting on another transaction's lock no longer stalls every other completion in the runtime. A transaction that changes a running attempt, such as `admin::cancel_tx` inside an application's transaction, holds the attempt's completion lock until it commits. If the attempt's handler returned `Completed` meanwhile, the completion batch waited on that lock, so no other job's completion committed, and once the in-flight completion allowance filled the runtime stopped claiming in every queue until the transaction ended. With receipts on (the default), a completion batch, its one-at-a-time fallback after a batch error, and the direct completion a retry uses now leave an attempt whose lock is held out, and the worker retries that attempt with backoff without holding a pool connection, for up to two minutes of the finalization budget (time spent waiting for an accepted completion to be acknowledged does not count), then leaves it to stale-heartbeat rescue as before. Non-success outcomes and kinds with follow-up enqueues already finalized one job at a time and still wait on the lock. With receipts off, a batch still waits. No configuration or schema change. See [a completion waits on an application's transaction](docs/troubleshooting.md#a-completion-waits-on-an-applications-transaction). - **The embedded admin UI works when its axum router is nested under a path such as `/awa` (#502).** Assets, API requests (including the dashboard's managed reads), navigation and direct deep links use the mount path, including under several outer nested routers, without rebuilding the frontend or changing router calls. `nest("/awa", ui)` serves the dashboard at `/awa` and `nest("/awa/", ui)` at `/awa/`; `nest_service("/awa", ui)` serves both. See the `awa-ui` README. ### Forward-ported from 0.6.18 - **A cancel heard before its handler starts now stops the handler from running.** A cancel notification that reached the runtime between the job's claim and the start of its handler was missed, so the handler ran in full with `is_cancelled()` false and its side effects happened, though its result was discarded. The runtime now keeps such a cancel for its attempt, for up to five minutes and at most 256 per registry shard, and skips the handler, logging `Skipping a handler whose attempt was cancelled before it started`. Cancellation stays cooperative: a notification that arrives after the handler starts, is dropped from that cache, or is lost with the listener connection does not stop it. - **Claimed jobs are no longer left for rescue when a claimer lease refresh fails.** A pool timeout or dropped connection right after a queue-storage claim committed made the dispatcher log `Failed to claim queue storage jobs` and leave the claimed jobs until rescue ran them; they now run immediately, and the cached lease is dropped so the next claim reads it again. - [Ring prune stays blocked under claim load](docs/troubleshooting.md#ring-prune-stays-blocked-under-claim-load) covers queue and claim ring prunes that overlapping claims keep `blocked` (#721): symptoms, how to tell it from a lane pinning the queue ring or abandoned claims, a lock query for both rings that works under either ring cursor authority, and mitigations. 0.7 does not fix it yet. The section also covers long readers of the queue-storage tables, such as monitoring queries, which stall prune for as long as they run, with a query that lists them for every ring. - [Storage isolation](docs/deployment.md#storage-isolation) recommends a separate database for queues likely to sit paused, unserved or starved under strict priority, since every queue in a database shares one queue ring, one claim ring and one maintenance leader (#779, #721). It covers what the boundary contains, setup for producers and runtimes, costs, and why a separate queue-storage schema in the same database is not a boundary. - **`drain_queue` no longer leaves a drained lane pinning the queue ring** when 1,000 or more rolled-back inserts preceded its jobs. Drain steps each lane's claim cursor past rows it has cancelled, but its window started at the cursor, so a run of rolled-back enqueue reservations wider than one window left the window empty and the cursor behind the gap, and the lane kept its ready rows in the oldest sealed slot until something claimed from it. Each window now starts at the lane's first committed row at or after the cursor. - **A retry storm no longer floods the connection pool with finalize transactions.** On queue storage, every finalize other than a batched completion opens its own transaction: retries, snoozes, cancels, callback waits, failures and DLQ moves, completions with registered or handler-staged follow-up enqueues, and completions written directly after a completion batch fails. Nothing bounded how many ran at once, so a thousand jobs returning a retryable error together could queue a thousand transactions on a small pool while claims, heartbeats and the completion batcher waited behind them. These transactions now pass a runtime-wide finalize gate, sized by the new `ClientBuilder::max_concurrent_finalizes` (default: a quarter of the pool, clamped to `4..=64`), separate from the claim gate. A finalize waiting for the gate keeps its heartbeat, and the wait does not count toward its two-minute retry budget. Batched completions and canonical storage are not gated. No schema or SQL change. - **The idle fallback poll's ready-signal read waits for the claim gate.** A dispatcher's fallback poll after an empty poll reads the queue's ready signal before deciding whether to claim, and that read ran before the dispatcher took its claim gate slot, so a runtime with many idle queues could run one read per queue at once and hold the whole pool. The read now runs under the claim gate. - **Canonical-storage claims take the claim gate.** `max_concurrent_claims` now bounds canonical claims as it does queue-storage claims, so a runtime still on canonical storage, such as a fresh install before its first worker or a drain-only runtime, cannot take the whole pool with claims from many queues. - **`wait_for_callback` polls less often.** A waiting handler checked its callback every 200 ms for the whole wait, so a thousand waiting handlers ran about 5,000 queries a second. The interval now starts at 200 ms and doubles up to 5 seconds, in Rust and Python, so a resolved callback can take up to 5 seconds to be noticed. A cancel of the waiting job is still noticed within 200 ms. - **Idle pooled connections no longer grow by the size of the receipt rescue walks.** Each rescue pass walks every claim slot with statements that name that slot's partitions: the stale-claim walk, the receipt deadline walk and the compact-batch deadline walk, two statements each, so 48 statement texts on the default 8-slot claim ring. The terminal-count rollup probes each sealed queue slot the same way. sqlx prepared them on whichever pooled connection ran the pass and kept them in its statement cache, with the generic plan Postgres builds after a statement's fifth execution in a session, and nothing evicted them while the runtime was idle. They now run as unprepared statements. In a 25-minute idle run with 8 queues and a 16-connection pool, the median pooled backend reached 53 MB of anonymous memory and the largest 89 MB, still rising; with the change they level off at about 35 MB. Each walk execution is now planned afresh, 48 plans per rescue pass. No configuration or schema change. - **The idle gate probes its rings on the maintenance leader's own connection.** Before each rotation the gate checks whether any partition of the ring holds a row, or for the lease ring any reclaimable storage, by scanning the ring's partitioned parents. Planning such a scan loads every partition's relcache entry and index metadata into the session that runs it, and the gate ran inside the rotation transaction on whichever pooled connection was free. The leader now runs these probes on one connection it holds while it leads, with `application_name` `awa-maintenance-idle-check`, and feeds the result to the gate at the same point in its decision; rotation still runs on the pool, and the same rings are skipped and rotated as before. The connection is opened through the pool and detached from it, so it takes no pool slot, but the leader's process can hold one connection more than the pool's `max_connections`. It closes when leadership ends and is replaced after a failed probe or rotation. New `QueueStorage::rotate_with_cadence_on`, `rotate_leases_with_cadence_on` and `rotate_claims_with_cadence_on` take the probe's connection. No configuration or schema change. ### Forward-ported from 0.6.19 - `PeriodicJob::latest_fire_time` no longer panics on a schedule whose cron expression or timezone does not parse. It logs a warning and returns `None`. - Deleting a DLQ row now releases its unique claim. A unique key whose states include `failed` stays claimed while its job is in the DLQ, and `purge_dlq_matching`, `purge_dlq`, `purge_dlq_job`, `cleanup_dlq` and the maintenance leader's DLQ retention deleted the row but left the claim, so a new job with that key was refused as a duplicate of a job that no longer existed. Each now releases the claims in the same transaction, locking them in key order. - A claim no longer stops at each rolled-back enqueue reservation between spent rows at the head of a lane (#813, migration v061). When a lane's first rows at its claim cursor were cancelled, deleted, moved or reprioritised before anything claimed them, the claim moved the cursor over them only up to the first lane position left by an insert that rolled back, returning no jobs, so each such gap cost an empty claim on the queue. The claim now crosses those positions, which no committed row can later fill. It stops at a segment of another ring generation inside the run, which a producer whose snapshot predates a ring rotation (a `REPEATABLE READ` or `SERIALIZABLE` transaction) can write there, and the next claim takes that segment's jobs. v061 rewrites the body of `claim_ready_runtime` in every queue-storage schema in place and takes no table locks; the function's name, arguments and results are unchanged. The release gate runs released 0.6.19 workers against the migrated schema, though not across such gaps. 0.6.19's `claim_spent_prefix_gaps` schema patch crosses the gaps without stopping at another generation's segment; v061 adds that bound to a database coming from it. See [v061](docs/upgrade-0.6-to-0.7.md#v061-claims-cross-rolled-back-reservations). - **Admin calls no longer provision a lane that already exists (#798, #799).** Module-level admin functions build a new `QueueStorage` per call, so every call that revived a job onto a lane wrote the lane's rows again under the lane's provisioning lock and called `provision_lane`: `dlq::retry_from_dlq` and the bulk DLQ retries, `admin::retry`, `bulk_retry`, `retry_failed_by_kind`, `retry_failed_by_queue`, `retry_external` and `cancel` of a deferred job, a rescheduled duplicate, and batch set-priority and move-queue once per job. Parallel calls queued on that lock. A lane is now provisioned only when its head and lane rows are not visible, in every store, and the in-process lane cache is gone. In-lane enqueue order is unchanged. No configuration or schema change. - **Retrying, cancelling, completing, failing or rescuing unique jobs no longer deadlocks with an insert of the same keys (#799, #825).** Every insert claims a job's unique key before it reserves the lane, but a re-enqueue reserved the lane first, and transactions that changed several jobs' claims did it in row order. Each could wait on an insert while the insert waited on it, and PostgreSQL aborted one with `deadlock detected` (`40P01`). On queue storage every path now changes all of a transaction's unique claims in one pass, in key order, before any lane lock: promotion, callback resume, `admin::retry` and the bulk retries, the DLQ retries, priority aging, `admin::bulk_cancel` and `cancel`, `drain_queue`, batch completion, the claim of jobs whose `unique_states` leave out `running`, heartbeat, deadline and callback-timeout rescue, `discard_failed`, `bulk_move_failed_to_dlq` and every single-job transition. A run of releases or of claims is one statement. Retrying a terminal job into a claiming state checks that it still owns its key. A rescued attempt whose key a newer job holds is cancelled as a duplicate in the same pass as the rest of the rescue, without a savepoint per row; when its mask claims `cancelled`, the row keeps its key, has `cancelled` cleared from its mask and records the original mask in its error entry, and `admin::retry` restores it. A transition that also enqueues ADR-029 follow-ups still makes two passes and can deadlock with another such transition on each other's keys (`AwaStorageLockOrderCompletionFollowUpDeadlock.cfg`). No configuration or schema change. Until every process runs this build, an older process can still meet an insert of the same key with `40P01`. - **A snooze or retry no longer leaves a unique job running when a duplicate holds its unique claim (#807, #808).** With a `UniqueOpts.states` mask that leaves out `running`, an identical job can be enqueued while the first runs. If the first then returned `Snooze` or `RetryAfter`, or failed with a retryable error, the worker logged `Failed to complete job` with `unique conflict` and the attempt stayed `running` until rescue. The attempt is now finalized as `cancelled` with an error entry `snoozed as duplicate` or `retried as duplicate`, on queue storage and canonical storage; the worker logs a warning, dispatches the `Cancelled` event and counts the job in `awa.job.cancelled`, and emits no `Retried` event or follow-up. `reschedule::reschedule_canonical_attempt_with_unique` and `_with_unique_tx` are new; they skip the savepoint when the job has no unique key. - **Retrying a job cancelled as a duplicate re-checks its unique claim (#808).** A job cancelled because a newer duplicate held its key could be retried while the newer job still held it, when the mask claims both `cancelled` and `available`, and the two then ran side by side. The retry now fails with a unique conflict until the newer job leaves a claiming state, and restores the job's original mask on queue storage and canonical storage. A cancelled duplicate stored without its unique key by an earlier release can no longer be retried; enqueue it afresh. - **A due job that duplicates another job's unique key no longer stops promotion (#815).** A scheduled or retryable job whose `unique_states` include `available` but not the state it waits in holds no claim, so another job can take its key. When it fell due, promotion failed on it every tick: on queue storage no due job in its lane, or in later lanes of the batch, was promoted; on canonical storage no due job of that state was. Promotion now cancels the duplicate with the error `promoted as duplicate: unique claim held by another job` and promotes the rest in the same pass. The cancellation emits the `Cancelled` event and counts in `awa.maintenance.rescues` with `awa.rescue.kind` `promotion_duplicate_cancelled`. The cancelled row keeps its key with `cancelled` cleared from its mask; a retry restores the mask. No configuration or schema change. - **`insert_many` of several unique jobs no longer deadlocks with another insert or retry of the same keys (#819).** `insert_many` inserts a row at a time, claiming each row's key and then reserving its lane, so it claimed a later row's key while holding an earlier row's lane. With more than one row it now takes every key its rows claim, in key order, before any lane, in the same statement; a key another job holds fails the insert there with the same unique conflict as before. `insert_many_copy` does the same in one extra statement when `awa.insert_jobs_compat_batch` is missing or not executable, and skips the rows whose key another job holds. No configuration or schema change. - **Canonical rescue no longer leaves a duplicate running when its `unique_states` claim `cancelled` (#835).** When a stale, expired or timed-out attempt's rescue conflicted with a newer job's unique claim and the mask also claimed `cancelled`, the fallback cancellation conflicted too, and the job stayed `running` with an error logged every tick. The cancellation now clears `cancelled` from the stored mask and records the original, as the other duplicate cancellations do, and a retry restores it. - **During a rolling upgrade, retry jobs cancelled as duplicates only from processes running this build.** When a duplicate's `unique_states` claim `cancelled`, the cancelled row stores the mask with `cancelled` cleared. An older process that retries it keeps the cleared mask. Their last error ends in `unique claim held by a newer job` or `unique claim held by another job`. Only jobs whose `unique_states` include `cancelled` are affected. - **Admin reads no longer keep the claim ring from rotating.** On queue storage, the dashboard counts (`admin::state_counts`), queue overviews (`admin::queue_overviews`), the state timeseries (`admin::state_timeseries`) and the kind and queue lists (`admin::distinct_kinds`, `admin::distinct_queues`) counted running jobs in one statement over the claim-ring tables. That holds a read lock on every claim partition until the read ends, and claim prune needs an exclusive lock on the oldest slot's partitions to recycle it. Admin reads polled back to back left prune no moment to take it, so once something else had stalled the ring, such as an abandoned claim, it stayed stalled after the claim was rescued: the current slot kept growing, which made each read slower. These reads now read open claims one claim slot at a time, releasing each slot's locks before the next, in one repeatable-read snapshot. A slot whose claims the closure ledgers all close, as a sealed slot waiting for prune usually is, costs a reader a count, the proof prune itself makes, rather than a scan of every claim in it. Results are unchanged. `queue_storage::queue_signals_sql` with `QueueSignalReads::Admin` now expects the captured lane heads as `$1` to `$5` and the open claims' queues as `$6`. - **Rescue no longer walks claim slots whose claims have all closed.** Each claim ring rotation leaves a sealed slot of every claim taken in it until prune reclaims the slot. Stale-heartbeat and deadline rescue walked each slot's claims a window at a time, so with several large sealed slots every batch spent most of its time on closed claims, and a dead worker's claims were found minutes after its heartbeat went stale rather than within a pass or two. Rescue now skips a sealed slot whose claims the closure ledgers all close, by the count claim prune proves before it truncates a slot, and re-counts each sealed slot at most every 30 seconds. A claim that commits into a slot just after it was sealed is therefore rescued at most 30 seconds later than before; prune still counts under its exclusive lock. - **Maintenance failures and stalled promotion are visible in metrics** ([#709](https://github.com/hardbyte/awa/issues/709)). A maintenance branch that failed on every tick logged an error and recorded a normal duration, so a promotion failure looked like a quiet scheduled backlog. All additions; no existing metric name or attribute changes: - `awa.maintenance.branch.duration` carries `error.type` on a run that hit an error, so `rate(awa_maintenance_branch_duration_seconds_count{error_type!=""}[5m]) > 0` finds a failing branch whichever runtime leads. - `awa.maintenance.promote_duration` records failed promotion batches too, with `error.type`. - `awa.queue.due.depth` and `awa.queue.due.lag`, per queue and `scheduled` or `retryable`: due jobs not yet promoted, and the age of the oldest. Unlike `awa.queue.depth{state="scheduled"}`, they ignore work scheduled for later. - `awa.maintenance.leader`: `1` on the runtime holding the leader lock, `0` elsewhere, by `awa.runtime.instance_id`, so `sum(awa_maintenance_leader)` counts leaders even with several clients in one process. `error.type` is a fixed class (`bind_limit`, `timeout`, `lock_not_available`, `deadlock`, `serialization_failure`, `connection`, `database`, or the `AwaError` variant), never a message; `AwaError::error_type()` and `awa_model::sqlx_error_type()` give it. The [example alert rules](docs/grafana/alerts/README.md) gain `awa_maintenance_branch_failing`, `awa_promotion_due_lag_high` and `awa_maintenance_leader_count`. ### Added - **Bulk retry, cancel, discard and DLQ actions as durable batch operations (ADR-030, migration v063).** Batch operations gain the kinds `retry` (failed and cancelled jobs), `cancel` (available, scheduled, retryable, running and waiting jobs), `discard` and `move_to_dlq` (failed jobs, not dead-lettered) and `retry_from_dlq` and `purge_dlq` (dead-lettered jobs), through `awa batch-ops`, `/api/batch-ops`, the admin UI and the Python client's `submit_batch_operation`. The maintenance leader applies them a chunk per transaction with per-job accounting, preview and cancellation, where `retry_failed_by_kind`, `discard_failed`, `bulk_retry`, `bulk_cancel` and the DLQ bulk functions act on the whole set in one transaction, which those functions and their endpoints still do. A job whose retry would take a unique key a newer job holds is recorded as errored and the rest of its chunk proceeds; a job whose row another transaction holds stays pending and is retried by a later chunk; purging DLQ rows releases their unique claims. The maintenance leader counts the rows a `retry_from_dlq` or `purge_dlq` operation processes in `awa.job.dlq_retried` and `awa.job.dlq_purged`, with `awa.job.queue` when the filter names a queue, as the DLQ functions' callers do. A filter naming a state the kind does not act on is refused at submit and preview. v063 widens the `op_kind` check on `awa.batch_operations`. An older maintenance leader fails an operation of a new kind, so submitting one is refused, naming the runtimes, while a live runtime reports a version older than 0.7.0-alpha.2. See [v063](docs/upgrade-0.6-to-0.7.md#v063-bulk-action-batch-operations). - **`pg-session-lock`, a new crate in this repository** for session advisory locks on pooled sqlx connections. Its `SessionAdvisoryLock` returns a connection to the pool only after the unlock succeeds and `pg_locks` shows the key released, and closes it on any other way out: a dropped future, a panic, or a failed or cancelled unlock. It also has `PG_LOCKS_KEY` and `session_holds` for matching a bigint key in `pg_locks`, and SQLSTATE checks for serialization failures, deadlocks, lock timeouts and cancelled statements. awa's leader election, batch runner and `AwaError` checks use it. It has its own version (0.1.0) and release tag, and does not depend on awa. - **`AwaError::is_serialization_failure()`** reports a `REPEATABLE READ` or `SERIALIZABLE` transaction PostgreSQL aborted with SQLSTATE `40001`, which a caller retries as a whole. [Transactional enqueue](docs/concepts/transactional-enqueue.md#isolation-levels) now says what producers at those levels should expect. - **`awa::flush_wakeups(&pool, timeout)`** sends a pool's pending wake-ups without waiting for the 50 ms window and waits until they have been sent, for at most `timeout`. A Rust producer that enqueues or retries and then exits or closes its pool calls it first; it returns `false` if the timeout ran out, leaving the jobs to polling. `Client::shutdown` (after the drain, for at most one more second), the Python client's `close()` and the CLI call it. Closing a pool fails any wake-up still waiting to be sent, so before this a Python script that enqueued and then called `close()` never woke its claimers. - Python `Job.run_lease` exposes the attempt's lease identifier, read-only, for correlating logs, as 0.6.18 does. - **The maintenance leader names the ready lane that stops queue-ring reclamation (#779).** Queue prune cannot reclaim the oldest sealed queue ring slot while any lane holds ready rows there at or past its claim cursor (`awa.maintenance.prune.attempts` with reason `queue.pending_ready`), and the ring cannot wrap until it does, so one lane that nobody claims stops storage reclamation for every queue: a paused queue, a queue no worker serves, or a lower priority starved by a backlogged higher priority with `priority_aging_interval` at zero. When prune skips the slot for that reason, the leader now records `awa.maintenance.prune.pinned_ready_age`, the age of each pinning lane's first pending row by `awa.job.queue`, `awa.job.priority` and `awa.queue.enqueue_shard`, set to `0` once the lane stops pinning the slot. It also logs a warning naming the oldest lane when a lane starts pinning the slot and every 5 minutes while it persists. While a lane pins the slot the leader re-reads it at least every 15 seconds, so the gauge and warning keep updating while prune backs off. `QueueStorage::queue_ring_pin` returns the same lanes. Claiming the lane releases the slot: turn priority aging on, resume the queue, or run workers for it. Moving or reprioritising the jobs does not. See [queue ring stops wrapping behind an unclaimed lane](docs/troubleshooting.md#queue-ring-stops-wrapping-behind-an-unclaimed-lane). No configuration or schema change. - **Moving, reprioritising or cancelling the jobs of a lane that pins the queue ring releases it ([#779](https://github.com/hardbyte/awa/issues/779)).** These commands tombstone the old ready rows, but the lane's claim cursor passed them only when a claim on the lane did, or when cancels reached the cursor in lane order, so a paused, unserved or starved lane kept the ring from wrapping even after its jobs were moved or cancelled. When the maintenance leader reads the lanes pinning the oldest sealed slot, it now moves the claim cursor of each one whose first pending row is tombstoned or already claimed over those rows, stopping at the first row that can still be claimed. A read steps a lane over 1,000 positions per short transaction for up to 400 ms, or half the queue rotation interval if that is shorter, and when it used the whole budget and moved a cursor the next read runs on the next queue rotation tick, not 15 seconds later; reads run only on rotation ticks, so at a 60 s interval the advance gets 400 ms per minute. Queue prune keeps its own backoff, so it does not retry its `ACCESS EXCLUSIVE` request more often. In a 200,000-job lane cancelled newest first, with a 1 s rotation interval and `RingRotationCadence::EAGER`, the ring was released about 5 s after the cancel finished, where a read of four windows took about 9 minutes. It takes the lane and the tables it reads without waiting, so a busy lane or a slot prune holds is retried later, and it leaves a lane whose first row is live to its claimers. When a lane stops pinning the slot it logs `Queue ring prune is no longer pinned by this lane` and queue prune retries on the next tick; `awa.maintenance.prune.claim_cursor_advances` counts the advances by `awa.ring.outcome` (`advanced` or `failed`), and a lane it fails to advance is logged at warn at most every 5 minutes and does not stop the others. `QueueStorage::advance_spent_claim_heads_within` is the time-budgeted call; `advance_spent_claim_heads` takes a window count. It reads which claim evidence to trust from the schema's claim function. 0.6 workers claim alongside it unchanged: they use the same database claim function and only ever move the cursor forward. No configuration or schema change. - **The Python client's pool connection lifetime is configurable.** `awa.Client` and `awa.AsyncClient` take a keyword-only `max_lifetime_seconds` (default `1800.0`, the lifetime the pool already used). A shorter lifetime recycles connections so the pool can shrink and Postgres can free each backend's caches after busy periods; `None` disables the lifetime, as `PgPoolOptions::max_lifetime(None)` does in Rust. Zero, negative and non-finite values raise `ValidationError`. See [idle connections and Postgres memory](docs/deployment.md#idle-connections-and-postgres-memory). - **One job filter ([ADR-049](docs/adr/049-job-filter-and-indexed-tags.md), [guide](docs/finding-jobs.md)).** `JobFilter` (kind, queue, any-of states, all-of tags, dead-lettered, ids, created-at bounds) drives job listing, counting, batch preview and execution, and the DLQ, so each selects the same jobs. `admin::find_jobs` and `admin::count_jobs` (exact up to 10,000); Python `find_jobs` and `count_jobs`, with a `filter=` dict on the DLQ helpers; `GET /api/jobs` with repeatable `tag` and `state` and `GET /api/jobs/count`; `awa job list` and the DLQ commands gain `--tag`, `--state`, `--id` and created-at bounds. The admin UI's search accepts several `tag:` terms, `id:` and `created>=`/`created<`, shows the match count, and carries a search into the batch-operations form. - **Tags are indexed on queue storage.** A partial GIN index over non-empty payload tags on each partition where a job's row outlives its claim makes finding jobs by tag an indexed lookup in every state, including dead-lettered. Postgres maintains it for every binary; untagged jobs add nothing to it. - **Alert rules for ring maintenance, the DLQ and long transactions** ([#376](https://github.com/hardbyte/awa/issues/376)). The Prometheus rule set adds `awa_ring_rotation_stalled` (a ring has skipped every rotation as busy for 15 minutes), `awa_ring_prune_blocked` (every prune of a ring for 30 minutes was blocked by a lock), `awa_maintenance_branch_overrunning` and `awa_dlq_growing`. The Postgres rule set adds `awa_pg_long_transaction`, which fires on a transaction older than 5 minutes. `validate-grafana.sh` now evaluates every rule's query against the live Prometheus and Postgres, and fails on a rule with an incomplete query. - **Per-queue worker utilization metrics (#733).** Every runtime samples `awa.queue.worker.in_use` (worker slots held by a running handler or one waiting for finalizer capacity) and `awa.queue.worker.capacity` (`max_workers`, or in weighted mode `min_workers` plus the overflow pool) for each queue on each runtime snapshot, so a dashboard can plot utilization as in-use ÷ capacity. Waits grow steeply once utilization stays above about 0.8; see [sizing workers from utilization](docs/configuration.md#sizing-workers-from-utilization). The overview Grafana dashboard has a **Worker utilization by queue** panel. - **The queue-storage prune `lock_timeout` is configurable, and prune attempts are counted by outcome for every ring.** Prune (queue, lease and claim rings) and terminal-delta rollup take their exclusive locks under a 10 ms `lock_timeout` that could only be changed through the hidden `QueueStorage::with_prune_lock_timeout`. When short readers of the ring partitions held a conflicting lock at that instant, prune reported `blocked` every tick and the rings stopped recycling. Set it with `ClientBuilder::prune_lock_timeout` (Rust) or `queue_storage_prune_lock_timeout_ms` on `client.start()` (Python); the timeout applies separately to each lock acquisition, not to the whole prune; queue prune takes its other initial partition locks with `NOWAIT`. Later statements also run under the timeout. The default stays 10 ms and zero or a value above PostgreSQL's `lock_timeout` maximum is rejected. Start logs a warning when the value is at or above the connection's `deadlock_timeout` (prune waiting that long can make deadlock detection cancel a claim instead) or `statement_timeout`. `with_prune_lock_timeout` is now public, with `set_prune_lock_timeout` and `prune_lock_timeout()`. `awa_maintenance_prune_attempts_total{awa_ring,awa_ring_outcome,awa_ring_reason}` gains `backed_off` (prune skipped by the post-`skipped_active` backoff) and `error` (prune failed with a database error) alongside the existing `pruned`, `noop`, `blocked`, `skipped_active` and `already_pruned`. See [Configuration](docs/configuration.md#what-the-knobs-mean). ### Changed - **Every function awa installs that sets a `search_path` now lists `pg_temp` last and leaves `public` out**, in `awa` and in every queue-storage schema. With `pg_temp` left out, PostgreSQL searches the session's temporary schema first for tables, so a function running with its owner's privileges below a `SECURITY DEFINER` function could have read a caller's temporary table in place of its own. No function did so in a release. Migrations and schema preparation rewrite the paths in place; a migration role that can neither act as a function's owner nor `SET ROLE` to it leaves that function as it was, with a warning naming the call to run as the owner. - **Enqueues and retries that commit their own transaction no longer notify inside it ([ADR-053](docs/adr/053-coordination-off-the-commit-path.md), #841).** A transaction that calls `NOTIFY` takes PostgreSQL's cluster-wide notify lock at `COMMIT` and holds it until its commit is flushed, so every notifying commit in the cluster waits its turn; with a 10 ms commit flush, 32 producers that each notify inside their insert transaction commit about 93 jobs a second in total, against about 2,600 without. `QueueStorage::enqueue_params_batch`, `enqueue_params_copy` and `enqueue_batch`, `retry_job`, `retry_jobs_by_ids`, `dlq::retry_from_dlq`, `bulk_retry_from_dlq`, priority aging and promotion now send their wake-ups after `COMMIT`, coalesced to at most one `NOTIFY` per queue per 50 ms from each pool: the first at once, later ones at the end of the window. A listener receives fewer notifications. An idle claimer wakes within a few milliseconds of the first commit in a window; a commit within 50 ms of the last notification waits for the window to end. Inserts through `insert`, `insert_with`, `insert_many` and the other SQL-function paths, and the public `*_tx` methods, still notify inside the caller's transaction. A wake-up lost because the process exits between `COMMIT` and the notification, or because the notification fails, delays the claim until the claimer's next poll, at most the idle poll backoff (2 s, or `poll_interval` when larger). `Client::shutdown`, the Python client's `close()` and every CLI command send pending wake-ups before they return, waiting at most a second (see `awa::flush_wakeups` under Added), so a short-lived producer that ends with one of them normally wakes claimers at once. A process that exits without them, such as a serverless function frozen after it returns, leaves its jobs to polling. ADR-053 supersedes ADR-045 and keeps its trigger contract. No configuration or schema change. - **An idle runtime costs the database far fewer transactions.** With nothing enqueued, one process with one queue went from about 35 to about 9 transactions a second, and steady idle WAL from about 240 to about 100 bytes a second. Promotion checks for due rows with one read-only query before running its full pass; the batch-operation runner checks for an active operation before taking its lock; a dispatcher's fallback poll after an empty poll ends on a zero ready signal instead of refreshing its claimer lease and claiming; an idle ring that never rotated no longer runs a prune pass per tick; and a ring that keeps reporting idle is checked at a doubling interval up to 4 seconds (with a rotate interval of 2 seconds or less). Promotion still runs every `promote_interval`, and the lost-NOTIFY fallback still polls every 2 seconds. `QueueStorage::queue_counts_fast` now reads its counts in one statement. - **Listing is faster on queue storage.** Candidate queries write only the predicates a filter sets and read only the storage its states can reach, one branch per read phase so each phase releases its partition locks, and a page of jobs loads in one batched read instead of one round trip per job. Previously a listing query bound every field as `($n IS NULL OR …)` and degraded to minutes once Postgres switched it to a generic plan; at 50,000 retained jobs a rare-tag lookup now takes tens of milliseconds instead of more than two minutes. - **Automatic retries spread wider (#733, migration v059).** `awa.backoff_duration` drew the delay before a retry from `2^attempt` seconds plus 0 to 25%, so jobs that failed together retried close together and hit a recovering dependency at once. The delay is now `2^attempt` seconds times a random factor in [0.5, 1.5), capped at 24 hours as before: the mean is the base delay (previously 12.5% above it), the shortest possible delay halves, and in a simulation of 10,000 jobs failing together the peak retry rate for each attempt falls by about 3.5×. v059 is one function replacement with no table locks, and binaries before it use the new delays as soon as it commits. See [v059](docs/upgrade-0.6-to-0.7.md#v059-wider-retry-jitter). - **Dashboard refreshes share one bounded polling scheduler.** Managed views coalesce mutation/focus/manual demand, reconcile independently, pause in hidden tabs and retain stale data on failures. Selected jobs and manually refreshed counts keep their refresh exceptions. Aggregate caches fence obsolete fills after local mutations and return source-observation/cache-age headers. See [admin observation](docs/admin-observation.md) for scope and validation limits. ### Fixed - **A claim no longer moves a lane's cursor past rows it did not take when the lane's rows are spread across ring slots** (#885, migration v064). `claim_ready_runtime` read its target slot from the lane's cursor with no upper bound, so it was correct only while the lane's unclaimed rows in that slot were one contiguous run and none left the slot between the claim choosing it and reading it. Interleaved rows, or a transaction that moved rows between slots and committed after the claim's snapshot and before its head lock, made the cursor pass rows that were then never claimed and were pruned with their slot. The interleaved layout is the one #847 reported, and binaries before v062 can still write it in a mixed fleet, so this is the claim-side fix for it; no release moves rows between slots yet, but the bound is a prerequisite for moving them (#779). The claim now resolves its target again after taking the lane's head lock, and reads, both when it finds the first visible row and when it takes rows, only below the first segment of another slot: it looks at the first two segments to find the first row and the nearest `max_batch + 1` to take rows. A lane whose rows alternate between slots claims one run per call and a claim may return nothing when it met a stale target; neither loses a row. v064 rewrites `claim_ready_runtime` and each `claim_ready_slot_` in every queue-storage schema in place and takes no table locks; the functions' arguments and results are unchanged, so binaries before it claim as before. Each claim adds one probe of `ready_segments` for the re-resolve and a bounded one in each read. See [ADR-054](docs/adr/054-claim-target-bound.md) and [v064](docs/upgrade-0.6-to-0.7.md#v064-bounded-claim-reads). - **Admin UI: the phone navigation drawer opens.** Below 768px, which includes a desktop browser at 200% zoom, the drawer closed in the same moment it opened, so no page could be reached from the navigation. It now opens, and closes once a page is chosen. At that width wide tables scroll inside their own frame instead of widening the page. - **Admin UI: error text is readable in light mode, and warnings in dark mode.** List errors and the label of an unhealthy runtime loop used the near-white colour meant for text on a red background, and the read-only banner, the storage-transition warning and the queues page's "Mismatch" warnings used a near-black one in dark mode. They now pass WCAG AA contrast in both themes, as do job ids and the default priority in the jobs list. - **Admin UI: a failed read no longer shows as zero or as an empty list.** When job counts fail to load, the dashboard's state tiles show "—" and the error instead of 0. Batch operations and Cron show loading, an error with Try again, or their empty state, where they showed "No data found" or "No cron schedules found". The status line says a view failed to load, rather than that its retained data is stale, when it never loaded, and leaves out not-found pages. - **Admin UI: the DLQ page of a never-used install shows an empty DLQ** instead of "DLQ APIs currently require an active queue_storage backend". Until a queue_storage backend is active, `GET /api/dlq`, `/api/dlq/depth` and `/api/dlq/{id}` answer `[]`, a zero depth and `null` instead of a 400; DLQ writes still refuse. - **Admin UI: job, queue, DLQ-row and runtime-instance pages for an id or name that doesn't exist say so and link back to their list,** instead of printing `Error: ApiError: …`. - **Admin UI: the dashboard's state sparklines are removed.** They plotted jobs by the minute they were created, split by their current state and each scaled to its own range, so they showed no trend. `GET /api/stats/timeseries` is unchanged. - **Admin UI: batch operations show processed, skipped and errored rows separately,** and a completed operation that changed no job says "No jobs changed" instead of reading as 3,000/3,000 done. A failed operation shows its last error. - **Admin UI: restarting a job that is waiting for a callback asks first.** Its Retry button is now "Restart…", whose confirmation says that work the handler already started may happen twice; bulk Retry asks the same when the selection includes waiting jobs. A retryable job's page and the bulk toolbar say that retryable jobs retry automatically, which is why Retry doesn't apply to them. - **Admin UI: Dead letters is in the sidebar.** Each page sets its own browser tab title, queue lag reads as a duration ("25m 24s", "—" when there is none) instead of decimal seconds, the drain toast gives the number of jobs cancelled, and `waiting_external` badges have dark-mode colours. - **During a 0.6 to 0.7 rolling upgrade, maintenance and callbacks follow the ring cursor a 0.6 leader advances.** Until the ring-authority flip, a 0.6 maintenance leader moves each ring cursor without recording it in the rotation ledger, and three 0.7 paths read the ledger alone. A callback registered on a receipt claim put its lease into a lease slot the ring had already left, and an outstanding callback there kept the lease ring from rotating into that slot, so the current lease slot kept every new lease and prune could not reclaim it. Rescue visited claim slots in the wrong order, so dead claims in the oldest slot were found later. The terminal-count delta rollup folded nothing, so pending deltas piled up and made exact counts slower to read (they stayed correct). All three now read the cursor the schema's authority names. Re-running the installer on a schema already in ledger authority also no longer writes a `(-1, -1)` row into the rotation ledgers. - **A discarded or purged job no longer reads as available.** On queue storage, `admin::discard_failed` (`awa job discard`) deleted a failed job's terminal row, and `dlq::purge_dlq_job`, `dlq::purge_dlq_matching` (`awa dlq purge`) and DLQ retention deleted a dead-lettered job's DLQ row, without tombstoning the ready row the job was first claimed from. That retained row then made `admin::get_job` report the job as `available` until queue prune reclaimed its slot, although no worker could claim it. Each of them now tombstones the job's retained ready rows in the same transaction. - **Canonical rescue no longer cancels an attempt that recovered after its rescue conflicted on a unique key.** When a stale-heartbeat, deadline or callback-timeout rescue of one row failed on a unique claim, the fallback cancelled the job by id and state alone, after the failed statement had released its row lock. A worker that heartbeated in between, or a job rescued and claimed anew, could be cancelled and its handler told to stop. The cancellation now rechecks the rescue's own condition and leaves such an attempt running. 0.6.19 has the same fallback. - **Canonical promotion's row-by-row fallback passes over due rows another transaction holds,** as the batched promotion does, so a locked prefix no longer fills its batch and ends the pass. - **A duplicate cancellation of a migrated snooze records the attempt that ran,** not the snooze successor's decremented attempt, and canonical duplicate cancellations mark their error entry `terminal`, as queue storage's do. - **`QueueStorage::reset()` works on a schema upgraded from 0.6.** It inserted each ring slot without a `generation`, which only a fresh install gives a default, so on an upgraded schema it failed with a not-null violation, and so did `install_queue_storage(reset=True)` in Python. Before the ring-authority flip it also left the ring cursor columns where they were while restarting the rotation ledger, so the cursor and the ledger disagreed after a reset. It now writes each slot's generation and, before the flip, restarts the cursor columns at slot 0, generation 0. - **The maintenance leader lock and the batch-operation runner lock can no longer be left held on a pooled connection.** Both are session advisory locks taken on a connection checked out of the worker's pool. The batch-operation runner returned that connection to the pool still holding the lock if its future was dropped or its unlock failed, and from then on no instance ran batch operations until the connection closed. The maintenance leader released its lock on graceful shutdown, but an aborted leader task dropped its connection back into the pool still holding the lock, so no other instance could become leader until that connection closed. Both locks now close their connection unless the unlock succeeds, through `SessionAdvisoryLock` from the new `pg-session-lock` crate, and `scripts/check-advisory-locks.py` checks that every session advisory lock, in Rust and in migration SQL, is released on every path. - **The transactions awa opens to write run at `READ COMMITTED` whatever the session's default isolation level.** They opened with a plain `BEGIN`, so a role or database `default_transaction_isolation` of `repeatable read` or `serializable` applied to them, and queue storage's take-a-lock-then-read steps could miss rows committed while they waited (#847). Every transaction awa opens to write now begins with `BEGIN ISOLATION LEVEL READ COMMITTED`, at no extra cost; the read-only reads that want one consistent snapshot, such as loading jobs, keep naming `REPEATABLE READ, READ ONLY`. That includes claims, drains and receipt rescue, which begin with their own `SET LOCAL` settings. Single statements a worker runs outside a transaction, such as heartbeats, still use the session default, and the worker logs a warning at start when that default is above `READ COMMITTED`. Transactions a caller passes in, and those the Python client's `transaction()` and `transaction_sync()` hand to the application, keep the caller's level. - **A cancelled claim or enqueue can no longer leave a lane stalled until its connection closes** (migration v062). `set_sequence_next`, which moves a lane's claim or enqueue cursor, and the enqueue-head trigger's block allocation hold a session advisory lock on the lane's sequence for a moment, and released it in a `WHEN OTHERS` handler, which does not catch a cancel or statement timeout. A cancel that landed just after the lock was granted left it held on the pooled connection, and every later claim cursor move or reservation on that lane waited for it. Both now release the lock on any error. v062 refreshes them in every queue-storage schema through `awa.refresh_lane_sequence_helpers`. - **A job enqueued in a `REPEATABLE READ` or `SERIALIZABLE` transaction is no longer skipped by claims and then deleted by prune (#847, migration v062).** An enqueue reserves its lane position under the lane's lock and then reads the queue ring's cursor to choose the ring generation its rows go into. In a `REPEATABLE READ` or `SERIALIZABLE` transaction that read uses the transaction's snapshot, taken before the lock wait, so a job could get a later lane position than a job already committed into a newer generation yet land in the older one. Claims read one generation's segment at a time and moved the lane's claim cursor past it, and queue prune then deleted the slot holding it. A snapshot older than a whole turn of the ring could also write a job into a slot the ring had since reused, which prune deleted the same way. The Rust enqueue paths and the SQL compatibility producers (`awa.insert_job_compat`, `awa.insert_jobs_compat_batch`) now read the cursor through `.enqueue_ring_cursor()`, which returns the newer of the transaction's cursor and a per-schema generation floor kept in a sequence, which ignores snapshots. Every enqueue raises the floor before it commits, and the rotator raises it after each rotation. Queue prune now counts an unclaimed row, a lease or an open claim of any generation in the slot as pending (and `queue_ring_pin` reports such rows), and the terminal-count rollup folds every delta in the slot, so a job written before the upgrade into a slot the ring has since reused holds that slot, keeps running and stays counted instead of being deleted. A job that an inversion before the upgrade already left behind its lane's claim cursor is not protected and is deleted when its slot is pruned; `drain_queue`, which starts at the claim cursor, cannot reach it. Runtime roles need no new grant. See [v062](docs/upgrade-0.6-to-0.7.md#v062-ring-generation-floor). - **Per-queue DLQ settings apply to striped queues.** With `queue_stripe_count` above 1, jobs are claimed from physical stripes `q#0` … `q#N-1`, and the runtime looked up `queue_dlq_enabled` and the DLQ part of `queue_retention` by that physical name, so an override for `q` never applied: with DLQ off by default and `queue_dlq_enabled("q", true)`, exhausted jobs failed instead of moving to the DLQ, and a longer DLQ retention for `q` did not protect its rows from the global retention. While the runtime stripes its queues (`queue_stripe_count` above 1), a stripe now takes its logical queue's DLQ override and DLQ retention unless it has an override of its own. A stripe is `q#N` where `N` parses as `usize`, the rule the runtime routes by, so stripes left from a larger former stripe count still count and a queue such as `q#999999999999999999999999999999` does not. With one stripe, a queue named `q#0` stays a queue of its own. Metrics still label jobs from a stripe with the stripe's name. - **A burst of finalizes on a fresh runtime probes for the job output columns once.** Every finalize carrying a completion output checked the catalog for migration v052's output columns before it reached the finalize gate, so a burst could run that probe on every pooled connection at once. Concurrent cache misses from pool callers now wait for one probe (`QueueStorage::supports_job_output_from_pool`); if it fails, the callers that waited for it fail at once with a retryable error instead of each probing again. A caller inside a transaction still probes on its own connection and never waits on a pool probe. - **The admin cancel listener retries a failed first connection.** If its first connection or `LISTEN` failed, the listener logged a warning and never started, so admin cancels stopped waking running handlers until the process restarted. It now retries with backoff from 250 ms to 30 s. A dropped connection after it started was already re-established; it now also logs `PG cancel listener connection lost; reconnecting`, since cancels committed while it was down do not wake their handlers. - **Claimers no longer queue on a lock to refresh an unchanged claimer target.** Every dispatcher refreshed its queue's `queue_claimer_state` row with `INSERT ... ON CONFLICT DO UPDATE` once the row was older than the 500 ms control interval. That statement locks the existing row even when its `WHERE` clause skips the update, so the refreshes from every instance waited on one row lock per queue and each wrote a new row version, even when the target had not changed. The target is now written only when it changes, with an `UPDATE` that takes no lock on a row it skips. An unchanged target costs two reads and no write; `updated_at` records the last change. - **With `queue_stripe_count` (`queue_storage_queue_stripe_count`) above 1, jobs inserted through the SQL compatibility path are claimed again (#749).** That path writes the unstriped logical queue `q`, and striped workers read only `q#0` … `q#N-1`, so these jobs were never claimed or counted. It covers the Rust `insert`, `insert_with`, `insert_many` and `insert_many_copy` families, Python `insert`, `insert_sync`, transactional inserts and `insert_many_copy`, cron, follow-up jobs enqueued by handlers, and producers configured with one stripe. Striped claims, `prepare_queue` and queue counts now read `q` as well as its stripes; the claim loop probes `q` as one more turn in its round-robin over the stripes. Nothing changes for one-stripe deployments. Forward-ported from 0.6.18. - If you ran with more than one stripe, list the jobs left in unstriped queues with `SELECT queue, state, count(*) FROM awa.jobs WHERE state IN ('available', 'scheduled', 'retryable') AND strpos(queue, '#') = 0 GROUP BY queue, state;`. After the upgrade the workers claim them; they do not need to be moved or re-enqueued. - Striped enqueues route jobs that share an `ordering_key` to one stripe, so they are claimed in insertion order (#749). Routing ignored the ordering key and picked the stripe from the job's position in its batch, so a key's jobs were spread across stripes and claimed out of order, and every single-job insert without a unique key went to stripe 0. A job's stripe now comes from its ordering key, else its unique key, hashed with the stable `ordering_key_hash64` (the unique key used `std`'s `DefaultHasher`, which is not stable across Rust releases) and mixed with a SplitMix64 finalizer, so short keys such as decimal ids spread evenly and a stripe's keys still use every enqueue shard. Other jobs rotate across stripes from a randomly seeded per-producer counter. During a rolling upgrade a key's backlog can be split between old and new routing; per-key order holds again once old producers have stopped and their backlog has drained. Forward-ported from 0.6.18. - **Reading one job by id no longer misses a job that moved mid-read.** The loader behind `get_job` and filtered listings reads every table from one snapshot (`REPEATABLE READ READ ONLY`); a promotion or retry committing between two of its statements could hide the job. - **A batch operation the runner can't read is marked failed** instead of being claimed on every tick, which blocked every later operation. The same goes for one whose stored filter no longer suits its operation. - **`awa storage build-tag-index --now` waits out long transactions** rather than aborting after 5 s and leaving an invalid index that every write still maintained. It runs on its own connection with no lock or statement timeout, and also drops the `_ccold` copies a failed rebuild leaves. - **Job filters are bounded while they're parsed.** Tag de-duplication is linear, and the query-string parser stops at 20 tags or 1,000 ids, so an oversized request costs no more than the limit. - **The DLQ listing has the same 30-second read budget** as job listing. - **Admin UI:** the DLQ page shows the server's error instead of "DLQ is empty" and disables bulk actions while its list is failing or loading; a 4xx response is not retried; the jobs page shows the server's message. A batch operation needs a preview of the form's current filter and a confirmation stating its scope and count, and the jobs page offers the batch link only for a search that narrows the population. - Claiming from a ready slot that holds tombstones no longer scans the slot's whole tombstone partition on every claim (#713, reported and fixed by @Wallace99, migration v060). Each claim checks its candidate rows against `ready_tombstones`, and for a small batch PostgreSQL could plan that check as a hashed subplan over the partition instead of one index probe per row: a 32-row claim read 10,000 tombstone rows in the regression test. The check now carries `OFFSET 0`, which keeps it correlated. v060 rewrites `claim_ready_runtime` and every `claim_ready_slot_` in the default and every trusted custom queue-storage schema in place, without reinstalling tables or triggers; it takes no table locks, and binaries before it claim unchanged. 0.6.17 made the same change through its `correlated_claim_tombstones` schema patch. See [v060](docs/upgrade-0.6-to-0.7.md#v060-correlated-claim-tombstone-checks). - **The `awa_job_output_schema_missing` alert rule imports.** Its query had no expression or datasource and the rule had no threshold, so Grafana refused to provision it. It now fires when a queue drops outputs with reason `schema_missing` for 10 minutes. - **A completion batch no longer waits to fill while attempts keep arriving (#732).** A completion shard restarted its flush timer on every arrival, so while attempts arrived faster than one per flush interval a batch was written only once it reached `AWA_COMPLETION_BATCH_SIZE`. With the defaults, a completion could wait up to about 511 ÷ the shard's completion rate before being written: about 250 ms at 2,000 completions per second per shard. The flush deadline now starts when the first attempt of a batch arrives, so a batch is written when it is full or `AWA_COMPLETION_FLUSH_MS` (default 1 ms) after its first attempt, whichever comes first. - **A queue lane is usable by every runtime role, whichever role creates it first (migration v053).** A lane's enqueue and claim sequences belonged to the role that first enqueued into, claimed from or promoted into it, so with several runtime roles sharing a group role, any role other than the creator whose default privileges did not cover it failed with `permission denied for sequence`. That included the maintenance leader promoting into a shard created after `enqueue_shards` was raised. Lanes are now created through two `SECURITY DEFINER` functions per queue-storage schema, `provision_lane` and `provision_lane_sequences`, owned by the schema owner. Each new sequence gets the privileges of the head table it backs, explicitly rather than through default privileges. A runtime without schema `CREATE` can therefore create lanes itself, and `awa storage prepare-queue` is optional and may run as any runtime role. After v053 commits, `awa migrate` gives existing lane sequences to the schema owner and adds their missing grants, one sequence per transaction with a 300 ms lock wait, and only where it is allowed to, trying the effective role and then the login role. A sequence an open transaction holds is skipped and reported as busy; one it may not change is reported with the roles that can repair it. Neither fails the migration. The new read-only `awa storage lane-sequences` (or `awa.lane_sequence_problems(schema)`) lists what remains, with the statements to run and the roles to run them as, and exits 2 while any remain; `--repair` (or `awa.repair_lane_sequence(schema, sequence)` per sequence) repairs what the connected role may. `awa migrate` prints a summary of the leftovers. A binary running ahead of v053 detects that `provision_lane` is missing and creates lanes as before, and older binaries create correctly owned lanes once v053 has refreshed the helpers they call. See "Lane ownership and v053" in the 0.6 to 0.7 upgrade guide. - Retry queue-storage worker finalization after transient lock contention within its 120-second running-work budget, preserving the saved handler outcome. Waiting for an accepted completion batch pauses that budget; admission, direct writes, post-acknowledgement reads and retries use the remaining time. Keep attempt heartbeats active until finalization settles while releasing handler capacity. Runtime shutdown retains its existing drain limit. Direct store APIs still return contention errors for caller retries. - Schema-only admin clients use installed ready-slot numbers for point reads, cancellation and retained-body recovery, including rings larger than the default. - Keep committed claims out of physical priority aging before its batch limit, even before their cursor advances. Active point and callback reads recover retained tombstoned bodies left by older aging. Recovery, cancellation and completion by ID hydrate those bodies and retire unclaimed copies of the same attempt, preserving original-priority metadata and rejecting ambiguous historical bodies. Emitted-lane evidence takes precedence over colliding live replacements, and their recovered terminal bodies remain self-contained through retry. Cancellation prefers an active attempt over its historical available replacement. Historical receipt evidence remains usable after reopening a custom store in legacy mode. Without that evidence, legacy or backfilled claims retain a compatibility fallback that cannot reliably identify the original physical lane in this historical collision. Repair runs only when a transition hydrates a retained tombstoned body; worker completion using its carried job body can leave an old replacement claimable. Updated aging callers prevent new replacements, but cannot fence an older process explicitly calling physical aging during a rolling upgrade. Repair takes claim-head row locks without waiting. Rescue batches defer busy historical attempts while progressing other attempts; receipt rescue cursors keep deferred attempts eligible. Worker completion batches isolate lock contention to the affected requests. Direct store completion and single-attempt store mutations still fail on contention and must retry. It adds weak relation locks and tombstone writes only on this recovery path. Fresh rechecks rely on READ COMMITTED isolation. - Preserve recovered bodies and physical lane priority when manually moving historical aged terminal failures to the DLQ, so later DLQ retry retains arguments, attempt limits and priority provenance. Terminal counters are decremented at their original stored priority; automatic rescue-to-DLQ policy keeps the effective priority. - Recover retained terminal bodies from the exact prior attempt when older workers stored an aged effective priority in a narrow terminal key. Live moved-lane metadata supplies defaults without replacing stored terminal metadata, errors, tags or progress. Manual terminal retry restarts aging from the physical lane; counter removal keeps the stored terminal key and failed carry derives replacement counters from its inserted rows. The installed `terminal_jobs` SQL view is unchanged for older mismatched-priority rows; bodies whose ready backing was already pruned cannot be reconstructed. - Exclude tombstoned source lanes and require the prior run lease when hydrating rescued attempts, retaining physical priority only for terminal identity. Deferred retry and DLQ policy keep effective priority. The lookup reads only validated referenced tombstone children; this adds read locks. - Preserve the original job body when manually retrying a priority-aged attempt that exhausted its retries during rescue. Retained failed reads and failed-row carry through pruning now use the physical ready-lane identity. - Close read connections if their transaction start is cancelled or fails before SQLx acknowledges it, so later reads cannot inherit an untracked transaction. - **Point reads show the live queue and priority after a lane move.** Retained ready rows from before a priority or queue change could win a read's tie after the ring wrapped, returning the old fields even though the batch operation succeeded. Point reads now exclude tombstoned source rows. - **Callback completion, `get_job` and lifecycle events find running jobs that priority aging promoted** (the Rust side of [#569](https://github.com/hardbyte/awa/issues/569)). Claims and leases record a job's aged effective priority while its ready row keeps the lane priority, and the job and admin reads joined them on priority. With aging on (the default, every 60 s), a job that waited past a minute before it was claimed could not be completed by callback with an expected kind, failed the mixed-transition callback routing check, and read back from `get_job` in the wrong state. Admin job lists, kind counts and cancellation by unique key also missed those running jobs. They now match the attempt (`job_id` and `run_lease`), skipping the tombstoned source row a lane move leaves behind. - **`get_job` no longer misses a job that moves while it reads.** It read ready, deferred, leased, claimed, completed and DLQ rows in separate statements, so a job promoted, claimed or completed between two of them could read as missing; the weekly mixed-version rehearsal hit this on 2026-11-01. It now reads all of them from one read-only snapshot, after locking the ready, lease and claim rings so prune cannot truncate a partition the snapshot still needs. - **Ring prune and terminal-count rollup report `Blocked` when any of their statements times out on a lock.** Prune sets a short `lock_timeout` (10 ms by default) before it takes `ACCESS EXCLUSIVE` on a slot's partitions, but only those `LOCK TABLE` statements and the final `TRUNCATE` turned a timeout into `PruneOutcome::Blocked`. The timeout covers every later statement in the transaction too: the post-lock liveness checks read the lease and claim partitions, the failed-row carry inserts into the current slot's `done_entries` and terminal-count deltas, and the fold appends `queue_terminal_rollup_deltas` and deletes `queue_terminal_live_counts` rows. When one of those waited out the timeout, for example behind autovacuum truncating a relation or a hosted Postgres's own background workers, prune failed with a `lock_not_available` (`55P03`) database error, was logged as an error and skipped the prune backoff. A lock timeout in any statement after a queue, lease or claim prune, or a terminal-count rollup slot, sets its `lock_timeout` now rolls the whole transaction back and reports `Blocked` (`blocked_slots` for rollup), so maintenance backs off and retries; nothing the attempt wrote survives the rollback. A rollup pass stops at its first blocked slot rather than waiting out the timeout again on each remaining one. - **Batch enqueues take their lane locks in one order, so they no longer deadlock with each other.** On queue storage every enqueue holds a transaction-scoped advisory lock on its `(queue, priority, shard)` lane until commit. `insert_many` and `insert_many_copy` took those locks in input order, while `QueueStorage` batch enqueues took them in sorted order, so a batch spanning several queues listed differently from another batch or from a `QueueStorage` enqueue could deadlock with it (`40P01`). The two insert paths now sort rows by `(queue, priority, shard)`, queues compared bytewise, before they reach `awa.insert_job_compat`, the order `QueueStorage` already used, and still return rows in input order. Job ids within a batch that spans several lanes are now allocated lane by lane rather than in input order, and when an `insert_many_copy` batch carries the same unique key in more than one lane, the row in the lowest lane is the one inserted. A transaction that enqueues with separate statements still takes locks in statement order; see "`deadlock detected` while enqueueing" in the troubleshooting guide. - **Scheduled, snoozed and retry-after jobs are no longer held back while the maintenance leader is overloaded.** The leader backs a maintenance branch off for a cooldown after its body repeatedly runs longer than its interval, and promotion, which makes every scheduled, snoozed and retry-after job runnable, was backed off like the rest, so those jobs waited out the cooldown. The cooldown also counted ticks, and under CPU starvation the leader loop services a branch's tick only once many other branches have run, so a cooldown of a few seconds could last several times that. Promotion is no longer backed off; other branches (rescues, cleanup) back off for a wall-clock duration of twice the overrunning body, capped at five seconds. The leader's interval timers also delay rather than burst after a stall, so a stall no longer queues back-to-back catch-up ticks. - **`admin::drain_queue` on queue storage cancels a backlog in bulk and drains every stripe of a striped queue.** It found the queue's jobs through a lookup that read every retained ready row, then cancelled them one at a time, several statements each, inside one transaction, so draining a large backlog took minutes and held its row locks throughout. Scheduled, retryable and available jobs are now cancelled 1,000 at a time, each chunk one short transaction, with available rows read from each lane's claim cursor; waiting jobs are still cancelled one by one and running jobs are left alone. Jobs enqueued after the drain starts are left for a later call, so draining a queue that keeps receiving work still returns, and the drain moves each lane's claim cursor past the rows it cancelled, so workers reach the jobs behind them on their next poll. It also matched only the logical queue name, so draining a striped queue cancelled nothing; it now covers every stripe. `awa queue drain` and the Python `drain_queue` use this path. - **Cancelling, moving or reprioritising an available job on queue storage no longer acts on a job a worker has already claimed.** A claim moves its lane's claim cursor past the rows it took only after it commits, so briefly, or until the next claim if that advance failed, a claimed row still looked available. A cancel in that window wrote a cancelled terminal row while the attempt kept running, and a move re-enqueued a job that was already executing. A claim still in progress was missed the same way. These paths now wait for any claim in progress on the job's lane and skip rows a claim has recorded, the same evidence claims use to skip them, so a cancel reaches the running attempt instead. - **Queue storage no longer drives PostgreSQL 18 into a backend crash when a rescue, cancel or claim close locks a row-local claim that was just rewritten.** A statement that locks a row another transaction updated after the statement's snapshot rechecks the row (EvalPlanQual). In PostgreSQL 18 (reproduced on 18.6) that recheck rebuilds the statement's run-time partition pruning state in memory that is freed when the lock runs out of rows, so a later pruning pass in the same statement reads freed memory and the backend segfaults ([pgsql-bugs report](https://www.postgresql.org/message-id/CAP2G_gGpV%3DrKMLuET4RW-qO41GvBvi6Czsjsj16eT9hAwHxG6w%40mail.gmail.com)). 0.6 runtimes write a row-local claim for every deadline-bearing job, and their deadline rescue crashed the server when a heartbeat rewrote an expired claim mid-rescue; this branch writes compact claims, so it meets row-local claims only while 0.6 runtimes are still in flight. The rescues now update the slot's own claim partition, the completion, heartbeat, progress, callback and close paths lock their attempts' row-local claims in a statement that prunes nothing before the statements that lock them again, and cancel locks row and batch receipts in separate statements. - **`insert_many` no longer fails above 5,461 jobs in one call.** It built one multi-row `VALUES` statement with twelve bind parameters per job, so a call with more than 5,461 jobs exceeded PostgreSQL's 65,535-parameter limit and failed client-side with `too many arguments for query` before reaching the server. It now sends one array per column through a single fixed-text statement over `unnest(...)`, so the bind count no longer depends on the batch size and the call keeps its single-statement, caller-transaction semantics, on both the canonical and queue-storage engines. - **Duration and size histograms now export explicit bucket boundaries, so latency quantiles are accurate.** `awa.job.duration`, `awa.dispatch.claim_duration`, `awa.dispatch.wake_to_claim_duration`, `awa.completion.flush_duration` and `awa.maintenance.promote_duration` record seconds but were exported with the OpenTelemetry SDK's default millisecond-scale buckets (0, 5, 10, 25, ... 10000), so almost every observation landed in the first bucket and `histogram_quantile` p50/p95/p99 were flat lines near 2.5 s, 4.75 s and 4.95 s whatever the real latency. Latency histograms now use 0.5 ms to 30 s buckets and job duration uses 1 ms to 1 h buckets. The batch-size, capacity and skipped-row histograms (`awa.enqueue.batch_size`, `awa.dispatch.capacity_available`, `awa.dispatch.claim_batch_size`, `awa.completion.flush_batch_size`, `awa.maintenance.promote_batch_size`, `awa.maintenance.rotate.skipped_rows`, `awa.maintenance.prune.skipped_rows`) now use power-of-two buckets from 0 to 8192. Quantile panels become accurate after upgrading. The `le` labels of these histograms change, so a quantile computed over a range that spans the upgrade mixes old and new buckets until the old series age out. - **Python: a query after `AsyncClient.migrate()` no longer stalls until the pool's acquire timeout.** `migrate()` ran the migrations on a throwaway tokio runtime but with the client's pool, so connections the pool opened during the migration went back into it tied to a runtime that no longer existed. A later query that picked one up could wait 30 s and fail with `pool timed out while waiting for an open connection`. The migrations now run on the bindings' shared runtime. This was the intermittent fixture timeout in the Python test suite (#420). - **`awa storage prepare-queue` provisions lanes a 0.6 runtime created.** A runtime role with schema `CREATE` owns the lane sequences it creates. Provisioning such a lane as the owner, the first step of revoking runtime `CREATE`, failed with `permission denied for sequence`: the head tables' `BEFORE INSERT` triggers run even for a row `ON CONFLICT DO NOTHING` then skips, and they read and set the lane's sequence. Lane inserts now skip rows that exist. Found by the 0.6.10 upgrade rehearsal. - **`admin::cancel_by_unique_key` and `cancel_by_unique_key_tx` on queue storage find running jobs and no longer read retained history** ([#585](https://github.com/hardbyte/awa/issues/585)). The candidate lookup built every available ready row before filtering by key, reading every retained ready row, completed jobs included. A missing key cost as much as a full scan, and the transaction variant held the caller's transaction while it ran. Given a queue, it now starts from that queue's ready rows holding the key and checks only those jobs for being available, leased or on an open receipt claim; with no such row, only the `deferred_jobs` key index is read. Its cost follows that queue's own rows, not other queues' backlogs or the claim ring, which a long-running job can keep from pruning. Without a queue, available rows are walked lane by lane from the claim cursor and open receipt claims are read in full. It also finds jobs running on receipt claims not yet materialised into `leases`, which it missed, so they couldn't be cancelled by key. - **The admin UI's runtime page no longer shows the storage transition card once the transition is finalized.** It stayed up on every cluster running queue storage; it now appears only while an engine is prepared or a mixed transition is in flight. - **The admin dashboard's reads no longer grow with retained history on queue storage, and a test keeps them that way.** `awa-ui`'s `admin_read_cost_test` serves every endpoint the UI polls against ten times more retained history and fails if a read does more work. It found four more reads that grew with history: - Available counts read every retained ready row. They now walk each lane's segments from its claim cursor. - Running counts expanded every retained claim batch. A batch whose receipts have all closed is now skipped before it is expanded. - The timeseries read its window's completions through `terminal_jobs`, which joined them to every retained ready row. - Completions in the last hour, less deletions, checked each recent deletion against its lane's completion batches. One production-sized fixture took 5.4 s for that check alone. Each affected batch is now read once. `/api/kinds`, `/api/stats/kinds`, `/api/stats/queues` and job lists that can include completed jobs still read retained history; the test lists those it exercises and fails once one stops, so the list can only shrink. - **Queue lag in the admin UI is the age of the oldest available job again.** On queue storage it had become the age of each lane's next job, which hides an older job a queue move or priority aging appended behind newer ones: an hour's wait could show as a second. The workers' queue-lag gauge keeps the cheaper next-job reading. - **DLQ retries, purges and moves refresh the admin UI's cached stats and queue counts.** They didn't invalidate the dashboard caches, so failed counts lagged a DLQ action by up to the cache TTL. From #579. - **A request the admin UI's client abandons no longer holds a database connection for good.** When a browser closes a tab or a proxy times out, the server drops the request but Postgres keeps running its query. If that query then ended in an error, such as a statement timeout, sqlx 0.9 tried to close the connection, and closing a TLS connection mid-stream hangs, so the pool lost that slot permanently; a slow dashboard read polled often enough could exhaust the pool. `awa serve` now sets a 60-second statement timeout (`--statement-timeout`, `AWA_STATEMENT_TIMEOUT`), recovers such connections when they are released, and on Postgres 14+ sets `client_connection_check_interval` so a query stops when its connection closes. Applications embedding `awa_ui::router` can build their pool with the new `awa_ui::admin_pool_options` and `admin_connect_options`. - **Queue overviews on queue storage no longer read retained history.** `admin::queue_overviews`, behind the admin UI's queues and dashboard pages and `awa queue stats`, counted every current job through `terminal_jobs`, which expands each completion batch and joins it back to `ready_entries`. It now reads the live-work tables, as the workers' queue gauges do, and counts completions in the last hour from batch sizes. With 100,000 retained completions and 100,000 queued jobs it drops from 7.7 s to 0.27 s. JIT is off for the read; compiling it cost more than running it. - **The dashboard's state counts and timeseries no longer read retained history on queue storage.** `admin::state_counts` counts completions from batch sizes and available jobs per lane from its claim cursor (6.5 s to 0.24 s on the same data). `admin::state_timeseries` reads only rows finalised within its window, since a job finishes after it is created. It previously expanded every retained completion and sorted the result: against that data it ran for over 10 minutes and filled the disk with temporary files. It now takes 0.6 s, with all 100,000 completions inside the window. - **`admin::job_kind_overviews` on queue storage no longer depends on the planner's row estimates.** Behind the admin UI's kinds page, it counted every job through the `current_jobs` view. Two nodes of that view are estimated at one row whatever the statistics say: the join from completion batches to `ready_entries`, and the `UNION ALL` over every place a job can live. Postgres therefore chose nested loops that visit each retained row, and the join on `queue_claim_heads` was only as good as that table's estimate, which autovacuum never refreshes. It now aggregates each place to `(kind, queue)` on its own and combines the results: available jobs are found per lane from the claim cursor, and a completion batch's members are unnested and probed along the ready primary key. The rows are identical, and a test compares them with the former definition across every job state. With 2.6 million retained ready rows (1.8 million of them available) and 860,000 retained completions it takes about 6 to 8 s instead of 20 s on PostgreSQL 17 and 18. It still reads each available job and each retained completion's ready row, because a job's kind lives there. JIT is off for the read. - **`admin::list_jobs` on queue storage reads only the places that can hold the requested state.** It selected candidate ids from the `current_jobs` view, so every listing, whatever its filter, planned around the same single-row estimates and joined each retained completion to a scan of the ready rows. On PostgreSQL 18 a kind filter ran past a four-minute statement timeout. Each place a job can live is now read and limited on its own, only those that can hold the state asked for, with a predicate for each filter that is set rather than `$n IS NULL OR` terms, which a prepared statement's generic plan can't drop. Completion batches are ordered by job id before their ready rows are probed, so a page probes only as many as it returns. The ids are identical, and a test compares them with the former definition for every state, kind, queue, limit and page. On the dataset above, `state=failed&limit=10` drops from 12 s to 0.7 s, `state=completed&limit=100` from 20 s to 6 s, and an unfiltered or kind-filtered page of 100 from 23 s to 11 s (a kind filter on PostgreSQL 18 from more than four minutes). Available jobs and completions are still read in full when the state allows them. JIT is off for the read. ### Project - CI runs the sharded Rust suite and the queue-storage leg on PostgreSQL 19 as well as 17 and 18. On PostgreSQL 19, `max_locks_per_transaction` holds about half as many locks per unit as before, so a value carried over from 18 must be doubled (see the [upgrade guide](docs/upgrade-0.6-to-0.7.md)). ## [0.7.0-alpha.1] — 2026-10-29 ### Upgrading This release adds migrations v041 to v052. Run `awa migrate` as the migrator role; the [0.6→0.7 upgrade guide](docs/upgrade-0.6-to-0.7.md) has the details for each step. - **0.6.2 is a mandatory stepping-stone.** The ring-cursor authority work (migration v043) needs it: roll every 0.6.0/0.6.1 runtime to 0.6.2 or a later 0.6.x *before* applying 0.7 migrations, then upgrade in either order (binaries first or migrate first). The mixed 0.6.2/0.7 fleet is supported and rehearsed nightly against released artifacts; the ring-rotation ledger entry below has the staged expand, flip and contract steps. - **Rollout order.** Health-gated workers report ready only once the schema reaches their version, so migrate before rolling them out. Producers and workers without a readiness gate can roll before v050. On PostgreSQL 17 and earlier, pre-v050 binaries scan every ready partition during maintenance once v050 is applied, so replace them promptly. - **Runtime roles no longer need `CREATE` (v049).** Provision lanes with `awa storage prepare-queue` as the migrator before deploying, and grant the runtime role `USAGE, SELECT, UPDATE` on the lane sequences. Existing sequence positions are kept. - **`awa migrate` refuses to upgrade a schema another role could inject code into** (see Security). Runtimes do not run this check, so an over-privileged runtime role keeps working; only the migration is refused. Before upgrading, remove `TRIGGER` from runtime-role grants, which `GRANT ALL ON ALL TABLES` includes, remove runtime roles' `CREATE` on the schema, and remove triggers of your own from awa tables. A running 0.6 fleet keeps running if `awa migrate` from a 0.6.x CLI, 0.6.14 or later, has applied its lane schema patches before the `CREATE` revoke; see the upgrade guide. - **External migration runners.** Generate the pending SQL with an upgraded binary, for example `awa migrate --pending --extract-to ./pending`, apply complete bundles, and keep the files already applied unchanged. Apply `awa migrate --sql` output with `psql -v ON_ERROR_STOP=1`. If you re-extract every migration, V1 now differs (it is re-runnable), so a runner that validates checksums needs V1's checksum cleared. A runner that applies v045 in one transaction with earlier migrations must first take `LOCK TABLE awa.cron_jobs IN ACCESS EXCLUSIVE MODE`, as `awa migrate` does. - **Rust library users: sqlx 0.9.** Query functions accept only `&'static str`, so wrap SQL you build at run time in `awa::audited_sql`, and only after validating anything interpolated into it. `storage::flip_ring_authority` now takes a `&PgPool`. - **Rust library users: `JobRow` is `#[non_exhaustive]`.** This is a source break: code outside awa can no longer build a `JobRow` with a struct literal or functional update, or match it without `..`. Build test rows by deserializing JSON instead. Reading fields and `FromRow` are unchanged. Fields added later carry `#[sqlx(default)]`, so neither struct literals nor `query_as::<_, JobRow>` over an explicit column list break when one lands. - **Run `awa storage rebuild-terminal-counters` from an upgraded binary.** An older binary can deadlock with an upgraded runtime's rotation tick. - **v052 adds job output columns** (ADR-048). It adds two nullable columns per queue-storage schema, a `NOT VALID` check and a final `output` column on `terminal_jobs`, without replaying the installer or scanning rows. It takes brief `ACCESS EXCLUSIVE` locks on the terminal tables, held until the migration transaction commits, and waits at most 2 s for each when no `lock_timeout` is set. A released 0.6.9 worker keeps completing, reading, listing and retrying jobs on the migrated schema alongside a 0.7 worker (rehearsed migrate-first in `test_migrate_first_mixed_fleet_job_output`). A binary that has ADR-048 but runs against a schema without the columns drops completion outputs and counts them as `schema_missing`; this is tested against a schema with the columns renamed away (`a_schema_without_output_columns_drops_completion_outputs`), not with a released binary. - **Queue-storage failure transitions take `impl Into`.** The `error` argument of `fail_retryable*`, `fail_terminal*` and `fail_to_dlq*`, and the `reason` of `cancel_running*`, accept `&str` and `String` as before. Code that passes a function pointer or names the type may need a cast. - **`callback_contract::CompletePayload` is `#[non_exhaustive]`** and gains `output`. Senders that built it with a struct literal start from `CompletePayload::default()` and set fields. - **`JobKindDescriptor` gains a public `output` field.** Code that builds it with a struct literal adds `output: None` or starts from `JobKindDescriptor::new()`. - **`#[derive(JobArgs)]` rejects unknown `#[awa(...)]` keys.** It accepts `kind` and `output`; any other key, or a malformed value, is now a compile error rather than silently ignored. - **`awa-testing`'s `WorkResult::Completed` holds the row read back after completion** (state `Completed`, `finalized_at` and `output` set), not the claimed row. - **Rust library users: `on_*_enqueue_with` closures return `Option>`.** Wrap an existing closure's result in `Some(...)`; the turbofish (`::`) is unchanged. Returning `None` enqueues nothing for that trigger ([ADR-029 amendment](docs/adr/029-transactional-followup-jobs.md#amendment-conditional-registered-follow-ups)). - **Ring maintenance outcome fields.** `RotateOutcome::SkippedIdle` gains `generation`; `PruneOutcome::Pruned` gains `generation` and `durations: PruneDurations`. Exhaustive matches and direct construction of these public Rust enum variants must bind or ignore the new fields. - **0.7 migrate gate ([#370](https://github.com/hardbyte/awa/issues/370), [ADR-037](docs/adr/037-canonical-engine-deprecation.md)).** `awa migrate` (and `awa_model::migrations::run`) now refuses to apply pending migrations unless the storage transition is finalized (`state = active`) or the install is fresh (no jobs, no recently-live runtimes — the same conditions as worker-startup auto-finalize). Nothing is applied on refusal; the error names the finalize steps. Complete the staged transition on 0.6 binaries first: see [`docs/upgrade-0.6-to-0.7.md`](docs/upgrade-0.6-to-0.7.md). - **Canonical engine deprecated.** Runtimes whose effective storage resolves to the canonical engine log a startup deprecation warning; canonical claim/execution/trigger paths will be removed in 0.8. - **Ring-rotation ledger — staged rolling upgrade ([#371](https://github.com/hardbyte/awa/issues/371), [ADR-040](docs/adr/040-append-only-ring-rotation-ledger.md), migration v043).** The queue/lease/claim ring cursors move out of the mutable `{ring}_ring_state` singletons into append-only `{ring}_ring_rotations` ledgers (dead-tuple-free rotation under a pinned MVCC horizon). The supported upgrade path is a mixed 0.6.2/0.7 fleet after the mandatory 0.6.2 stepping-stone (the first 0.6 build that fails closed on unknown newer schemas and recognizes v043 only in compat authority; 0.6.0/0.6.1 must not migrate a v043 database). **Expand:** migration v043 is *additive* — it creates and seeds the ledgers and the rollup-delta table and **keeps** the compat `current_slot` / `generation` columns; a new per-schema `ring_cursor_authority` row selects the authoritative representation (`columns` on upgrade, `ledger` on fresh install). In compat mode a 0.7 rotator serializes with any live 0.6.2 rotator on the same `{ring}_ring_state` row lock, CASes the columns, and shadows the ledger. **Flip:** once the whole fleet is on 0.7, promote to ledger authority one-way with `awa storage flip-ring-authority` (or the maintenance leader's auto-flip once every fresh runtime reports a 0.7+ `binary_version`, an additive `awa.runtime_instances` column, continuously for a stable period). Under the cursor locks the flip reconciles and verifies every ledger, poisons the stale cursor/prune metadata, and database-enforces rejection of old-style cursor advances; roll binaries back only *before* the flip. **Contract:** dropping the compat columns is deferred to 0.8. After the 0.6.2 patch step, upgrade 0.7 in either order (roll binaries then migrate, or migrate then roll). See [`docs/upgrade-0.6-to-0.7.md`](docs/upgrade-0.6-to-0.7.md). ### Added - **Job output ([ADR-048](docs/adr/048-retained-job-output.md), [guide](docs/job-output.md)).** A handler can record a JSON output of up to 4 KiB with `ctx.set_output` (`ctx.output_slot()` for `register` closures) or `job.set_output` in Python. It is published by the attempt's own transition: as `JobRow.output` when the job completes, or under `output` in the error entry of a failure, where only the latest entry to record one keeps it. It rides the compact completion batch, is shown on the admin UI's job detail and in `terminal_jobs.output`, and is never read by the engine; enqueue specs and the dispatch row do not see it. A failed recording (`OutputError`, Python `awa.OutputError`) clears the output without failing the attempt. External completions store one only when given: `Client::complete_external_with` with `ExternalCompletion`, Python `complete_external(..., output=...)`, or the HTTP callback body's `output` field. Canonical storage discards outputs. New metrics: `awa.job.output_recorded`, `awa.job.output_size` and `awa.job.output_dropped`, whose `too_large` and `invalid` reasons count rejected recordings a handler ignored. The Grafana dashboard gains output panels, and the alert rules an `awa_job_output_schema_missing` warning for a binary running ahead of migration v052. - **Typed job outputs.** `#[awa(output = T)]` declares the output type of a kind. It implements the new `JobOutput` trait, and with it `ctx.typed_output::()`, `JobRow::output_as` / `error_output_as` and `ExternalCompletion::output_for` give typed access to the JSON output. Python's `@client.task(..., output=T)` checks `set_output` values, and `Job.output_as` / `error_output_as` decode them. The type name, with a JSON Schema when the runtime has one, is published in the new `awa.job_kind_descriptors.output` column and shown on the admin UI's kinds and job detail pages. - **Conditional registered follow-ups.** An `on_*_enqueue_with` closure can return `None` to enqueue nothing for a trigger while its transition still commits. This covers completions with no handler, such as `complete_external` and `resolve_callback`, where a handler-staged follow-up cannot be used. - **Handler-staged follow-up jobs ([ADR-046](docs/adr/046-handler-staged-follow-ups.md)).** A handler can stage follow-up jobs built from values it computed: `ctx.enqueue_on_completion(request)`, `ctx.follow_ups()` for `register` closures, and `job.enqueue_on_completion(args, **insert_opts)` in Python. They are inserted in the same transaction as the attempt's completion, deduplicated by their own unique keys, and discarded on every other outcome. A failed stage (`StageError`, Python `awa.StagingError`) fails an attempt that still returns `Completed`. Limits are 16 follow-ups and 64 KiB per attempt. Staging is a new reason for an otherwise batchable job to leave the batched completion path; jobs with registered `Completed` specs already complete in their own transaction. New `EnqueueRequest::unique` and `::metadata` set one option without replacing the rest, `awa_model::insert_prepared` inserts a prepared row, and the `awa.job.staged_follow_ups_discarded` counter records follow-ups dropped by `WaitForCallback`. `awa.job.staged_follow_ups_committed` counts the follow-ups of committed completions, `inserted` or `duplicate`, and the Grafana dashboard and alert rules gain a panel and an info alert for them. The Rust and Python test harnesses insert staged follow-ups like the runtime. - **Owner-scoped periodic schedules (opt-in, v045, [#481](https://github.com/hardbyte/awa/issues/481)).** A client can declare the complete set of periodic schedules it owns. awa then adds, updates and retires that owner's schedules to match, instead of only adding them. Retired schedules stop enqueuing and can be brought back with `restore-owner`, and ownership can be adopted or transferred explicitly. The CLI, API and UI show dry-run plans and status. Without opting in, schedule sync stays additive. Released 0.6.7 binaries do not enqueue retired schedules, but managing owned schedules needs current clients. During a rollout with differing declarations, the last agreed definitions stay in force. - **`awa storage enter-mixed-transition --quiesced` ([#457](https://github.com/hardbyte/awa/issues/457))** enters the mixed storage transition for a fully stopped fleet. It refuses if any runtime has reported recently, checks the whole target schema first, and keeps the usual backlog and finalize gates. - **OpenTelemetry `messaging.destination.name` ([#454](https://github.com/hardbyte/awa/issues/454)).** Spans and log events that name a queue carry it alongside the existing `queue` field, so one query matches both. - **Counters for finalization retries.** `awa.completion.reconnect_retry` counts retries after the database became unavailable, and `awa.completion.deadlock_retry` counts finalize transactions re-run after a deadlock. - **`awa migrate --sql --no-transaction`** renders SQL without the transaction wrapper, for runners that open their own transaction per migration (Flyway, Liquibase, dbmate). `migrations::MIGRATION_LOCK_KEY` and Python `awa.migration_lock_key()` expose the runner's advisory lock key. - Python prints a diagnostic to stderr if native shutdown has stalled for five seconds. - **`QueueStorage::rescue_stale_heartbeats_with_dlq`, `rescue_expired_deadlines_with_dlq` and `rescue_expired_callbacks_with_dlq`** take a per-queue predicate and dead-letter exhausted attempts in the rescue transaction. The existing methods keep their behaviour and fail exhausted attempts into `done_entries`. - **Release gate: the mixed-version rehearsal now gates publishing ([#427](https://github.com/hardbyte/awa/issues/427), [#383](https://github.com/hardbyte/awa/issues/383)).** A reusable `release-gate.yml` workflow runs the released-N-1 rolling-upgrade rehearsal and the pinned-artifact compat matrix: dispatch it manually against a candidate ref as the required pre-tag check, and `release.yml` now also invokes it on the tagged commit with every publishing job (crates.io, PyPI, Docker, GitHub Release) gated behind it — a tag created without the pre-check cannot ship artifacts. Each rehearsal cell emits a machine-readable JSON report (phase transitions with elapsed-ms watermarks, census counts, flip status, exact reconciliation) uploaded as a 90-day workflow artifact on success and failure; the nightly rehearsal delegates to the same workflow so the two cannot drift. - **UI instance identity ([#437](https://github.com/hardbyte/awa/issues/437)).** The UI stays single-backend by design (one `awa serve` per database — the 0.7 roadmap non-goal stands), but it can now say *which* backend it is: `awa serve --instance-name` / `AWA_INSTANCE_NAME` (plus optional `--instance-color` / `AWA_INSTANCE_COLOR` and repeatable `--peer NAME=URL` links) surface via `/api/capabilities` and render as a header badge, the browser tab title, and a tinted favicon, with peers as plain links — a zero-data-plane "switcher" between per-database instances. No multiple pools, no backend switcher, no per-request backend selection. - **CLI named contexts ([#437](https://github.com/hardbyte/awa/issues/437)).** `~/.config/awa/config.toml` defines kubectl-style contexts (`url` or `url_env` indirection, `production = true`), resolved as `--database-url` > `--context`/`AWA_CONTEXT` > `DATABASE_URL` env > `default_context` — deliberately with **no sticky current-context for mutations**: once more than one context is defined, mutating commands (migrate apply, storage transitions/flips, dlq retry/purge/move, queue drain/pause, batch-ops submit, cron remove, and every other write) require an explicit `--context` or `--database-url`, while read-only commands may still fall back. Every command echoes its password-stripped target to stderr before acting; `production = true` gates mutations behind an interactive y/N (`--yes` for automation); a plaintext-password `url` in a group/other-readable config file warns. New `awa context list|show` inspect the config. With no config file, behaviour is unchanged. - **End-to-end distributed tracing ([#110](https://github.com/hardbyte/awa/issues/110), [ADR-039](docs/adr/039-trace-propagation.md)).** Enqueues inside an OpenTelemetry span capture the W3C `traceparent` into the reserved `awa:traceparent` metadata key (no migration; both engines; SQL and Python producers participate by setting the key). The worker's `job.execute` span continues that trace: first attempts join it as a remote child, retries start a fresh root trace with a span **link** back to the enqueue site (OTel messaging guidance for deferred processing). Producer and consumer spans carry messaging semantic conventions (`messaging.system = "awa"`, producer/consumer kinds, `send {queue}` naming). Default-on — measured at ~0.2µs per enqueue (E8 gate) — with `AWA_TRACE_CAPTURE=off` as a kill switch; handlers forward the context via `ctx.traceparent()` (Rust) / `job.traceparent` (Python). Metadata keys prefixed `awa:` are now a documented reserved namespace in the stability policy. - **Python automatic tracing ([#110](https://github.com/hardbyte/awa/issues/110) follow-up, [ADR-039](docs/adr/039-trace-propagation.md)).** When `opentelemetry-api` is importable (optional — `awa-pg[otel]` is a convenience alias), Python producers capture the current span into `awa:traceparent` automatically (client insert methods and `awa.bridge`; an explicit key wins; `AWA_TRACE_CAPTURE=off` disables) and workers attach the job's trace context as the ambient OpenTelemetry context around handler invocation, so instrumented libraries (httpx, requests, SQLAlchemy, …) nest into the job's trace with no user code. `awa.init_telemetry(...)` now also installs an OTLP **trace** pipeline for the Rust runtime's spans (`traces=False` opts out), letting Python handler spans nest under `job.execute`. Without `opentelemetry` installed, everything degrades to a cached no-op. - **Public-surface stability policy accepted ([#369](https://github.com/hardbyte/awa/issues/369), [ADR-036](docs/adr/036-public-surface-stability-policy.md)).** [`docs/stability.md`](docs/stability.md) is now normative: the surface-by-surface compatibility map, pre-1.0 release-type rules, deprecation schedule, and the binary/schema skew statement (asserted nightly by the compat matrix). The HTTP-admin-API row promises documented response types rather than an `awa-api` crate — the split is deferred to 0.8 ([#143](https://github.com/hardbyte/awa/issues/143)) where the MCP server proposal is the first real second consumer; the 0.7 hygiene half (no `FromRow` types in handler returns) is [#403](https://github.com/hardbyte/awa/issues/403). - **Hot-reloadable per-queue runtime overrides ([#385](https://github.com/hardbyte/awa/issues/385)/[#396](https://github.com/hardbyte/awa/issues/396), [ADR-038](docs/adr/038-queue-runtime-overrides.md)).** `awa queue overrides set|clear|show` (and the matching `awa_model::admin` functions) change `poll_interval`, `claim_batch_size`, `rate_limit`, and `deadline_duration` on a running fleet: dispatchers refresh nullable override columns on `queue_meta` (migration **v041** — the first 0.7-line migration, so the ADR-037 migrate gate is now live for unfinalized clusters) on a slow cadence and apply them without restarts; NULL reverts to the builder value. Guard rails: rate-limit overrides only retune an existing limiter, and deadline overrides cannot cross the zero boundary (claim mode is fixed at startup). Live concurrency and correctness-coupled cadences are Tier 2 ([#397](https://github.com/hardbyte/awa/issues/397)). - **Worker health & readiness endpoints ([#368](https://github.com/hardbyte/awa/issues/368)).** Opt-in HTTP listener in the worker runtime (`AWA_HEALTH_ADDR` or `ClientBuilder::health_addr`): `GET /healthz` (process liveness, stays `200` through graceful drain) and `GET /readyz` (`503` + JSON reasons when Postgres is unreachable, the schema is older than the binary, a claim loop stalls, heartbeat/maintenance die, or shutdown starts). No new dependencies in `awa-worker`. Kubernetes probe examples in `docs/deployment.md`. - **`awa health` CLI probe.** Cluster-level readiness from the database alone (reachable, schema migrated for this binary, storage state, fleet heartbeat counts) with `--json` output and exit codes for probe-less environments. - **Migrate progress output.** `awa migrate` now prints a plan line before applying (`Applying pending migrations v41..v43 (3 migrations)`) and a per-migration completion line with elapsed (`Migration v42 applied in 7752ms`), emitted as `tracing` `info!` events. Some migrations reinstall the queue-storage substrate and take several seconds each with no intermediate output; the timing lines distinguish steady progress from a hang. ### Changed - **Heartbeats tick on a fixed grid.** Ticks no longer drift by each pass's duration. A pass that outlasts the interval logs a warning with its duration and is followed by a full interval of rest. - Heartbeats no longer scan or lock every open claim batch. Each tick looks up only the attempts the worker is running, so its cost follows in-flight work rather than open claims, and failures, retries and slow completions no longer wait for a heartbeat tick to release their claim batch. - v051 moves the claim query into one function per queue-ring slot, so PostgreSQL keeps a cached plan across ring rotations instead of re-planning most claims. Like other installer-replay migrations it holds table locks until commit: apply it in a quiet window with a bounded `lock_timeout` (see the 0.6 to 0.7 upgrade guide). Binaries before v051 run unchanged on the migrated schema. - **Claims commit asynchronously.** Claims and claim-cursor advances run with `synchronous_commit = off`, so a lane's claim head is no longer held across a WAL flush. At 400 jobs/s on a disk with ~7 ms fsync, claim p99 fell from ~9.8 s, with a growing backlog, to 67 ms. A claim lost in a server crash leaves the job claimable again, which at-least-once delivery already allows. Enqueues and completions still commit synchronously. - **Fewer round trips per claim.** A claim reuses the instance's claimer lease for up to 250 ms instead of re-reading it, which at four workers cut transactions per completed job from 2.35 to 1.39. - **One LISTEN connection per runtime, and idle queues poll less.** Queue dispatchers share one listener and a runtime-wide limit on concurrent claims. When notifications are available, an empty queue backs off from `poll_interval` to at most 2 s; poll-only runtimes keep `poll_interval`. Shutdown no longer waits behind a saturated claim limit, and dispatcher exit and worker drain share one timeout. - **Enqueue sends one `unnest` INSERT per batch.** The COPY entry points (`QueueStorage::enqueue_params_copy`, `insert_many_copy` and the Python `*_copy` methods) use it for batches under 2,048 rows, which is faster at that size and avoids a ~40 ms stall per COPY under sqlx 0.9.0, which does not set `TCP_NODELAY`. Larger batches still use COPY. The 0.7 release waits on a sqlx release with transact-rs/sqlx#4336 ([#505](https://github.com/hardbyte/awa/issues/505)). - **Each enqueued job writes one fewer index entry (v050).** v050 drops the `lane_shard` index from every `ready_entries` partition, in the `awa` schema and each custom schema the migration upgrades; lanes are looked up through the partition's primary key instead. Each ring rotation also initialises one fewer index. The migration rewrites no rows (27 ms on a test database with 409,600 ready rows), but holds an exclusive lock on each `ready_entries` partition until it commits, so enqueues and claims wait meanwhile. If the session sets no `lock_timeout`, each lock wait is capped at 2 s; on a timeout (`55P03`, usually behind a long `awa.jobs` read or a backup) the migration rolls back and can be re-run. - **Retry-heavy workloads leave far fewer dead tuples.** After the ring authority flip, awa keeps one terminal-count row per lane in `queue_terminal_live_counts` instead of up to 256, and a batch of finished jobs appends one count-delta row per lane instead of up to 256. Pruning a queue deletes one live-count row per lane: in a 200 jobs/s retry storm, peak dead tuples in that table fell from 2,517 to 19. Before the flip the existing layout is kept, so counts stay exact in a mixed 0.6/0.7 fleet and after a rollback. - **Ring rotation waits for a slot to fill before sealing it ([#518](https://github.com/hardbyte/awa/issues/518)).** A non-empty slot is sealed once it has been filling for five seconds and holds 256 rows, once it reaches about 2 MiB, or once it is 60 seconds old. A trickle of writes previously paid a full rotation and prune every five seconds for a handful of rows. Empty slots still advance immediately to reclaim sealed history. Tune it with `ClientBuilder::ring_rotation_cadence`, starting from `RingRotationCadence::DEFAULT` and adjusting with `with_min_slot_age`, `with_target_slot_bytes`, `with_min_slot_rows` and `with_max_slot_age`, or with the `queue_storage_rotate_*` Python options. A row floor needs a size target or an age ceiling. `RingRotationCadence::EAGER` seals on every tick. The size target is sampled and is not a storage limit. - **Idle ring maintenance no longer writes.** After the ring authority flip, a rotation or prune tick with nothing to do no longer locks the `{ring}_ring_state` row, so it runs as a read-only transaction. `QueueStorage::reset` and `awa storage rebuild-terminal-counters` now wait for in-progress rotation before taking their table locks. - **Jobs in one claim batch no longer contend when they fail, retry, snooze or move to the DLQ.** Each validates its own receipt under its own attempt lock instead of locking the shared batch row. - **Compact deadline receipt claims ([#246](https://github.com/hardbyte/awa/issues/246), [ADR-023](docs/adr/023-receipt-plane-ring-partitioning.md), [#410](https://github.com/hardbyte/awa/pull/410)).** Deadline-backed receipt claims (the default when a queue sets `deadline_duration > 0`) now write the same compact `lease_claim_batches` row as zero-deadline claims — every job claimed in one `claim_ready_runtime` call shares one `claimed_at`, hence one `deadline_at` — instead of one row-local `lease_claims` row per job. At 256-worker saturation this removes ~83k steady-state live `lease_claims` rows and the associated end-to-end p99 regression. Migration **v042** refreshes every installed queue-storage schema with the compact claim function, a per-slot batch deadline-rescue cursor on `claim_ring_slots`, and a partial `(deadline_at, batch_id) WHERE deadline_at IS NOT NULL` sweep index per `lease_claim_batches` child. Additive only: row-local `lease_claims` and its deadline cursor are retained for claims that materialize into mutable leases and for legacy in-flight claims written before the upgrade. - **Idle rings stop rotating ([#371](https://github.com/hardbyte/awa/issues/371), [#409](https://github.com/hardbyte/awa/pull/409)).** Ring rotation was purely timer-driven: every maintenance tick UPDATEd the `queue_ring_state` / `lease_ring_state` / `claim_ring_state` singleton (and a `queue_ring_slots` row) even when the ring had received no writes, so under a pinned MVCC horizon each tick left an unreclaimable dead tuple (~14.4k/hour on `lease_ring_state` at the historical 250ms cadence). Rotation now probes whether the current slot's child tables are empty (a cheap indexed `EXISTS`, no stronger locks than the existing busy check) and, if so, returns a new `SkippedIdle` outcome without touching any row. A quiet queue therefore freezes `current_slot`/`generation` entirely instead of churning bookkeeping rows; the first write un-idles the ring and rotation resumes on the next tick. The skip is benign under concurrency — an enqueue that lands just after the probe is sealed one tick later, never lost. Observability: the maintenance rotate counter gains a `skipped_idle` outcome so dashboards can distinguish a healthy quiet ring (flat generation + `skipped_idle`) from a pinned ring (`skipped_busy` with rows accumulating). This is PR A of the #371 work; the structural ledger rework is a later PR. - **Ring cursors move to append-only rotation ledgers ([#371](https://github.com/hardbyte/awa/issues/371), [ADR-040](docs/adr/040-append-only-ring-rotation-ledger.md), migration v043, [#415](https://github.com/hardbyte/awa/pull/415) — see Upgrading).** PR B completes the #371 work: where PR A stopped the *idle* rotation write, this removes the *busy*-path write too. Each ring cursor is now the max-generation row of an append-only `{ring}_ring_rotations` ledger (backward primary-key scan, O(1)); rotation **appends** a row (a compare-and-swap on the generation PK) instead of UPDATEing the ring-state singleton, so a busy ring under a pinned MVCC horizon no longer strands a dead bookkeeping tuple per tick. In ledger authority, rotate/prune/delta-rollup serialize on a per-ring `pg_advisory_xact_lock` (try-locked; a periodic rotate skips under contention rather than queueing behind a prune); in compat authority they serialize on the `{ring}_ring_state` singleton `FOR UPDATE` (see the ring-rotation ledger entry under Upgrading). Either way the ring-state singleton `FOR UPDATE` is taken first as the universal gate against the flip. Queue prune stops upserting `queue_terminal_rollups` inside the prune transaction — it appends to a new `queue_terminal_rollup_deltas` landing table folded by horizon-gated maintenance on the existing 30s tick (which also trims each ledger to one wrap); exact count readers add the unfolded delta sums, so counts stay exact regardless of fold timing. A new receipt-plane regression assertion pins the whole `{ring}_ring_state` family write-free (zero UPDATE/DELETE, zero dead tuples) under load **in ledger authority** — the steady state after the flip; compat authority retains the pre-#371 singleton churn until the fleet flips (see Upgrading). ### Fixed - **JSON floats read back from Postgres exactly.** Postgres prints `jsonb` numbers in plain decimal, and serde_json's default parser could round a long one to the neighbouring `f64`, so a value like `5.130112436774387e-96` in job args read back one unit in the last place off. serde_json's `float_roundtrip` feature is now enabled. - **A duplicate follow-up no longer fails its trigger.** A follow-up enqueued with unique options that conflicted with an existing job aborted the trigger's transaction: the trigger's completion (or other outcome) rolled back, every retry hit the same conflict, and the trigger failed once its attempts ran out. The conflict is now skipped under a savepoint, so the trigger commits and the existing follow-up stands. Deduplicating downstream work across several triggers now works as unique options imply. - **Poison jobs no longer cycle forever.** A job whose worker crashed or hung on every attempt was rescued back to `retryable` indefinitely: stale-heartbeat and deadline rescue never checked `max_attempts`, so `attempt` climbed past it. Those rescues now fail the job once its attempts are spent, as callback timeouts already did, and dead-letter it with reason `heartbeat_stale` or `deadline_exceeded` on DLQ-enabled queues. On queue storage the DLQ row is written in the rescue transaction for all three rescue reasons, including `callback_timeout`; an exhausted callback timeout used to be moved in a second transaction, so an error between the two left it `failed` outside the DLQ. A job with `max_attempts = 1` that loses its worker therefore fails instead of running again. Rescue runs on the maintenance leader, so the new behaviour applies once the leader runs this release. - **A hung handler no longer holds its worker slot forever.** Rescue only signalled cancellation, so a handler awaiting something that never resolved kept its permit: the rescued retry could not be claimed, and a one-worker queue stopped. A handler still running two `deadline_rescue_interval`s past its deadline is now dropped at its next `.await`. Blocking code that never yields still keeps its slot. - **A panicking Rust handler is a failed attempt.** A panic used to escape the job task: the job stayed registered in flight, kept heartbeating until its deadline rescued it (5 minutes by default), and its message was lost. The executor now catches the panic and records `handler panicked: ` as a retryable failure. - **A zero `heartbeat_interval` is rejected when the client is built** (Python: `ValueError`). Previously the heartbeat task reported itself alive and then panicked. - **A running job could be both finished and retried.** If a job completed, failed or was retried while stale-heartbeat or deadline rescue was examining it, rescue could miss that outcome and also send the job back for a retry, so it ran again. Cancelling a running job could race a finishing worker the same way. Rescue now sees every outcome that commits first. Cancel never waits on a lock held by a finishing worker, because waiting could deadlock with it. Instead it retries for up to five seconds. If the job is still being finished after that, cancel leaves it alone and logs it: `cancel` returns `JobNotFound` and `bulk_cancel` leaves it out of its result, so retry if you need it cancelled. A bulk cancel holds a lock for each running job until it commits, so cancel very large sets of running jobs in batches. - **Finished jobs survive a database outage without re-running.** A handler's result is kept and finalization retried for up to 120 s while the database is unavailable, instead of leaving the job for heartbeat rescue to run again. Pending finalizations are bounded and drain at shutdown, and a newer attempt's lease fences a stale retry. A lost acknowledgement is reported as an unknown outcome rather than a rescue. - **A finalize transaction chosen as a deadlock victim is re-run** (up to three times) instead of leaving the job to heartbeat rescue. - **Job transitions no longer wait on, or deadlock through, the admin dirty-key triggers (v046, [#492](https://github.com/hardbyte/awa/issues/492)).** The triggers now append rows that never wait on another transaction. - **awa keeps working when its schema is in a logical-replication publication (v047).** With `FOR ALL TABLES` (Debezium's default) or `FOR TABLES IN SCHEMA awa`, PostgreSQL rejected updates and deletes on awa tables without a primary key, so maintenance failed every tick. v047 gives every awa table a replica identity, without extra WAL on the hot insert and truncate paths. Keeping awa out of CDC publications is still recommended; see [Logical replication and CDC](docs/deploying-on-managed-postgres.md#logical-replication-and-cdc). - **A lane no longer falls behind when a claimer stops mid-claim (v048).** If a claimer stopped between committing a claim and advancing the lane's cursor, the next claim now catches the cursor up, and a permanent gap in a lane's sequence no longer stalls it behind tombstones. After a failover, a retried cursor advance can no longer skip a claim the old primary lost. - **`awa.jobs` counts running receipt claims and is fast under backlog (v044, [#422](https://github.com/hardbyte/awa/issues/422)).** It reported `running = 0` while workers held receipt claims, and scanned every ready partition with a catalog lookup per row (about 90 ms to 6 ms for that part on a 20,000-row backlog). Released 0.6.x workers keep working against v044. - **Queue pruning no longer deadlocks with claims.** It takes child-partition locks without waiting and, on contention, retries on the next maintenance tick. - **Partitions emptied by VACUUM give back their index and TOAST storage.** Rotation and prune judged a partition idle from its heap alone, so a lease partition that VACUUM had emptied kept its index and TOAST storage indefinitely (608 KiB against 16 KiB after a TRUNCATE in one test). They now count all of a partition's storage, ignoring only the fixed size of empty indexes, including on PostgreSQL builds with blocks smaller than 4 KiB. - **Snoozing and retrying jobs no longer stall the storage transition ([#456](https://github.com/hardbyte/awa/issues/456)).** During the mixed transition, a canonical job that snoozes or retries continues in queue storage instead of re-entering the canonical backlog, so `awa storage finalize --wait` can finish. Deferred jobs are promoted, and stuck running jobs rescued, on both storage planes whichever runtime leads maintenance. - **Callback resolution works for canonical jobs during an unfinalized storage transition ([#462](https://github.com/hardbyte/awa/issues/462)),** with lease fencing and transaction rollback preserved. - **The ring-authority flip retries a deadlock with live traffic ([#480](https://github.com/hardbyte/awa/pull/480))** instead of returning `40P01`. Refusals and other errors still return immediately. - **Worker traces no longer grow for the worker's lifetime ([#449](https://github.com/hardbyte/awa/issues/449)).** Each dispatcher poll and heartbeat tick is its own `debug` root span (`receive {queue}`, `heartbeat.tick`), so traces stay under backend size limits. An `info` pipeline records neither. Falling back to polling, as under a transaction-mode pooler, logs a warning naming the queue. See [worker-side traces](docs/configuration.md#worker-side-traces). - **Migration CLI fixes.** - `awa migrate --sql` output is one transaction that takes the runner's advisory lock, so a failure part-way no longer leaves a half-migrated schema. Python's `python -m awa migrate --sql` renders the same wrapper. - `awa migrate --extract-to` wrote only the first 15 migrations, because a `/` in v017's description made an invalid path. Every migration is now extracted, and previously published file names are unchanged. - `awa migrate` refuses `--from`, `--to` and `--version` when applying, instead of silently migrating to the latest version; they only select a range to render. - v001 can be re-applied like every other migration. - **Python fixes.** - Closing a client could leave a completion callback holding Python objects, causing an intermittent SIGSEGV at exit on CPython 3.12. Pending async operations are now cancelled and drained before the interpreter finalizes; still shut down workers and close clients explicitly. - A `Transaction` or `SyncTransaction` dropped without commit or rollback rolls back instead of panicking ("this functionality requires a Tokio context"), including at interpreter exit. - A rejected install, start or shutdown call leaves the client's lifecycle state unchanged. - A `RetryAfter` result on the final attempt counts as a failure in metrics, not a retry. - Rust cadence and claim-rotation interval overrides survive later `queue_storage` builder calls, whatever the call order. - **Admin views undercounted running jobs behind compact deadline claims ([#416](https://github.com/hardbyte/awa/issues/416), part of [#410](https://github.com/hardbyte/awa/pull/410)).** Job listings and queue overviews only knew about materialized `lease_claims` rows; a compact deadline-backed claim batch has none until its members individually materialize, so those jobs briefly vanished from admin views while genuinely running. Both surfaces now fold in un-materialized receipt claims from `lease_claim_batches`, so a job shows as running from the moment it's claimed regardless of which claim representation carries it. - **Migration cancellation could strand a session-scoped advisory lock ([#408](https://github.com/hardbyte/awa/pull/408)).** `migrations::run` guarded the version check, migrate gate, and migration steps with a session-scoped `pg_advisory_lock` on a pooled connection, released manually. sqlx does not `DISCARD ALL` a connection on return to the pool, so a `run` future cancelled mid-migration (a Rust embedder wrapping it in `tokio::time::timeout`, for example) handed the connection back with the lock still held — every later `migrate` anywhere then blocked until that connection happened to close. Python callers were unaffected (`block_on` always runs to completion). Fixed by moving to a transaction-scoped `pg_advisory_xact_lock` wrapping the whole upgrade in one transaction: cancelling the future rolls back and frees the lock immediately, and a failed or cancelled run leaves no half-applied step (every migration is transaction-safe). New coverage races concurrent `run()`s to convergence and reproduces cancellation non-stranding against the old lock (fails) and the fix (passes). - **Migration's admin-metadata warmup could leak a pool connection and deadlock the client ([#408](https://github.com/hardbyte/awa/pull/408) follow-up).** The best-effort `warm_admin_metadata_cache` step at the end of `migrations::run` used a pooled connection; the Python bridge drives migration on a throwaway `current_thread` runtime that's dropped the instant `block_on` returns, so the warmup connection's return-to-pool could race — and lose to — that runtime teardown, stranding the connection and leaking its pool semaphore permit. With a small `max_connections`, one leaked permit eventually deadlocked every later `acquire`: `migrate()` reported success but the first subsequent `transaction()` or worker `start()` hung until the 30s `acquire_timeout` fired. Fixed by running the warmup on a detached connection (`pool.acquire().detach()`) with an explicit `close().await`, so there is no return-to-pool step to race and nothing to strand. - **`migrate` fails safe on a schema newer than the binary ([#392](https://github.com/hardbyte/awa/issues/392)).** `awa_model::migrations::current_version`'s legacy-numbering heuristic previously matched a schema *newer* than the running binary — the supported rolling-deploy skew — and **destructively rewrote `awa.schema_version`** (deleted the version history, re-applied old migrations onto the newer physical layout, then crashed mid-way, leaving split-brain metadata). The migrate path (`awa migrate`, the CLI `--pending` probe, and the library `run`/`run_with_options` used by embedded/Python startup) now refuses a schema whose recorded `MAX(version)` exceeds this binary's `CURRENT_VERSION` with a clear `SchemaNewerThanBinary` error (*"schema is at vN but this binary supports up to vM — upgrade the awa binaries …; refusing to modify a newer schema"*) and writes nothing; the legacy heuristic is bounded so it never normalizes a version above `CURRENT_VERSION`. This protects forward skews (a 0.7 binary against a future 0.8 schema); it cannot retroactively fix binaries built before this release. - **Migration compatibility pre-flights.** Additive migrations can declare a minimum runtime version; v043 requires 0.6.2, the patch that understands its compat-authority schema. `awa migrate` refuses while a fresh-heartbeat runtime reports an older or unparseable version, and names the incompatible instances. `--allow-live-runtimes` (`MigrateOptions::allow_live_runtimes`) remains the explicit override. The stricter `EXCLUSIVE_WINDOW_MIGRATIONS` mechanism remains available only for migrations with no rolling-compatible shape; v043 no longer uses it. - **Worker startup on a pre-migration schema names the real fix.** A runtime started against a schema that predates its own migrations — the binary-first rolling-upgrade window — refuses to start (it completes no work), but previously did so with the misleading 0.5-era message *"run schema preparation before starting 0.6 runtimes"*. The readiness refusal now distinguishes an outdated schema version from missing queue-storage preparation and directs the operator to `awa migrate`. Under a rolling deployment the refused replicas crash-loop harmlessly and come up unaided once the migration commits; the nightly rolling-upgrade rehearsal pins the refusal message, the roll that recovers from it, and an overlapped roll racing a live migration. - **Maintenance branch cooldown is paced by the branch's own duration.** The per-branch overrun governor armed a fixed 120-tick cooldown and re-armed it on every subsequent overrun, so a maintenance branch whose body consistently exceeded 1.5× its configured interval collapsed to a 1/120 duty cycle — indefinitely, with a single warning at the first flip. With `deadline_rescue_interval = 100ms` and a ~250ms sweep (realistic containerized-Postgres latency), deadline rescue ran once per 12 seconds and deadline-based cancellation starved: a hanging handler polling `ctx.is_cancelled()` never heard back inside its window. At the default 30s interval, a >45s sweep would have silenced rescue for an hour at a stretch. The cooldown is now `2 × ceil(body_duration / interval)` ticks, capped at the previous 120: a merely-slow branch settles at roughly one-third duty cycle instead of going near-silent, and pathological bodies stay bounded. - **`JobResult::RetryAfter` now respects `max_attempts`.** RetryAfter is documented as "this attempt failed; try again after delay X", but the completion path never checked exhaustion — a handler that always returned `RetryAfter` looped forever (observed at attempt 653 with `max_attempts = 2`), invisible to the DLQ and appending nothing to `errors`. A retry requested on the final attempt (`attempt >= max_attempts`) now exhausts the job exactly like a retryable error: `failed` state, `dlq_reason = max_attempts_exhausted` when the DLQ is enabled, an `Exhausted` event, and `on_exhausted_enqueue` follow-ups. A job gets exactly `max_attempts` executions regardless of which failure primitive reports them. The canonical `RetryAfter` reschedule also now clears `heartbeat_at`/`deadline_at`, matching the retryable-error path. **If your `RetryAfter` loop meant "not yet" rather than "failed", return `Snooze`** — it reschedules without consuming the attempt budget. `TestClient` (Rust and Python) mirrors the bound. ### Security - **Migrations no longer run code another role planted in a queue-storage schema.** A role that could add objects or triggers to the `awa` schema or a custom queue-storage schema could get its code run by the migrator, even when the migrator is a superuser. Before upgrading a schema, `awa migrate` now checks that its objects belong to the migrating role or the `awa` schema owner, that no other role can create objects or triggers in it, and that every trigger is one awa installs, unchanged. A custom schema awa has not registered that fails the check is skipped with a warning. Any other schema that fails stops the migration before anything is applied, with an error naming the offending objects. No new schema version; see Upgrading and the upgrade guide for fixes. - `awa serve --help` and `awa callbacks serve --help` no longer print the value of `AWA_CALLBACK_HMAC_SECRET`. ### Dependencies - **sea-orm 2.0.2 and sqlx 0.9 ([#443](https://github.com/hardbyte/awa/issues/443)).** `awa-seaorm` users get one sqlx version. See Upgrading for the `audited_sql` change. The upgrade drops 20 transitive crates, including `rsa`, which has no fix for RUSTSEC-2023-0071. - Frontend seroval 1.6.4. ### Project - CI runs the full Rust suite on PostgreSQL 17 and 18, and the Python suite on CPython 3.13 and 3.14. `pyproject.toml` lists each supported Python version. - Tests now enforce that every migration is transaction-safe, idempotent and recorded exactly once, and that a failed migration rolls back completely. - Nightly chaos and benchmark gates allow for shared-runner contention ([#399](https://github.com/hardbyte/awa/issues/399), [#434](https://github.com/hardbyte/awa/issues/434)), and the Python suite no longer exhausts the server's connection slots ([#420](https://github.com/hardbyte/awa/issues/420)). - `AwaStorageLockOrder.tla` and `AwaDeadTupleContract.tla` are updated for the ring-rotation ledger ([#371](https://github.com/hardbyte/awa/issues/371)): the per-ring rotation advisory lock is the ledger-mode serializer, a new `RollupTerminalDeltasPlan` models the terminal-delta rollup transaction, and the rotation ledgers plus the `queue_terminal_rollup_deltas` landing table are modeled as cold `RowVacuum` relations with horizon-gated fold transactions (`RingLedgerFoldTx`, `TerminalRollupDeltaFoldTx`). The **staged rolling upgrade** is also modeled: the compat-authority plans take the ring-state singleton `FOR UPDATE` (the pre-#415 discipline, restored so a 0.7 compat rotator serializes with live 0.6 rotators), a one-way `FlipAuthority` action promotes the authority under all three singletons, and a new `MixedFleet` invariant forbids advancing any ring under both disciplines at once. TLC caught a real authority-read TOCTOU (a rotator reading `columns`, the flip committing, then the rotator advancing under the stale mode); the fix is to take the singleton before reading the authority, in both the spec and the `acquire_ring_serializer_tx` implementation. The compat singleton churn is a documented, bounded transition-mode exemption in `AwaDeadTupleContract.tla`. The full TLC suite passes (`AwaStorageLockOrder` 480,721 distinct states, depth 39; `AwaDeadTupleContract` contract check — all "No error found"), plus the existing expected-counterexample witnesses (the deadlock-detector and old-striped-claim `NoDeadlock` witnesses still fire). - `AwaStorageTransition.tla` models the 0.7 migrate gate (`Migrate07OnlyOnQuiescedCanonical`), with an expected-counterexample config (`AwaStorageTransitionMigrate07Ungated.cfg`) witnessing why the gate is required; the transition model family runs in nightly CI via the TLC suite runner (`correctness/run-tlc-suite.sh`). - Compact deadline claims ([#246](https://github.com/hardbyte/awa/issues/246)) preserve the `AwaSegmentedStorage.tla` receipt-plane invariants (`NoLostClaim`, `PrunedClaimSegmentsAreEmpty`): the lifecycle model already abstracts row-local and compact claims as `claimOpen`/`claimClosed`, so a deadline-backed claim force-closed by batch deadline rescue is covered by the existing `RescueStaleReceipt` / `RescueToReady` transitions. The full TLC suite re-passed (`AwaSegmentedStorage`: 790,881 states, depth 24); `MAPPING.md` and the spec's claim-family comment record that both deadline modes are now compact. - **Trace pipeline validated end-to-end in CI.** The telemetry-validation job (grafana/otel-lgtm) now asserts spans, not just metrics: `test_trace_pipeline_reaches_tempo` exports over OTLP and verifies the ADR-039 topology in Tempo (producer → `send {queue}` → `job.execute` with consumer kind and messaging attributes; retries as fresh roots carrying a span link, found via TraceQL); `scripts/trace-e2e-python.py` proves the cross-language chain (Python producer span → Rust execution span → Python handler span as one trace); `scripts/validate-grafana.sh` guards the published Grafana assets against drift (every referenced `awa_*` identifier must exist in live Prometheus or `awa-metrics` source, both dashboards must import through the Grafana API, all Postgres-dashboard SQL must `EXPLAIN` against a migrated schema, and traces must be readable through Grafana's Tempo datasource). `scripts/telemetry-e2e-local.sh` runs the identical checks locally. - **Nightly binary/schema compat matrix ([#367](https://github.com/hardbyte/awa/issues/367)).** Pinned release artifacts (`awa-pg` 0.6.0 and 0.5.7 wheels from PyPI) run against the newest schema every night: the 0.6.0 leg asserts the full job lifecycle on a finalized cluster; the 0.5.7 leg asserts the documented asymmetry (producers route through the compat layer to the active engine, workers are inert); the backward-guard leg asserts the newest `awa migrate` refuses an old unfinalized schema with the exact finalize-steps message and a non-zero exit. The support statement lives in `docs/stability.md`. - **CI: the Rust tests job is sharded ([#335](https://github.com/hardbyte/awa/issues/335)).** One `cargo test --workspace` run took ~31 minutes, ~22 of them the migration replay binary alone. The job is now a six-way matrix: the migration suite partitioned per-test across four shards with `cargo-nextest` (safe because those tests already serialize through a Postgres advisory lock), the other slow binaries in a `heavy` shard, and everything else — including any new test file, automatically — in `rest`. Shard membership lives in `scripts/ci-test-shard.sh`; the lint job validates it so renames can't drop coverage, and the nextest profile flags any test slower than 60s as the standing worklist for shrinking real-time fixture windows. - **rustc 1.97 compatibility ([#411](https://github.com/hardbyte/awa/pull/411), [#414](https://github.com/hardbyte/awa/pull/414)).** GitHub's stable runners rolled 1.96.1 → 1.97.0; the awa-python async bridge needed a Send-inference-satisfying restructure around `spawn_blocking`, and awa-cli dropped redundant references in `println!` args to clear the new clippy lint. No behavior change. ## [0.6.3] — 2026-07-15 - **Migrations no longer require superuser ([#431](https://github.com/hardbyte/awa/pull/431)).** The queue-storage migrations (v024 onward) discovered substrate schemas by scanning every schema in `pg_namespace` and probing each with `to_regprocedure()` / `to_regclass()`, which raise `permission denied for schema pg_toast` (or any other schema the role lacks `USAGE` on) for a non-superuser — so on managed Postgres, where the migration role owns the `awa` schema but is deliberately not a superuser, provisioning failed at migration v024. Discovery now uses shared-catalog lookups (`pg_proc` / `pg_class`) gated on `has_schema_privilege()`, which never trigger per-schema permission checks. No behavioural change for superusers or single-schema installs; on shared databases, discovery is additionally restricted to substrates the role can actually access. A regression test now runs the full migration chain as a `NOSUPERUSER` owner role, so the scan idiom cannot creep back in. If you run migrations through your own external tooling, note that the historical migration files changed in place (semantically equivalent SQL); Awa's built-in migrator tracks applied versions by number and is unaffected. The same fix is on `main` for the 0.7 line (all 14 affected migrations, including v042/v043). ## [0.6.2] — 2026-07-12 - **Safe 0.7 rolling-upgrade stepping-stone ([#392](https://github.com/hardbyte/awa/issues/392)).** The 0.6 migrator now refuses unknown newer schemas before legacy-version normalization can rewrite `awa.schema_version`. It recognizes exactly the additive v043 schema while every installed ring cursor remains in `columns` authority, allowing a 0.6.2/0.7 mixed fleet during the expand phase; it refuses after the one-way ledger-authority flip. Upgrade every 0.6.0/0.6.1 runtime to 0.6.2 before applying 0.7 migrations. If migration runs first, roll 0.7 workers promptly: crash and heartbeat rescue remain available, but deadline-based rescue for jobs claimed on v043 resumes when a 0.7 runtime takes maintenance leadership. Awa's built-in migrator applies v041-v043 atomically, so other sessions see v040 or v043. An external runner that commits each version separately can expose v041/v042; a restarting 0.6.2 worker refuses those transient schemas and reconnects after v043 is committed. - **Queue-storage finalization no longer requires restarting drained workers.** Migration v040 narrows the finalization gate to live canonical-only runtimes. Pre-flip auto runtimes still report `canonical_drain_only`, but once `canonical_live_backlog()` is zero all supported writes already route to queue storage, so `awa storage finalize --wait` can complete immediately and those idle runtimes can roll normally afterward. ## [0.6.1] — 2026-07-07 Patch release: one canonical-engine bug fix, no migrations, no API changes. ### Fixed - **Rescue sweeps no longer wedge on a unique-key conflict ([#388](https://github.com/hardbyte/awa/issues/388)) — both engines.** A unique job whose `unique_states` mask excludes `running` holds no claim while executing, so a newer duplicate can legitimately be enqueued and take the claim; returning the older job to a claiming state then conflicts. On the **canonical** engine the batched rescue UPDATEs (`running -> retryable`, `waiting_external -> retryable`) tripped the `sync_job_unique_claims` trigger (`idx_awa_jobs_unique`) and the whole 500-row sweep aborted every maintenance tick. On the **queue-storage** engine the same shape hid one layer deeper: rescue re-inserts each rescued job as a `retryable` deferred row inside one batch transaction, and `sync_unique_claim` raised `UniqueConflict` — aborting the whole batch identically. Both engines now degrade per row: clean rows rescue as before; the conflicted row is **cancelled** with an error entry (`rescued as duplicate: unique claim held by a newer job`) — the claim holder wins — via a savepoint on queue storage (terminal counters stay exact) and a row-at-a-time retry on canonical. Fallback cancellations dispatch the normal `Cancelled` lifecycle event and are counted under `awa.rescue.kind = "_duplicate_cancelled"`. Modelled in `correctness/storage/AwaCanonicalUniqueRescue.tla` (per-row config passes the `Convergence` liveness property; the batch-only config is the retained production-wedge counterexample), with end-to-end regression tests on both engines. - **Admin UI no longer renders storage *capability* as the engine in use.** The per-instance badge previously showed `storage_capability` — which reads `queue_storage` for every capable worker even on a fully canonical cluster — and the sidebar cluster chip aggregated the same field. The runtime page now derives and shows the **effective engine** (from capability, transition role, and the authoritative transition state), noting capability only when it adds information, and the sidebar chip labels the cluster from `/api/storage` instead. Publishing the resolved engine in runtime snapshots (so the UI need not derive it) is tracked in [#391](https://github.com/hardbyte/awa/issues/391). ### Operator note If a cluster is currently wedged (repeating `Failed to rescue ... idx_awa_jobs_unique` logs), upgrading is sufficient — the next sweep resolves it. The mask itself is still worth revisiting: on the canonical engine, a `unique_states` mask that a runtime transition can *enter* from outside (e.g. including `retryable` but not `running`) always risks superseded-job cancellations; masks closed under retry/rescue/promotion (`{}` or the full non-terminal set) avoid the conflict entirely. See the new [troubleshooting entry](docs/troubleshooting.md#rescue-fails-with-idx_awa_jobs_unique). ## [0.6.0] — 2026-07-04 The 0.6 line makes the append-only **queue-storage engine** the default and the supported substrate for high-throughput, low-bloat operation on managed Postgres. The [#169](https://github.com/hardbyte/awa/issues/169) pinned-MVCC dead-tuple gate **passed** on `main`: after the rc line removed the last dominant hot-row update path (the `queue_claim_heads` ready-segment routing cache), a 60-minute idle-in-transaction soak holds bounded queue depth through the pinned hour and drains fully in recovery. See "Benchmark evidence" below for the caveats — awa is not immune to long readers, and this release does not claim otherwise. This entry frames the consolidated `0.5.x → 0.6.0` diff as one release; the dated `0.6.0-{alpha,beta,rc}` sections below remain the granular development log. Migrations v001–v039 apply via `awa migrate`; existing installs walk the staged transition (see "Upgrading from 0.5.x"). The SQL-only path for external migration tooling is documented in [`docs/migrations.md`](docs/migrations.md). ### What's new since 0.5.x **Storage and durability** - **Queue-storage engine, default-on** ([ADR-019](docs/adr/019-queue-storage-redesign.md)). Append-only `ready_entries`, `deferred_jobs`, `done_entries`, and `dlq_entries` paired with a partitioned receipt ring keep dead-tuple footprint bounded under sustained load. Replaces the row-mutating canonical engine for fresh installs. - **No remaining hot-row update paths on the claim/complete loop.** - Lane cursors moved from MVCC-updated rows to Postgres sequences ([#321](https://github.com/hardbyte/awa/pull/321), v027). - Completion, DLQ, retry, and discard no longer `DELETE FROM ready_entries`; they route through append-only ready segments plus a tombstone ledger ([#323](https://github.com/hardbyte/awa/pull/323), v028). - Terminal counts append signed rows to a delta ledger that the maintenance leader folds asynchronously ([#329](https://github.com/hardbyte/awa/pull/329), v030, [ADR-026](docs/adr/026-narrow-terminal-history.md)). - The per-claim `queue_claim_heads` routing-cache update — the last dominant dead-tuple accumulator under a pinned horizon — is gone; claim routes through the `ready_segments` control plane instead ([#355](https://github.com/hardbyte/awa/pull/355), v039). - Rollup mutation and segment truncation stand down while another backend pins the MVCC horizon, then catch up once it clears ([#333](https://github.com/hardbyte/awa/pull/333)). - **Compact receipt claim and completion batches** ([#352](https://github.com/hardbyte/awa/pull/352), v036–v038, [ADR-026](docs/adr/026-narrow-terminal-history.md)). Receipt-backed successful completions write compact terminal batches instead of one `done_entries` row per job, with compact claim-local closure, ready-segment, claim-attempt, and lease-claim evidence so stale scans stay bounded. `{schema}.terminal_jobs` is the public terminal read surface — direct SQL against `done_entries` must not assume all completed jobs are physically stored there. - **Failed-terminal retention floor** ([#337](https://github.com/hardbyte/awa/issues/337), v032, [ADR-032](docs/adr/032-failed-terminal-retention.md)). Non-DLQ `failed` terminal rows stay retryable for at least `failed_retention` (default `72h`); rows aged past the floor are folded into a cumulative, monotonic `QueueCounts.pruned_failed` so operators have standing visibility of loss that was previously silent. `retry_failed_by_kind` / `retry_failed_by_queue` report the matched/retried/pruned split rather than silently dropping ids. - **Receipt-plane ring partitioning** ([ADR-023](docs/adr/023-receipt-plane-ring-partitioning.md)). `lease_claims` and `lease_claim_closures` partitioned by claim slot, rotated by the maintenance leader, with bounded per-slot cursors so rescue/close/deadline sweeps cost work proportional to live receipts ([#349](https://github.com/hardbyte/awa/pull/349), v033–v035). - **Per-claim deadlines** in receipts mode. Set `QueueConfig.deadline_duration` to bound a single attempt; rescue force-closes expired claims with `'deadline_expired'`. - **Staged 0.5 → 0.6 transition tooling**: `awa storage prepare`, `prepare-queue-storage-schema`, `enter-mixed-transition`, `finalize` (with `--wait` / `--check`, [#298](https://github.com/hardbyte/awa/pull/298)), `abort`, plus a storage-transition readiness UI ([#299](https://github.com/hardbyte/awa/pull/299)). `awa migrate` owns the `awa.*` substrate DDL ([#308](https://github.com/hardbyte/awa/issues/308), v023) — it is no longer installed opportunistically, and `awa --reset --schema awa` is rejected. Fresh installs auto-finalize on first `awa migrate`. Full procedure in [`docs/upgrade-0.5-to-0.6.md`](docs/upgrade-0.5-to-0.6.md). **Operator surfaces** - **Dead Letter Queue** ([ADR-020](docs/adr/020-dead-letter-queue.md)). Per-queue `dlq_enabled` policy plus a full admin surface: `awa dlq depth | list | retry | retry-bulk | move | purge` (CLI), matching admin UI tab, Rust/Python client APIs. - **Durable batch operations** ([#328](https://github.com/hardbyte/awa/pull/328), v029, [ADR-030](docs/adr/030-batch-operations.md)). Crash-safe, maintenance-driven bulk `set_priority` and `move_queue` over job selections, with preview/submit/list/get/cancel/purge through the HTTP API, CLI, and admin-UI Batch Ops tab; Python parity via [#332](https://github.com/hardbyte/awa/pull/332). The first-class reprioritization surface ([#307](https://github.com/hardbyte/awa/issues/307)). - **Transaction-scoped admin cancel** ([#357](https://github.com/hardbyte/awa/pull/357)/[#358](https://github.com/hardbyte/awa/pull/358)). `admin::cancel_tx` and `admin::cancel_by_unique_key_tx` take a caller-provided `&mut PgConnection` and run the cancellation (and the cooperative `awa:cancel` NOTIFY) atomically with the caller's other work; the pool-based `cancel` / `cancel_by_unique_key` are unchanged. - **Descriptor catalog** ([ADR-022](docs/adr/022-descriptor-catalog.md)). Code-declared queue and job-kind metadata (`display_name`, `description`, `owner`, `tags`, `docs_url`) drives admin UI labels and drift detection. - **Cron missed-fire policy** (`coalesce` default / `catch_up`) plus **pause / resume** ([#320](https://github.com/hardbyte/awa/pull/320), v026): `POST /api/cron/{name}/pause` / `/resume`, evaluator skips paused rows, manual `trigger_cron_job` bypasses pause, `/cron` UI controls. - **Metrics off the exact-scan path** ([#330](https://github.com/hardbyte/awa/pull/330), v031) — worker health reads lane-head cursor signals instead of scanning ready rows — plus **maintenance branch observability** ([#302](https://github.com/hardbyte/awa/pull/302)). - **`awa-pg[ui]` Python extra** + `python -m awa serve`. The bare `awa-pg` install stays small; `pip install 'awa-pg[ui]'` pulls in the `awa-cli` wheel and launches the embedded React dashboard. - **Managed-Postgres deployment guide** ([`docs/deploying-on-managed-postgres.md`](docs/deploying-on-managed-postgres.md)). Per-vCPU sizing data, Cloud SQL IAM grants, AlloyDB notes, auth-proxy sidecar pattern, and MVCC operator guidance (separate database for long readers, `idle_in_transaction_session_timeout`, `xact_start` alerting). **Producer APIs and tuning** - **`PartitionedQueue`** ([#348](https://github.com/hardbyte/awa/pull/348), [ADR-031](docs/adr/031-partitioned-queues.md)) — deterministic routing from one hot logical queue to multiple physical partitions. Partition 0 is the logical queue name itself (`email`, `email__p1`, …) so direct enqueues to the logical name stay consumable, and key→partition selection uses a domain-separated hash so it composes with ADR-025 enqueue-shard routing. Replaces the beta-series `QueueFanout` (see Breaking changes). - **Per-job routing in Python COPY batch APIs** ([#348](https://github.com/hardbyte/awa/pull/348)). `insert_many_copy` / `enqueue_many_copy` accept `opts=[...]` entries that override `queue` and `ordering_key` per job, so one COPY call can carry a mixed-partition batch. - **Transactional follow-up jobs** ([ADR-029](docs/adr/029-transactional-followup-jobs.md), [#285](https://github.com/hardbyte/awa/pull/285)/[#288](https://github.com/hardbyte/awa/pull/288)). `ClientBuilder::on_completed_enqueue` (and friends) registers a follow-up job inserted in the same transaction as the lifecycle transition. - **Callback-only router and user-owned callback layers** ([#291](https://github.com/hardbyte/awa/pull/291)/[#293](https://github.com/hardbyte/awa/pull/293)) with a configurable URL prefix — embed Awa's router or implement the contract in your own API layer (axum and FastAPI examples). The `WaitingForCallback` lifecycle event plus client-side `resolve_callback` / `complete_external` / `fail_external` / `retry_external` ([#276](https://github.com/hardbyte/awa/pull/276)) make parked jobs visible to hooks and resolvable in-process. - **Direct queue-storage COPY producer path** as the documented high-volume entry point. Rust: `QueueStorage::enqueue_params_copy(pool, &jobs)`. Python: `Client.enqueue_many_copy(jobs)`. The compat `insert_many_copy` route remains for ad-hoc inserts. - **`InsertOpts::ordering_key`** pins related jobs to the same shard at `enqueue_shards > 1` (a Kafka-partition-key analogue), and **`awa.queue_meta.enqueue_shards`** ([ADR-025](docs/adr/025-sharded-enqueue-heads.md)) is the per-queue semantic switch: default `1` preserves strict `(queue, priority)` FIFO; `≥ 2` switches to partitioned FIFO. - **Completion-batcher defaults tuned** to `(batch=512, flush=1ms)` with adaptive completion shards, tunable via `AWA_COMPLETION_BATCH_SIZE` / `AWA_COMPLETION_FLUSH_MS` / `AWA_COMPLETION_SHARDS`. - **`awa-seaorm` crate** ([#275](https://github.com/hardbyte/awa/pull/275)) for transactional enqueue alongside SeaORM application writes. - **Registered handler futures no longer require `Sync`** ([#331](https://github.com/hardbyte/awa/pull/331)) — only `Send + 'static`, so handlers awaiting `sqlx` / `reqwest` compile without workarounds. **Telemetry** - **`awa-metrics` crate** so non-runtime callers (`awa-ui`, `awa-cli`) emit the same OTel counters as the worker (`awa-worker::AwaMetrics` re-exports for source compatibility). - **Sub-second buckets on `awa.job.wait_duration`**, **`awa.enqueue.batch_size` / `awa.enqueue.duration` histograms**, and an **`awa.enqueue.shard` attribute on `awa.job.claimed`** for per-shard claim throughput. - **`queue_counts_fast`** ([#289](https://github.com/hardbyte/awa/pull/289)) — index-only depth probe for high-cadence pollers. It under-counts unrolled terminal rows; use `queue_counts` when exact terminal counts matter. - **Exact terminal counts without `done_entries` scans** ([#290](https://github.com/hardbyte/awa/issues/290) via [#304](https://github.com/hardbyte/awa/pull/304)/[#306](https://github.com/hardbyte/awa/pull/306)): folded counters serve exact reads when the terminal-counter trust marker is set (`awa storage rebuild-terminal-counters`; fresh installs auto-mark). - **Maintenance branch duration histograms** + `awa_maintenance_branch_overrun_total{branch=…}` ([#302](https://github.com/hardbyte/awa/pull/302)). ### Breaking changes Coming from 0.5.x, only the storage transition (below) needs action — the 0.5 public client API is otherwise source-compatible. The renames below landed within the 0.6 beta/rc series, so early-0.6 adopters must handle them: - **`QueueFanout` → `PartitionedQueue`** ([#348](https://github.com/hardbyte/awa/pull/348)), no compatibility alias: `width` → `partitions`, `queue_fanout` → `partitioned_queue`, Python `*_per_queue` kwargs → `*_per_partition`. Routing also differs from the beta.2 `QueueFanout` (partition 0 is the logical name; domain-separated hash), so a given key may land on a different partition. Drain fanout queues before upgrading, or pin explicit names via `from_physical_queues`. - **`QueueCounts.completed` → `QueueCounts.terminal`** ([#306](https://github.com/hardbyte/awa/pull/306)) — it counts completed, cancelled, and discarded terminal rows; `QueueCounts` also gains `pruned_failed`. - **`retry_failed_by_kind` / `retry_failed_by_queue` return `RetryFailedOutcome { retried, matched, pruned_failed_count }`** ([#337](https://github.com/hardbyte/awa/issues/337)) instead of a bare `Vec`; Python `retry_failed` / `retry_failed_sync` return the outcome rather than a plain list. - **`JobEvent` / `UntypedJobEvent` gain a `WaitingForCallback` variant** ([#276](https://github.com/hardbyte/awa/pull/276)) — exhaustive matches need a new arm. - **`PruneOutcome::Pruned` gains `carried_failed_rows`** and **`QueueStorage::prune_oldest` takes a `failed_retention: Duration`** ([#337](https://github.com/hardbyte/awa/issues/337)) — `Duration::ZERO` disables the floor. ### Upgrading from 0.5.x - **Fresh installs:** nothing to do. `awa migrate` auto-finalizes to the queue-storage engine on first run. - **Existing 0.5.x clusters:** roll out 0.6 workers first (they understand both engines and the transition states), then walk `prepare → enter-mixed-transition → finalize`, following [`docs/upgrade-0.5-to-0.6.md`](docs/upgrade-0.5-to-0.6.md). **Rollback boundary:** one-way after `enter-mixed-transition` followed by any queue-storage write — plan to restore from backup if rollback is needed past that point. - Update the dependency: `awa = "0.6.0"` (Rust) / `awa-pg==0.6.0` (Python). ### Operating notes - **Set `enqueue_shards` explicitly per queue.** The default `1` is the conservative FIFO-preserving choice but serialises producers on a single head row; `4`/`8` is operator tuning for contended hot queues. The trade-off is semantic, not a free perf win — see [`docs/configuration.md`](docs/configuration.md#sharding-the-enqueue-head-per-queue). - **MVCC discipline.** If your application runs long-lived `REPEATABLE READ` / `SERIALIZABLE` transactions on the same database awa lives in, give awa its own database. A long-pinned `xmin` blocks dead-tuple cleanup and degrades queue-storage throughput over long horizons — bound non-awa sessions with `idle_in_transaction_session_timeout` and alert on `pg_stat_activity.xact_start` age. Tracked in [#169](https://github.com/hardbyte/awa/issues/169). - **Cloud SQL with IAM auth:** the runtime SA needs `cloudsqlsuperuser` for `prepare_schema` to install. Run `GRANT cloudsqlsuperuser TO "your-sa@project.iam"` once per instance. AlloyDB grants this automatically. Full guide: [`docs/deploying-on-managed-postgres.md`](docs/deploying-on-managed-postgres.md). ### Benchmark evidence (#169) Long-horizon pinned-MVCC behaviour, measured with the [companion harness](https://github.com/hardbyte/postgresql-job-queue-benchmarking) (1 replica, 64 workers, 800 jobs/s offered, 60-minute idle-in-transaction reader). **These are point-in-time results from that harness and hardware, not universal claims.** - **Awa on the 0.6 storage engine:** the clean phase holds the offered rate at shallow median depth. Under the 60-minute pinned reader, completion sags but queue depth stays bounded (no dead-tuple cliff) and drains fully once the pin releases — the append-only segments hold zero dead tuples, with residual pressure confined to terminal-counter and ring-state metadata. This bounded-depth-through-the-pin / full-drain-in-recovery shape is the [#169](https://github.com/hardbyte/awa/issues/169) gate the 0.6.0 tag was held on, and it passed. - **Reference comparison:** a feature-minimal reference queue (no per-row retries, heartbeats, cancellation, or deadlines) holds flat through the same phase at a fraction of the WAL/job. Every per-row-state-machine Postgres queue — River, Oban, pg-boss, Graphile, pgmq — shares awa's degradation shape under a pinned horizon. Awa is not immune to long readers; the MVCC-discipline rules above are the supported mitigation. - A separate Cloud SQL PG18 16-vCPU staging sweep (v021 shard-aware lane indexes) moved end-to-end drain on a 3.5M-row backlog from ~1,300 jobs/s to ~8,800–10,600 jobs/s. That is a producer/claim-throughput result on contended backlog, independent of the MVCC question above. ## [0.6.0-rc.4] — 2026-06-30 ### Fixed - **`admin::cancel_by_unique_key` / `cancel_by_unique_key_tx` on the queue-storage engine** ([#359](https://github.com/hardbyte/awa/pull/359)). The candidate lookup's running-job branch read `unique_key` directly from `{schema}.leases`, but the `leases` table does not carry that column, so any cancel-by-unique-key issued while queue storage was the active engine failed at plan time with `column "unique_key" does not exist`. The running-job branch now recovers the key by joining each lease back to its originating `ready_entries` row — the same lane-identity join the candidate and jobs-compat views already use. Canonical-engine behaviour was unaffected. ## [0.6.0-rc.3] — 2026-06-25 ### Changed - **`admin::cancel_tx` / `admin::cancel_by_unique_key_tx` now take `&mut PgConnection`** ([#358](https://github.com/hardbyte/awa/pull/358)) instead of the `&mut sqlx::Transaction` introduced in rc.2. A `&mut Transaction` deref-coerces to `&mut PgConnection`, so existing callers are unaffected, while callers that only hold a connection mid-transaction (e.g. behind a `transact!`-style helper that derefs the transaction) can now use them too. This matches awa's existing multi-statement consumer convention (`insert_many_copy`). Internally the cancel runs in a nested transaction — a `SAVEPOINT` when the connection is already in one — so a cancel error rolls back only the cancel rather than poisoning the caller's transaction. ## [0.6.0-rc.2] — 2026-06-25 ### Added - **Transaction-scoped admin cancel** ([#357](https://github.com/hardbyte/awa/pull/357)). `admin::cancel_tx` and `admin::cancel_by_unique_key_tx` accept a caller-provided `&mut sqlx::Transaction` and run the cancellation inside it, so the cancel commits or rolls back atomically with the caller's other work and the cooperative `awa:cancel` NOTIFY to a running worker fires only on the caller's commit. The pool-based `cancel` / `cancel_by_unique_key` are unchanged. On the queue-storage engine the `_tx` variants skip the best-effort post-commit claim-cursor advance the pool variants perform — the derived queue depth can briefly over-count by one until later committed rows on the lane are claimed; canonical counts are unaffected. ## [0.6.0-rc.1] — 2026-06-24 First release candidate for the 0.6 line. It promotes the beta.2 queue-storage engine after the [#169](https://github.com/hardbyte/awa/issues/169) pinned-MVCC dead-tuple gate passed on `main`: a 60-minute idle-in-transaction soak now holds throughput with no dead-tuple cliff, and the last dominant pinned-horizon hot row (`queue_claim_heads`) is removed in this delta. Migrations v032–v039 apply via `awa migrate` (or the SQL-only path in [`docs/migrations.md`](docs/migrations.md) for external migration tooling). ### Added - **Compact receipt claim and completion batches** ([#352](https://github.com/hardbyte/awa/pull/352), migrations v036-v038, [ADR-026](docs/adr/026-narrow-terminal-history.md)). Receipt-backed successful completions can now write compact terminal batches instead of one `done_entries` row per job, plus compact claim-local closure batches so stale receipt scans stay bounded. Queue storage also records compact `ready_segments` lane ranges so claim can route through committed ready segment metadata before validating `ready_entries`, compact `ready_claim_attempt_batches` range evidence so stale claim cursors do not need to scan claim-ring partitions while old slots are being truncated, and compact `lease_claim_batches` receipt evidence for zero-deadline claims. Deadline-backed receipt claims remain row-local in `lease_claims` for indexed deadline rescue. `{schema}.terminal_jobs` remains the public terminal read surface; direct SQL against `done_entries` should not assume all completed jobs are physically stored there. - **Per-job routing in Python COPY batch APIs** ([#348](https://github.com/hardbyte/awa/pull/348), [ADR-031](docs/adr/031-partitioned-queues.md)). `insert_many_copy` / `enqueue_many_copy` (async and sync) accept `opts=[...]` entries that override `queue` and `ordering_key` per job, so one COPY call can carry a mixed-partition batch. Batch-level kwargs remain defaults; an explicit `"ordering_key": None` clears the key for that job. - **Failed terminal retention floor** ([#337](https://github.com/hardbyte/awa/issues/337) via [#350](https://github.com/hardbyte/awa/pull/350), migration v032, [ADR-032](docs/adr/032-failed-terminal-retention.md)). Non-DLQ `failed` terminal rows now stay retryable for at least `failed_retention` (default `72h`) in queue storage. Queue-ring prune carries in-floor `failed` rows forward into the live segment as wide self-contained terminal rows before truncating the old slot, instead of dropping them on the next rotation. Failed rows aged past the floor are folded into the new `queue_terminal_rollups.pruned_failed_count` column and surfaced as `QueueCounts.pruned_failed` — a cumulative, monotonic count of failed rows no longer retryable, giving operators standing visibility of loss that was previously silent. `retry_failed_by_kind` / `retry_failed_by_queue` now return a `RetryFailedOutcome { retried, matched, pruned_failed_count }` so raced or pruned ids are reported rather than silently dropped, and the CLI surfaces the matched/retried split and a pruned-past-retention warning. `cancelled` rows are not held by the floor. ### Changed - **Breaking (beta series): `QueueFanout` is replaced by `PartitionedQueue`** ([#348](https://github.com/hardbyte/awa/pull/348), [ADR-031](docs/adr/031-partitioned-queues.md)); no compatibility alias. Besides the rename (`width` → `partitions`, `queue_fanout` → `partitioned_queue`, Python `*_per_queue` config kwargs → `*_per_partition`), routing behavior differs from beta.2: partition 0 is now the logical queue name itself (`email`, `email__p1`, ...) so direct enqueues to the logical name stay consumable, and key→partition selection uses a domain-separated hash so it composes with ADR-025 enqueue-shard routing (the same key may land on a different partition than under beta.2 `QueueFanout`). Drain fanout queues before upgrading producers/workers, or pin explicit names via `from_physical_queues`. - **Breaking (beta series): `retry_failed_by_kind` and `retry_failed_by_queue` return `RetryFailedOutcome`** ([#337](https://github.com/hardbyte/awa/issues/337)) instead of a bare `Vec`; `RetryFailedOutcome` carries `retried`, `matched`, and `pruned_failed_count`. Python `retry_failed` / `retry_failed_sync` return the outcome rather than a plain list of jobs. - **Breaking (beta series): `PruneOutcome::Pruned` gains a `carried_failed_rows` field** ([#337](https://github.com/hardbyte/awa/issues/337)) — `Pruned { slot, carried_failed_rows }`; exhaustive matches on `PruneOutcome` need the new binding. - **Breaking (beta series): `QueueStorage::prune_oldest` takes a `failed_retention: Duration`** ([#337](https://github.com/hardbyte/awa/issues/337)). `Duration::ZERO` disables the floor; `MaintenanceService` passes its configured `failed_retention`. `QueueCounts` gains a `pruned_failed: i64` field. - **Maintenance prune lock avoidance + bounded receipt-plane scans** ([#349](https://github.com/hardbyte/awa/pull/349), migrations v033–v035). Queue-ring prune no longer queues behind a held lock — it skips a contended slot and retries on the next maintenance cycle, and genuine (non-lock) prune errors now propagate instead of being swallowed. Receipt rescue, receipt terminal-delete closures, and receipt deadline-rescue sweeps are bounded by per-slot cursors so they cost work proportional to live receipts rather than scanning whole rings; queue-storage metrics and maintenance emptiness checks stay off the receipt rings; and the default lease-ring rotation cadence is lowered to cut idle maintenance churn. ### Fixed - **Stop writing the `queue_claim_heads` ready-segment routing cache** ([#355](https://github.com/hardbyte/awa/pull/355); completes the [#169](https://github.com/hardbyte/awa/issues/169) / [#197](https://github.com/hardbyte/awa/issues/197) HOT-update audit, migration v039). The per-claim `UPDATE` of the `ready_segment_*` routing cache on the singleton `queue_claim_heads` row was the dominant dead-tuple accumulator under a pinned MVCC horizon — a 60-minute idle-in-transaction soak left ~130k dead row versions on a single live row (~80% of all dead tuples), unreclaimable until the horizon released. `claim_ready_runtime` now resolves the target ready slot directly from the `ready_segments` control plane, ordered by `next_lane_seq` (ready segments are non-overlapping, so the smallest `next_lane_seq > claim_seq` is the next covering segment; the subsequent `ready_entries` lookup validates the row, so reservation gaps fall through safely) so the existing `(queue, priority, enqueue_shard, next_lane_seq, …)` index short-circuits at `LIMIT 1` instead of materialising and sorting the tail. The now-unused `ready_segment_slot` / `ready_segment_generation` / `ready_segment_next_lane_seq` columns are **retained** so a rolling-upgrade worker on the previous `queue_storage_schema_ready` check still starts (the additive-only migration policy defers dropping them to a major version). In the pinned-MVCC gate this removes the table's dead-tuple stream entirely and lowers claim p99 under the pin versus the previous cache. Continues the HOT-update audit from the `queue_lanes.available_count` removal (v016, [#251](https://github.com/hardbyte/awa/pull/251)) and the `leases` / `lease_claims` fillfactor pass ([#315](https://github.com/hardbyte/awa/pull/315)). - **Compact claims close into the compact closure ledger on every path** ([#352](https://github.com/hardbyte/awa/pull/352)). Receipt rescue, terminal close (completion / fail / retryable / cancel), and admin cancel of a compact (zero-deadline) claim now write a `lease_claim_closure_batches` row instead of an explicit `lease_claim_closures` row. A compact claim has no `lease_claims` row, so an explicit closure was invisible to the queue-ring prune count proof and wedged the slot on `SkippedActive { QueueUnclosedClaimRefs }` until the claim ring pruned. Deadline-backed row-local claims continue to write explicit closures. ## [0.6.0-beta.2] — 2026-06-10 Second beta of the 0.6 line. The headline is storage-engine work under pinned MVCC horizons ([#169](https://github.com/hardbyte/awa/issues/169)): sequence-backed cursors, append-only ready segments, and a terminal-count delta ledger replace the remaining hot-row update paths that beta.1 still carried. This is also the release the #169 stable gate will be validated against — see "Benchmark evidence" below. Migrations v022–v031 apply via `awa migrate` (or the SQL-only path in [`docs/migrations.md`](docs/migrations.md) for external migration tooling). ### Storage engine under pinned MVCC horizons (#169) - **Sequence-backed lane cursors** ([#321](https://github.com/hardbyte/awa/pull/321), migration v027). Enqueue/claim lane cursors move from hot MVCC-updated rows to PostgreSQL sequences; the head tables remain as lane registries and lock targets. Claim cursors advance post-commit so non-transactional sequence state cannot skip work on rollback. `queue_terminal_live_counts` is striped by `job_id % 256` so completion-heavy lanes don't hammer one counter row. - **Append-only ready segments + tombstone ledger** ([#323](https://github.com/hardbyte/awa/pull/323), migration v028). Completion, DLQ, retry, and discard no longer `DELETE FROM ready_entries`; rare ready invalidations append to `ready_tombstones`, claim treats tombstones as spent cursor evidence, and maintenance truncates ready/done/tombstone partitions together. Under a pinned reader, ready/done/tombstone partitions now hold zero dead tuples. - **Terminal-count delta ledger + async rollup** ([#329](https://github.com/hardbyte/awa/pull/329), migration v030, [ADR-026](docs/adr/026-narrow-terminal-history.md)). Terminal mutations append signed rows to `queue_terminal_count_deltas` in the same transaction instead of upserting a live counter; the maintenance leader folds sealed-slot deltas into `queue_terminal_live_counts`. Exact reads stay honest while rollup lags: folded counts plus pending deltas. - **Rollup deferral under pinned horizons** ([#333](https://github.com/hardbyte/awa/pull/333)). Maintenance stands down from mutating folded counters or truncating delta segments while another backend pins the MVCC horizon, then folds after the horizon clears. Prevents the counter table itself from bloating while vacuum is blocked. - **Exact terminal counts without `done_entries` scans** ([#290](https://github.com/hardbyte/awa/issues/290) via [#304](https://github.com/hardbyte/awa/pull/304)/[#306](https://github.com/hardbyte/awa/pull/306)). `queue_counts_exact` reads the folded counters (bounded by slots × priorities × shards) when the terminal-counter trust marker is set, falling back to scanning `done_entries` mid-rolling-upgrade. Operators flip the marker with `awa storage rebuild-terminal-counters`; fresh installs auto-mark. - **`queue_counts_fast`** ([#289](https://github.com/hardbyte/awa/pull/289)) — index-only depth probe for high-cadence pollers (dashboards, depth-target producers). Under-counts terminal rows the live segment hasn't rolled up; use `queue_counts` when exact terminal counts matter. - **Metrics off the exact-scan path** ([#330](https://github.com/hardbyte/awa/pull/330), migration v031). Worker health/metrics availability reads lane-head cursor signals instead of exact ready-row scans; lag probing is bounded to the next claimable row per lane; a partial index serves the failed-count probe. - **Maintenance and receipt-plane mitigations**: `fillfactor=50` + autovacuum knobs on `leases` / `lease_claims` partitions ([#315](https://github.com/hardbyte/awa/pull/315), migration v024); exponential prune backoff + branch-tracker hysteresis ([#316](https://github.com/hardbyte/awa/pull/316)); receipts mode drops the `leases.heartbeat_at` write and `state_hb` index — heartbeats live in `attempt_state` ([#317](https://github.com/hardbyte/awa/pull/317), migration v025); duration-margin hysteresis, per-branch cooldown, and a 250 ms lease-rotate default. ### Added - **Durable batch operations** ([#328](https://github.com/hardbyte/awa/pull/328), migration v029, [ADR-030](docs/adr/030-batch-operations.md)). Crash-safe, maintenance-driven bulk `set_priority` and `move_queue` over job selections, with preview/submit/list/get/cancel/purge through the HTTP API, CLI, and a new admin-UI Batch Ops tab. Python parity — raw sync/async batch methods plus typed `Client` / `AsyncClient` helpers — via [#332](https://github.com/hardbyte/awa/pull/332). This is the first-class reprioritization surface ([#307](https://github.com/hardbyte/awa/issues/307)). - **Transactional follow-up jobs** ([ADR-029](docs/adr/029-transactional-followup-jobs.md), [#285](https://github.com/hardbyte/awa/pull/285)/[#288](https://github.com/hardbyte/awa/pull/288)). `ClientBuilder::on_completed_enqueue` (and friends) registers a follow-up job inserted in the same transaction as the lifecycle transition for worker-driven outcomes; callback resolution through the worker `Client` commits transition + follow-up atomically too. Maintenance rescue stays best-effort by design. - **Callback-only router and user-owned callback layers** ([#291](https://github.com/hardbyte/awa/pull/291)/[#293](https://github.com/hardbyte/awa/pull/293), closes [#281](https://github.com/hardbyte/awa/issues/281)). The callback ingress contract is shared and the URL prefix configurable; embed Awa's router or implement the contract in your own API layer — axum and FastAPI examples documented. - **`WaitingForCallback` lifecycle event + client-side callback resolution** ([#276](https://github.com/hardbyte/awa/pull/276)). Jobs parking on `WaitForCallback` are now visible to lifecycle hooks, and `Client` gains `resolve_callback` / `complete_external` / `fail_external` / `retry_external` that dispatch the matching terminal event in-process. - **Queue fanout helper** ([#327](https://github.com/hardbyte/awa/pull/327)). Rust `QueueFanout` + `ClientBuilder::queue_fanout` and Python `awa.QueueFanout` for deterministic routing from one hot logical queue to multiple physical queues; duplicate physical declarations are rejected. Replaced by `PartitionedQueue` in [#348](https://github.com/hardbyte/awa/pull/348). - **Cron schedule pause / resume** ([#320](https://github.com/hardbyte/awa/pull/320), migration v026). `POST /api/cron/{name}/pause` / `/resume`; the evaluator skips paused rows and the `atomic_enqueue` CTE re-checks `paused_at IS NULL` so a pause asserted mid-evaluation still takes effect. `last_enqueued_at` is untouched while paused, so `missed_fire_policy` decides catch-up on resume. Manual `trigger_cron_job` bypasses pause. The `/cron` UI gains Pause/Resume controls. - **`awa storage finalize --wait` / `--check`** ([#298](https://github.com/hardbyte/awa/pull/298)). `--wait` polls and finalizes once readiness gates stay clear for two consecutive observations; `--check` is a dry-run that exits 2 when blocked. - **Storage-transition readiness UI** ([#299](https://github.com/hardbyte/awa/pull/299)). Time-in-state, epoch-anchored backlog history, a prominent `prepared_schema_ready=false` warning with the remediation command, and a rollback-boundaries panel. - **`awa-seaorm` crate** ([#275](https://github.com/hardbyte/awa/pull/275)). Focused SeaORM adapter for transactional enqueue alongside application writes. - **Maintenance branch observability** ([#302](https://github.com/hardbyte/awa/pull/302)). `awa.maintenance.branch.duration` histograms, delayed-tick warnings on on-time→delayed transitions, and `awa_maintenance_branch_overrun_total{branch=...}`. ### Changed - **Breaking (beta series): `QueueCounts.completed` is renamed `QueueCounts.terminal`** ([#306](https://github.com/hardbyte/awa/pull/306)) — it counts completed, cancelled, and discarded terminal rows, and the old name misread as completed-only. - **Breaking (beta series): `JobEvent` / `UntypedJobEvent` gain a `WaitingForCallback` variant** ([#276](https://github.com/hardbyte/awa/pull/276)) — exhaustive matches need a new arm. - **`awa migrate` owns the default `awa.*` queue-storage substrate** ([#308](https://github.com/hardbyte/awa/issues/308) via [#310](https://github.com/hardbyte/awa/pull/310)/[#312](https://github.com/hardbyte/awa/pull/312)/[#313](https://github.com/hardbyte/awa/pull/313)/[#314](https://github.com/hardbyte/awa/pull/314), migration v023). Substrate DDL is migration-owned rather than installed opportunistically by `prepare_schema()`; `awa --reset --schema awa` is rejected; the SQL-only install/upgrade path for external migration tooling is documented and tested. - **Registered handler futures no longer need `Sync`** ([#331](https://github.com/hardbyte/awa/pull/331)). Returned futures only require `Send + 'static`, so handlers awaiting `sqlx` / `reqwest` work compile without workarounds. - **Chaos tests observe DB state, not stdout** ([#301](https://github.com/hardbyte/awa/pull/301), closes [#167](https://github.com/hardbyte/awa/issues/167)). ### Fixed - **Concurrent queue-storage sequence reservations** ([#326](https://github.com/hardbyte/awa/pull/326)). `reserve_enqueue_seq` assumed `N × nextval()` returned a contiguous block; concurrent COPY producers could reserve overlapping ranges and hit `ready_entries_*_pkey`. Blocks now allocate under a per-sequence advisory lock (`nextval` + `setval`), and compatibility sync uses the same lock so it cannot rewind a hot enqueue sequence. - **Flaky admin metadata cache test under parallel runners** ([#274](https://github.com/hardbyte/awa/pull/274)). ### Documentation - **MVCC operator guidance** in [`docs/deploying-on-managed-postgres.md`](docs/deploying-on-managed-postgres.md): keep long-running analytical readers on a separate database, bound non-Awa sessions with `idle_in_transaction_session_timeout`, alert on `pg_stat_activity.xact_start` age (query included), and give autovacuum instance-level capacity on managed engines. - **Security guide: deployable roles and callback ingress boundaries** ([#294](https://github.com/hardbyte/awa/pull/294)). - **Deadline-bounded polling example** ([#273](https://github.com/hardbyte/awa/pull/273)) — `poll_until_deadline.rs` plus an integration test pinning the retry-until-deadline pattern. - App-owned database usage in examples ([#286](https://github.com/hardbyte/awa/pull/286)); callback ingress + maintenance ADR proposals ([#277](https://github.com/hardbyte/awa/pull/277)); the #169 storage spike archived under `docs/` ([#300](https://github.com/hardbyte/awa/pull/300)). ### Benchmark evidence and operating notes (#169) Long-horizon pinned-MVCC behaviour, measured with the [companion harness](https://github.com/hardbyte/postgresql-job-queue-benchmarking) (1 replica, 64 workers, 800 jobs/s offered, 60-minute idle-in-transaction reader; numbers are point-in-time results from that harness and hardware, not universal claims): - **Awa on this release's storage engine (post-#330 main, 2026-06-09 run):** clean phase holds 800/s at median depth 21. Under the 60-minute pinned reader, median completion is ~741/s, sagging to ~606/s by phase end with queue depth peaking at ~312k; peak sampled dead tuples ~91k (down from ~2.54M two iterations earlier — the append-only segments hold zero dead tuples, with the residual pressure in the terminal-counter and ring-state metadata). Recovery after the pin releases drained at ~963/s median but still held ~198k backlog after 10 minutes. - **pgque reference on the same harness (2026-05-17/18):** holds ~800/s with median depth 0 through the same phase shape, at ~450 B WAL/job versus Awa's ~2.2–2.9 KiB/job. pgque buys that immunity by trading away per-row feature surface (per-row retries, heartbeats, cancellation, deadlines); every per-row-state-machine Postgres queue — River, Oban, pg-boss, Graphile, pgmq — shares Awa's degradation shape under a pinned horizon. Awa is not immune to long readers, and this release does not claim otherwise. - **Operating guidance:** the MVCC-discipline rules above are the supported mitigation — separate database for long analytical readers, session timeouts, `xact_start` alerting. `enqueue_shards=1` remains the conservative default; `4`/`8` is operator tuning for contended hot queues, independent of the MVCC question. - The `0.6.0` **stable** tag is gated on this release passing the long-horizon shape (bounded depth through the pinned hour, full drain in recovery) — tracked in [#169](https://github.com/hardbyte/awa/issues/169). ## [0.6.0-beta.1] — 2026-05-19 First beta of the 0.6 line. Frames the user-facing diff between `0.5.x` and `0.6.0-beta.1` as one release; the `0.6.0-alpha.N` entries below remain as the granular development log. ### What's new since 0.5.x **Storage and durability** - **Queue-storage engine, default-on** ([ADR-019](docs/adr/019-queue-storage-redesign.md)). Append-only `ready_entries`, `deferred_jobs`, `done_entries`, and `dlq_entries` paired with a partitioned receipt ring keep dead-tuple footprint bounded under sustained load. Replaces the row-mutating canonical engine for fresh installs. - **Receipt-plane ring partitioning** ([ADR-023](docs/adr/023-receipt-plane-ring-partitioning.md)). `lease_claims` and `lease_claim_closures` partitioned by claim slot, rotated by the maintenance leader. - **Per-claim deadlines** in receipts mode. Set `QueueConfig.deadline_duration` to bound a single attempt; rescue force-closes expired claims with `'deadline_expired'`. - **Staged 0.5 → 0.6 transition tooling**: `awa storage prepare`, `prepare-queue-storage-schema`, `enter-mixed-transition`, `finalize`, `abort`. Fresh installs auto-finalize on first `awa migrate`. Full procedure in [`docs/upgrade-0.5-to-0.6.md`](docs/upgrade-0.5-to-0.6.md). **Operator surfaces** - **Dead Letter Queue** ([ADR-020](docs/adr/020-dead-letter-queue.md)). Per-queue `dlq_enabled` policy plus a full admin surface: `awa dlq depth | list | retry | retry-bulk | move | purge` (CLI), matching admin UI tab, Rust/Python client APIs. - **Descriptor catalog** ([ADR-022](docs/adr/022-descriptor-catalog.md)). Code-declared queue and job-kind metadata (`display_name`, `description`, `owner`, `tags`, `docs_url`) drives admin UI labels and drift detection. - **Cron missed-fire policy**. Periodic schedules persist an explicit `missed_fire_policy`: `coalesce` (default) or `catch_up`. Exposed in Rust/Python APIs and CLI schedule output. - **`awa-pg[ui]` Python extra** + `python -m awa serve`. The bare `awa-pg` install stays small (workers/producers don't pay for the ~10 MB axum + dashboard bundle); `pip install 'awa-pg[ui]'` pulls in the `awa-cli` wheel and lets `python -m awa serve` launch the embedded React dashboard. - **Managed-Postgres deployment guide** ([`docs/deploying-on-managed-postgres.md`](docs/deploying-on-managed-postgres.md)). Per-vCPU sizing data, Cloud SQL IAM grants, AlloyDB notes, auth-proxy sidecar pattern. **Producer APIs and tuning** - **Direct queue-storage COPY producer path** as the documented high-volume entry point. Rust: `QueueStorage::enqueue_params_copy(pool, &jobs)`. Python: `Client.enqueue_many_copy(jobs)`. The compat-friendly `insert_many_copy_from_pool` / `client.insert_many_copy` routes through `awa.insert_job_compat()` once per row — fine for ad-hoc inserts but ~100–150 ms per row through a real DB proxy, not what you want for bursts. - **`InsertOpts::ordering_key: Option>`** pins related jobs to the same shard at `enqueue_shards > 1`. Kafka-partition-key analogue: jobs sharing a key inherit that shard's strict FIFO. `None` rotates batches across shards. - **`awa.queue_meta.enqueue_shards` per-queue semantic switch** ([ADR-025](docs/adr/025-sharded-enqueue-heads.md)). Default `1` preserves strict `(queue, priority)` FIFO. Setting `≥ 2` switches that queue to partitioned FIFO (strict within `(queue, priority, enqueue_shard)`, no order across shards) — comparable to choosing SQS Standard over FIFO. - **Queue-storage completion-batcher defaults tuned** to `(batch=512, flush=1ms)`, with adaptive queue-storage completion shards: ordinary runtimes use `1`; runtimes configured for at least `512` workers use `4`. Tunable via `AWA_COMPLETION_BATCH_SIZE`, `AWA_COMPLETION_FLUSH_MS`, and `AWA_COMPLETION_SHARDS`. **Telemetry** - **`awa-metrics` crate**. `AwaMetrics` and its `record_*` methods live in their own crate so non-runtime callers (`awa-ui`, `awa-cli`) can emit the same OTel counters as the worker. `awa-worker::AwaMetrics` re-exports for source compatibility. - **Sub-second buckets on `awa.job.wait_duration`**. Previous boundaries didn't resolve pickup latency below 5 s. - **`awa.enqueue.batch_size` and `awa.enqueue.duration`** histograms on the direct COPY enqueue path. - **`awa.enqueue.shard` attribute on `awa.job.claimed`** so dashboards can see per-shard claim throughput. ### Upgrading from 0.5.x - Fresh installs: nothing to do. `awa migrate` auto-finalizes to the queue-storage engine on first run. - Existing 0.5.x clusters: walk the staged transition documented in [`docs/upgrade-0.5-to-0.6.md`](docs/upgrade-0.5-to-0.6.md). Roll out 0.6 workers first (they understand both engines and the transition states), then walk `prepare → enter-mixed-transition → finalize`. **Rollback boundary:** one-way after `enter-mixed-transition` followed by any queue-storage write. Plan to restore from backup if rollback is needed past that point. - Update the dependency: `awa = "0.6.0-beta.1"` (Rust) / `awa-pg==0.6.0-beta.1` (Python). ### Operating notes - **Set `enqueue_shards` explicitly per queue.** The default `1` is the conservative FIFO-preserving choice but serialises producers on a single head row. We recommend `4` for contended hot queues. The trade-off is semantic, not a free perf win — see [`docs/configuration.md`](docs/configuration.md#sharding-the-enqueue-head-per-queue). - **MVCC discipline.** If your application runs long-lived `REPEATABLE READ` / `SERIALIZABLE` transactions on the same database awa lives in, give awa its own database. Long-pinned `xmin` blocks dead-tuple cleanup and degrades queue-storage throughput over long horizons. Tracked in [#169](https://github.com/hardbyte/awa/issues/169). - **Cloud SQL with IAM auth:** the runtime SA needs `cloudsqlsuperuser` for `prepare_schema` to install. Run `GRANT cloudsqlsuperuser TO "your-sa@project.iam"` once per instance. AlloyDB grants this automatically. Full guide: [`docs/deploying-on-managed-postgres.md`](docs/deploying-on-managed-postgres.md). ### Changes since 0.6.0-alpha.9 For users already running an alpha: - v021 shard-aware lane indexes on `ready_entries` / `done_entries` / `leases` partitions (#263). The narrow `(queue, priority, lane_seq)` indexes from before v017 didn't include `enqueue_shard`; on heavy backlog the planner discarded `(shards-1)/shards` of rows per partition per claim. Drain throughput at depth restored to equilibrium rate. - `prepare_schema` startup race fixed (#264, #266). Concurrent worker startup on a fresh DB previously hung on PG18; install now runs in a single transaction with `pg_advisory_xact_lock`. - `queue_storage_schema_ready` tightened to require every object the runtime depends on, so a partial install can't report ready (#266). - Managed-Postgres deploy guide added (#265). - `awa.enqueue.batch_size` / `awa.enqueue.duration` histograms added (#265). - Direct queue-storage COPY producer path is the documented high-volume entry point (#263); compat path semantics unchanged. ### Performance - Drop the `queue_lanes.available_count` cache (migration `v016`). The dispatcher derives availability from `queue_enqueue_heads.next_seq - queue_claim_heads.claim_seq` and the admin API (`queue_counts`) scans `ready_entries` for an exact count. Removes the queue-storage schema's largest dead-tuple source under pinned-xmin workloads (long-running reader transactions) without changing public API behaviour. See ADR-019 § `lane_state` and segment cursor tables. - Cache `(queue, priority, enqueue_shard)` lane presence in-process on the queue-storage path so subsequent enqueue batches skip the three `INSERT ... ON CONFLICT DO NOTHING` round-trips on `queue_lanes` / `queue_enqueue_heads` / `queue_claim_heads`. The cache invalidates and re-runs `ensure_lane` if a subsequent `UPDATE queue_enqueue_heads` finds no row (the observable signal of an earlier ensure_lane that ran inside a rolled-back transaction), so correctness is preserved. - Shard the queue-storage active plane by `enqueue_shard` (migration `v017`). `awa.queue_meta.enqueue_shards` (default 1, range 1..=64) is a per-queue semantic mode switch — comparable to choosing SQS Standard over SQS FIFO, raising Kafka partition count, or using Pub/Sub ordering keys. The ordering contract at `enqueue_shards = 1` is unchanged (strict FIFO per `(queue, priority)`); at `enqueue_shards > 1` it becomes **partitioned FIFO** — strict FIFO within `(queue, priority, enqueue_shard)`, no order promised across shards. The shard column runs end-to-end: `queue_enqueue_heads`, `queue_claim_heads`, `ready_entries`, `leases`, and `done_entries` carry it in their primary keys; `lease_claims` carries it as a regular column. Raising the value per noisy queue delivers near-linear throughput scaling on contended enqueue workloads: a 16-producer same-queue local sweep measured 1.0× → 1.60× → 2.75× → 3.69× at S=1/2/4/8. Scope: this addresses producer-side enqueue contention. The high-worker-count rescue-path regression (1 replica × 256 workers, receipts on, `LEASE_DEADLINE_MS` A/B) is a separate effect on the claim / rescue side and remains open for follow-up measurement. See ADR-025 for the full design. - **Shard-aware lane indexes on `ready_entries`, `done_entries`, and `leases` child partitions** (migration `v021`, [#263](https://github.com/hardbyte/awa/pull/263)). The narrow `(queue, priority, lane_seq)` lane indexes that predated v017 did not include `enqueue_shard`, while `claim_ready_runtime` (since v017) filters on it. Under `enqueue_shards > 1` and deep backlog the planner scanned the lane index forward and post-filtered shard, discarding roughly `(shards-1)/shards` of rows per partition per claim. v021 replaces those with `(queue, priority, enqueue_shard, lane_seq)` indexes and drops the originals; `prepare_schema` is updated to match for fresh installs. On a Cloud SQL PG18 16 vCPU staging instance with a 3.5M row backlog, end-to-end drain went from ~1,300 jobs/s to ~8,800–10,600 jobs/s (single-claim probe: 11.4 ms → 0.81 ms). ### Added - `InsertOpts::ordering_key: Option>` pins related jobs to the same shard at `enqueue_shards > 1`. The key bytes are mapped by Awa's portable shard hash and reduced modulo the queue's shard count, so Rust, SQL, and Python enqueue paths agree on routing. Use it as a Kafka-partition-key analogue: jobs for the same customer / order / account share a shard and inherit that shard's strict FIFO. `None` falls back to one rotor pick per `(queue, priority)` sub-batch. Ignored at `enqueue_shards = 1`. - `awa.job.claimed` counter now carries an `awa.enqueue.shard` attribute on the queue-storage claim path so dashboards can see per-shard claim throughput. Canonical claims continue to emit the un-decorated series; the two attribute sets do not overlap, so Prometheus `sum by (awa_enqueue_shard)(rate(awa_job_claimed[1m]))` is the per-shard fairness panel. - Tune the queue-storage completion-batcher defaults to `(batch=512, flush=1ms)`. The larger batch cap keeps the durable completion path amortised under load, while the 1 ms flush keeps low-latency finalization for short jobs. Tunable via `AWA_COMPLETION_BATCH_SIZE` and `AWA_COMPLETION_FLUSH_MS`. - **Direct queue-storage COPY producer path is the documented high-volume entry point** ([#263](https://github.com/hardbyte/awa/pull/263)). Rust: `QueueStorage::enqueue_params_copy(pool, &jobs)`. Python: `Client.enqueue_many_copy(jobs)`. `insert_many_copy_from_pool` / `client.insert_many_copy` remain available as the compatibility COPY surface and route through `awa.insert_job_compat()`. See [`docs/configuration.md`](docs/configuration.md#producer-path-choice). - **Explicit sub-second buckets on `awa.job.wait_duration`** ([#263](https://github.com/hardbyte/awa/pull/263)). Histogram now resolves pickup latency below 5 s, which the previous bucket boundaries did not. - **`awa.enqueue.batch_size` and `awa.enqueue.duration` histograms** ([#265](https://github.com/hardbyte/awa/pull/265)). Per-batch observability on the direct COPY enqueue path. Lets producers tell "batches are tiny" from "batches are slow" when an enqueue rate target is missed — neither was distinguishable from existing metrics. Recorded by Python `Client.enqueue_many_copy` (sync and async). Rust callers using `QueueStorage::enqueue_params_copy` directly can record via `AwaMetrics::from_global().record_enqueue_batch(queue, count, duration)`. - **Managed-Postgres deployment guide** ([#265](https://github.com/hardbyte/awa/pull/265)). New [`docs/deploying-on-managed-postgres.md`](docs/deploying-on-managed-postgres.md) covering Cloud SQL and AlloyDB specifics: per-vCPU sizing measurements from staging, Postgres-version recommendations, IAM `cloudsqlsuperuser` grant for Cloud SQL IAM users, the auth-proxy native-sidecar pattern, and `enqueue_shards` operator guidance. ### Fixed - **`prepare_schema` no longer deadlocks on fresh-DB / small-pool / concurrent worker startup** ([#264](https://github.com/hardbyte/awa/issues/264), [#266](https://github.com/hardbyte/awa/pull/266)). Previously the install acquired `pg_advisory_lock(…)` on one dedicated pool connection but issued every DDL through `.execute(pool)`, which acquired _different_ connections per statement. With a one- connection pool that self-deadlocked; with a small pool and concurrent worker startup it exhausted the pool with every worker holding one connection for the lock and competing for the rest for DDL. The PG18-on-fresh-DB hang reported in #264 is the most visible symptom. Install now runs in a single transaction on a single connection with `pg_advisory_xact_lock(…)`; the lock auto-releases on COMMIT/ROLLBACK and the install is atomic. - **`queue_storage_schema_ready` checks the full required surface** ([#266](https://github.com/hardbyte/awa/pull/266)). Previously it only checked for `queue_ring_state`, `ready_entries`, and `leases`; if `prepare_schema` had failed partway through (a real failure mode under the old non-atomic install) the schema could report ready while `awa.job_id_seq`, `done_entries`, `deferred_jobs`, or the `claim_ready_runtime` function were missing — at which point producers got `relation "awa.job_id_seq" does not exist`. The check now requires every queue-storage substrate object the runtime depends on. - **`AwaMetrics::from_global()` no longer rebuilt per call on hot paths** ([#265](https://github.com/hardbyte/awa/pull/265)). `from_global()` registers the entire instrument set on every invocation. The Python `Client`, `awa-ui` `AppState`, and `awa-cli` DLQ command now cache a single `AwaMetrics` handle and reuse it instead of rebuilding ~30 instruments per operation. ## [0.6.0-alpha.9] — 2026-05-08 ### Fixed - **Queue-storage priority-aging completions now preserve the lane priority in terminal storage.** Workers still receive the aged effective priority, with `_awa_original_priority` in metadata, but `done_entries` now uses the original queue lane priority for its storage key. This prevents aged low-priority jobs from colliding with high-priority jobs that share the same per-lane sequence. ## [0.6.0-alpha.8] — 2026-05-08 ### Added - **Lifecycle hooks now include `Started` events**. `JobEvent` and `UntypedJobEvent` fire `Started` after a claim commits and just before the worker handler is invoked, so applications can observe job execution beginning as well as final outcomes. ### Changed - **Breaking alpha API change:** exhaustive matches on `JobEvent` or `UntypedJobEvent` must handle the new `Started` variant. No stable Awa release has been published yet, so this is documented as an alpha-series source break. - **Reduced queue-storage per-claim deadline overhead.** Fresh queue-storage schemas now use a low-write BRIN index for `lease_claims.deadline_at`, and the claim helper computes claim/deadline timestamps once per batch instead of per returned row. Deadline rescue semantics are unchanged; this targets the alpha.8 benchmark path where non-zero `QueueConfig::deadline_duration` is enabled for short receipt-plane jobs. ## [0.6.0-alpha.7] — 2026-05-07 ### Added - **Cron missed-fire policy** ([#239](https://github.com/hardbyte/awa/issues/239), [#240](https://github.com/hardbyte/awa/pull/240)). Periodic schedules now persist an explicit `missed_fire_policy`: `coalesce` remains the default and enqueues only the latest due fire after delayed evaluation, while `catch_up` enqueues missed fires in timestamp order for idempotent reconciliation jobs. The policy is exposed through the Rust and Python APIs, CLI schedule output, docs, and migration v015. ### Changed - **Cron evaluation runs in its own leader-scoped maintenance lane** ([#240](https://github.com/hardbyte/awa/pull/240)). Slow cleanup, rotation, or reconciliation work no longer starves the scheduler branch. Coalesced schedules also use a bounded latest-fire lookup so a stale high-frequency schedule does not scan every missed tick. - **Runtime grants now document required `TRUNCATE` privileges** ([#239](https://github.com/hardbyte/awa/issues/239), [#240](https://github.com/hardbyte/awa/pull/240)). The security guide now includes `TRUNCATE` in runtime table grants and default privileges, with a DB-backed regression covering the previously documented grants. ### Fixed - **Queue-storage claim transactions commit before rescueable runtime payload conversion** ([#222](https://github.com/hardbyte/awa/pull/222)). Runtime claims now keep hot claim transactions shorter while preserving rollback behavior for legacy zero-deadline claims that cannot be rescued after a conversion error. ## [0.6.0-alpha.6] — 2026-05-07 ### Added - **`awa-metrics` crate** ([#176](https://github.com/hardbyte/awa/issues/176), [#232](https://github.com/hardbyte/awa/pull/232)). The `AwaMetrics` type and its `record_*` methods move from `awa-worker` into a dedicated `awa-metrics` crate so non-runtime callers (`awa-ui`, `awa-cli`) can emit the same OTel counters as the worker without depending on the dispatcher/runtime crate graph. `awa-worker::AwaMetrics` re-exports for source compatibility — no semver break for `awa-cli` or `awa-python`. `awa-metrics::names` exposes public string constants for every metric, and `AwaMetrics::new()` is built from those constants so registered instruments and the public names can't drift. ### Changed - **Multi-queue NOTIFY collapses to one round-trip per enqueue tx** ([#235](https://github.com/hardbyte/awa/pull/235)). The three queue-storage enqueue paths (`enqueue_runtime_rows`, `enqueue_params_batch`, `enqueue_params_copy`) used to issue one `pg_notify($1, '')` per distinct destination queue inside the enqueue transaction. Now routed through `notify_queues_tx`, which uses `SELECT pg_notify(channel, '') FROM unnest($1::text[])` so any number of queues becomes one round-trip. Single-queue enqueue (the common case) is unchanged. - **Completion path: lease delete and `attempt_state` cleanup merge into a single CTE-as-DML statement** ([#235](https://github.com/hardbyte/awa/pull/235)). `complete_runtime_batch` previously issued two consecutive DELETEs (leases, then `attempt_state`) on the receipt-disabled path and on the materialized fallback inside the receipt-enabled path. They now share one statement — one fewer round-trip per completion batch, identical atomicity and return shape. ### Fixed - **`awa.job.dlq_retried` tagged with the source queue** ([#232](https://github.com/hardbyte/awa/pull/232)). Single-job retry from `awa-ui` previously read `job.queue` from the returned `JobRow`, which carries the _destination_ queue if the request body supplied a `queue` override. The metric now looks the source queue up before retry runs (matching `record_dlq_purged`'s pattern). ## [0.6.0-alpha.5] — 2026-05-04 ### Added - **`awa-pg[ui]` optional extra** ([#186](https://github.com/hardbyte/awa/issues/186)). `pip install 'awa-pg[ui]'` pulls in the [`awa-cli`](https://pypi.org/project/awa-cli/) wheel so `python -m awa serve` (and `awa serve` directly) launches the embedded React dashboard. The default `awa-pg` install stays small — workers and producers don't pay for the ~10 MB axum + UI bundle they don't need. - `python -m awa serve` is now a subcommand. It detects the `awa` binary in `sys.prefix/{bin,Scripts}` (where `awa-cli`'s wheel installs it) and forwards the full argument tail verbatim. If the extra isn't installed, it exits with a `pip install 'awa-pg[ui]'` hint. ### Fixed - **Restored queue-storage dispatcher throughput under high concurrency** ([#223](https://github.com/hardbyte/awa/issues/223)). Capacity-release wakes still drain ready work immediately, but the dispatcher now uses the configured fixed fallback poll interval instead of geometrically backing off after empty or permit-saturated polls. ### Changed - Queue-storage throughput benchmarks can run against a non-canonical storage schema and configurable worker count, making local A/B checks safer and easier to reproduce. - Added TLA+ trace witnesses for receipt-only cancel, callback wait, and DLQ purge paths, plus documentation alignment for the queue-storage design. ## [0.6.0-alpha.4] — 2026-05-03 ### Changed - Added capacity-wake suppression to reduce empty claim churn in quiet queues. This improved some operational churn metrics but regressed high-concurrency queue-storage throughput; alpha.5 keeps the useful wake-drain repair while restoring fixed fallback polling. ## [0.6.0-alpha.3] — 2026-05-02 ### Changed - **Completion-batcher default size lowered from `512` to `128`.** Cross-system matrix runs (1–4 worker processes × 16–128 workers per process) showed `128` delivered the lowest p99 in every cell and `512` bought no throughput while hurting tail latency under multi-process deployments. Override via `AWA_COMPLETION_BATCH_SIZE`. See `docs/benchmarking.md` for tuning notes. - **Reduced queue-storage claimer heartbeat churn.** Claimer leases now skip refresh writes while still fresh, cutting coordination writes in the dispatch path without changing claim ownership semantics. - **Updated architecture documentation.** The architecture guide now reflects the queue-storage receipt path, lazy lease materialization, crash recovery, maintenance leadership, and callback orchestration. ### Fixed - **Receipt completion now serializes with heartbeat materialization.** The queue-storage completion path locks the matching receipt claim before writing its closure, preventing a concurrent heartbeat from recreating `attempt_state` after completion. - **Hardened mixed Rust/Python chaos smoke coverage.** The mixed-fleet smoke test now waits for worker-observed completions from both runtimes instead of relying on transient terminal-row presence. ## [0.6.0-alpha.2] — 2026-05-02 ### Added - **Vacuum-aware queue storage engine, default-on** ([ADR-019](docs/adr/019-queue-storage-redesign.md)). Append-only `ready_entries`, `deferred_jobs`, `done_entries`, and `dlq_entries` tables, paired with a partitioned receipt ring, keep the dead-tuple footprint bounded under sustained load. Replaces the canonical row-mutating engine for new installs. - **Receipt-plane ring partitioning** ([ADR-023](docs/adr/023-receipt-plane-ring-partitioning.md)). `lease_claims` and `lease_claim_closures` are partitioned by claim slot and rotated by the maintenance leader. - **Dead Letter Queue** ([ADR-020](docs/adr/020-dead-letter-queue.md)). Per-queue `dlq_enabled` policy and a full operator surface: `awa dlq depth | list | retry | retry-bulk | move | purge`, plus the matching admin UI tab. See [`docs/dead-letter-queue.md`](docs/dead-letter-queue.md). - **Descriptor catalog** ([ADR-022](docs/adr/022-descriptor-catalog.md)). Code-declared queue and job-kind metadata (`display_name`, `description`, `owner`, `tags`, `docs_url`) drives admin UI labels and stale/drift detection. - **Per-claim deadlines** in receipts mode. `QueueConfig.deadline_duration` writes `lease_claims.deadline_at`; the rescue path force-closes expired claims with `'deadline_expired'`. - **Storage transition tooling**. `awa storage prepare`, `prepare-queue-storage-schema`, `enter-mixed-transition`, `finalize`, and `abort` cover the staged upgrade path. Fresh installs auto-finalize on first migrate. - **`transition_role` runtime capability**. The `enter_mixed_transition` SQL gate requires a live `queue_storage_target` runtime, so a stale fleet cannot accidentally skip the staged path. - **Migrations** v012, v013, and v014. All idempotent. ### Changed - New installs default to the queue-storage engine; canonical row-mutating storage is no longer the implicit backend. - Receipts mode is on by default for fresh deployments. ### Removed - `benchmarks/portable/` extracted to its own repo at [hardbyte/postgresql-job-queue-benchmarking](https://github.com/hardbyte/postgresql-job-queue-benchmarking). - The pre-0.6 `EXPERIMENTAL_LEASE_CLAIM_RECEIPTS` env alias. ### Upgrade notes - Update your dependency to `awa = "0.6"` (Rust) / `awa-cli`, `awa-pg` (Python) at the matching version. - Existing 0.5.x clusters with canonical data must walk the staged storage transition documented in [`docs/upgrade-0.5-to-0.6.md`](docs/upgrade-0.5-to-0.6.md). Fresh installs auto-finalize. - Rollback after `enter-mixed-transition` followed by queue-storage writes is one-way (database restore only).