python -m messenger.admin is a new process assembly over the attachments
zone with only a database: "failed" lists failed jobs (served by the new
partial index jobs_failed_idx), "replay --attachment-id" moves a failed
attachment back to queued with the same job_id, attempt 1 and a fresh
outbox row, writing a replayed event with the operator. A ready, queued
or processing attachment is a noop (replay_noop event), a failed one
whose staging is already gone is expired. Every request is audited.
The relay now also removes the staging object of a failed attachment
once STAGING_RETENTION_SECONDS have passed since it failed; replay and
the cleanup take the same row lock.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Leases: the worker renews its lease before the first side effect and
every JOB_TIMEOUT_SECONDS/3 while the variants are produced; a renewal
that finds the lease taken cancels the work (and its render process)
and settles the job as fenced without writing anything.
Retries: the delay before attempt n+1 is drawn from [d/2, d] with
d = min(cap, base * 2^(n-1)) (equal jitter), the next attempt time is
computed by PostgreSQL and the delay is kept in the job event.
Faults: the Faults port is async; relay reaches after_commit_before_publish
and after_publish_before_confirm, worker reaches after_claim_before_side_effect,
stall_after_claim (once, FAULT_STALL_SECONDS), after_s3_write_before_commit
and after_commit_before_ack. Crashes are os._exit(137).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The renderer adapter keeps one single-process pool per WORKER_CONCURRENCY
slot. A render that exceeds RENDER_TIMEOUT_SECONDS is killed and its slot
is respawned, the render process has RLIMIT_AS = RENDER_MEMORY_MB on
Linux, so both limits end in ImageTooDemanding, a permanent
processing_failed. A render process killed from outside is a transient
error. A cancelled render (lost lease, shutdown) kills its process too.
The worker container limit grows to 1g: two 448 MiB render processes
plus the worker itself.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The worker decodes the original once (JPEG draft down to the optimized
box, EXIF orientation applied in place, alpha composed on white) and
encodes three variants: the 256 px thumbnail, a centred 128x128 JPEG crop
that may upscale and a WebP fitted into 1280x1280 without upscaling,
quality 80, method 4. No EXIF, ICC or XMP is written. The byte limit is
checked before decoding. ready is set by the transaction that stores all
three rows, so a partial set is never published.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Level 4 of the lab 5 rubric: crop and optimized variants, byte, pixel,
time and memory limits of the worker, crash points for the failure
windows 2-5 with automatic recovery, backoff with jitter and error
classification, a failed registry with an explicit replay, lease renewal
and failed staging retention. New capabilities lab5-image-variants and
lab5-job-recovery, deltas to lab5-attachment-pipeline and lab4-attachments.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>