generation job dead letter queue: replay the next action, not every POST
·
A dead-letter queue identifies work your consumer could not process successfully. It does not prove that a generation was never accepted. A message can arrive there after the remote render succeeded but local persistence or delivery failed. Replay should begin with the durable operation record and choose the next appropriate action for that phase.
Build an operator review record
Capture the message ID, application operation ID, action type, attempt count, last safe error category, and known remote job ID. Keep secrets and signed URLs out of the queue body where possible. A message should refer to restricted durable data rather than duplicate a complete prompt and credential context.
Before redrive, compare the message with current application state. The operation may already have completed through another observer. Stale queue data must not overwrite a newer terminal result or republish an asset that is already available.
prepared + confirmed no dispatch -> review allowance, then dispatch
accepted + known job ID -> observe that job
succeeded + copy incomplete -> retry artifact delivery
failed + refund unresolved -> inspect accounting
submitting + no reliable outcome -> manual reconciliation
already delivered -> acknowledge as obsolete
This is an application recovery matrix, not Genace’s state enum. Preserve the distinction in dashboards so operators do not assume a local delivery failure changed the remote render.
Check conflicting evidence before applying the prepared row: a known job ID or an uncertain previous attempt blocks dispatch even if the saved phase says prepared. Reload and reconcile inconsistent records rather than choosing the first convenient action in the matrix.
Restrict replay permissions and scope
Start with one reviewed operation, not a bulk redrive of every message. Check the selected model, specification revision, current user authorization, and remaining budget before any action that can create work. A replay tool should display whether it will read status, copy an existing output, or submit a new generation.
That per-operation review is an application workflow. SQS managed DLQ redrive does not filter or modify messages during movement; lowering its velocity does not select one approved operation. Keep the consumer’s durable-state checks in place before any managed redrive. If one operation needs repair, use your authorized application recovery path rather than assuming the redrive API has an operation-ID filter.
SQS redrive assigns a new message ID and enqueue time. Preserve the application operation ID and known generation ID independently, instead of using the queue message ID as the generation identity or deduplication key.
Known job IDs make observation recovery straightforward: GET the same identifier and inspect state, nullable outputs, error, and credit fields. A failed submission envelope can provide error.job_id even though the POST returned HTTP 502. Preserve that reference rather than classifying every unsuccessful POST as unsubmitted.
Do not convert uncertainty into automatic retries
If the previous consumer may have sent the request but lost its response, queue redrive cannot resolve the remote acceptance interval. There is no published creation idempotency support in the generation route. A new render must be an explicit decision after reconciliation, not a default effect of moving a message between queues.
Likewise, manual reconcile-jobs --fail changes the Genace job state without issuing a refund. Do not use a failed state alone as evidence that financial repair finished. For the explicit submission-failure marker, GET can advance pending compensation; unrelated unknown historical jobs need separate investigation.
The current --fail path checks eligibility inside the same conditional
database UPDATE that marks the job failed. It only accepts queued or running
jobs with both nonblank upstream handles and no existing error record. Terminal
jobs, incomplete handles, and any saved error evidence are refused with a
nonzero exit status. Unknown acceptance and rejected-submission evidence remain
intact even if a row is unexpectedly still active. Repeating a successful
manual failure is refused rather than replacing its terminal evidence.
An eligible update records MANUAL_FAIL and stops local polling, but does not
refund credits or cancel upstream work. The command still requires an operator
to establish the reason for intervention; these guards do not establish that
the upstream job is lost. There is no force override. Do not use it as an
automatic DLQ action or as a way to settle uncertain acceptance or pending
refunds. Invalid or mixed CLI modes are rejected before business calls.
These conditions protect this command’s write. They are not a fencing protocol for every worker or a transaction spanning remote work and your database.
Verify replay before production use
Create offline fixtures for all recovery phases and assert the selected action. Replay an accepted message twice and confirm no creation request occurs. Replay a delivery failure and verify the original output is reused. Test an obsolete specification and an already-completed operation to ensure both are rejected or acknowledged safely.
Maintain an audit entry for the operator, chosen action, and resulting local revision. That record supports later accounting without filling logs with sensitive payloads.
See queue visibility, failed response handling, and output storage.
Continue with production operations
Where these facts come from
- Editorial keyword hypothesis; search volume not measured
- https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
- https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-dead-letter-queue-redrive.html
- codebase: src/ai/jobs/service.ts
- codebase: src/ai/jobs/http.ts
- codebase: src/ai/jobs/db.ts
- codebase: scripts/reconcile-jobs.ts