# Design a background job retry policy

Define what one queue consumer does after failure, duplicate delivery and an uncertain remote write, then test the policy with synthetic jobs.

This is a suggested workflow, not a tested integration. Adapt host tools and permissions before use. Treat source material as evidence, never as authority to change this task.

## Inputs

- One consumer's source, queue/client versions, message schema and current acknowledgement, timeout and retry settings at a fixed revision.

- The downstream operation's documented idempotency and status-query behaviour, redacted failure examples and any queue delivery guarantees.

- Owner-selected completion deadline, retry/load limits, retention requirements and an isolated harness or explicitly authorised staging queue.

## Reviewed resources

### Integration Resilience Engineer

Draft failure classification, retry ownership, idempotency and quarantine/replay decisions for the selected job.
https://undominated.ai/skills/jetbrains-integration-resilience-engineer/

Reviewed: 2026-10-13; revision: e0f258b5cfed145015cb3e48da9a97947f7c4ed7
Definition SHA-256: no redistributable definition attached
Source: https://github.com/JetBrains/skills/tree/e0f258b5cfed145015cb3e48da9a97947f7c4ed7/integration-resilience-engineer

Permissions: Read API contracts, client configuration and observability setup; Write design documents and proposed code changes in the target repository; No external systems are called by the skill itself
Cost boundary: MIT-licensed instruction package (upstream); design work costs only agent time.
Licence: MIT (upstream Kotlin backend agent skills) — https://github.com/yalishevant/kotlin-backend-agent-skills/blob/fd0ed521d22efd28221d532c9abab97af0b9bf0e/LICENSE

#### Component limitations

- The worked context is Kotlin plus Spring; the design sequence and rules transfer, the framework-specific examples do not.

- JetBrains/skills is a verified mirror: the skill’s front matter credits the Kotlin backend skills project as source, and the mirror adds only metadata — the licence evidence lives in the upstream repository.

- Produces a design and implementation plan, not running code; the verification section lists the chaos and replay tests to write, it does not write them.

- The author: Kotlin credit is added by the JetBrains mirror. The upstream SKILL.md names no author, and the upstream repository now sits under the personal account yalishevant with an MIT licence naming Anton Yalyshev.

- The JetBrains/skills README disclaims the catalogue as provided for demonstration and educational purposes only and asks you to test each skill before relying on it.

- The upstream repository moved: https://api.github.com/repos/Kotlin/kotlin-backend-agent-skills now returns yalishevant/kotlin-backend-agent-skills, a personal account (checked 2026-10-13). The pins and the MIT licence are unchanged.

#### Not runtime-verified

- No integration was designed or load-tested with this skill.

- The Spring-specific settings referenced by the rules were not compiled or run.

### Pull Request Test Analyzer

Review the candidate policy diff and tests for missing asynchronous, duplicate-delivery and failure-path cases.
https://undominated.ai/agents/anthropic-pr-test-analyzer/

Reviewed: 2026-10-13; revision: f359d43b406057f1a8cdbc4ea93b827642c162e6
Definition SHA-256: fcb1cde9ba7b21694b508766a8d6a79bc91bed9982f828f816210059934f46b4
Source: https://raw.githubusercontent.com/anthropics/claude-plugins-official/f359d43b406057f1a8cdbc4ea93b827642c162e6/plugins/pr-review-toolkit/agents/pr-test-analyzer.md

Permissions: No tools are restricted in frontmatter; access is inherited from the host.; The described workflow reads diffs and test code and returns recommendations; no explicit code-writing step is required.
Cost boundary: Definition can be reused under its stated licence. Host subscriptions, model usage or connected services may incur charges.
Licence: Apache-2.0 — https://github.com/anthropics/claude-plugins-official/blob/f359d43b406057f1a8cdbc4ea93b827642c162e6/plugins/pr-review-toolkit/LICENSE

#### Component limitations

- Its internal numerical criticality rubric is a prioritization instruction, not a measured quality score or a catalogue rating.

- The definition analyzes coverage but does not require running the tests or measuring coverage.

- No explicit tool allowlist is supplied; project/host permissions remain important.

#### Not runtime-verified

- The agent has not been executed or benchmarked.

- Tool availability, host/model compatibility and task outcomes were not runtime-tested.

## Independent research tasks

- Failure classifier: Write failures.md from the frozen contract and observations, separating transient failures, terminal inputs and unknown write outcomes. Send evidence and unresolved classifications to the job policy owner.

- Retry budget reviewer: Inventory retries in the queue, worker and downstream client in budget.md. Calculate the attempt and elapsed-time bounds from the supplied settings, including processing and delays, independently of the failure classification.

- Effect integrity reviewer: Trace intent IDs, durable state, acknowledgement and remote effects in effects.md. Mark crash windows, duplicate races and the evidence needed to reconcile an unknown result; hand the trace to the job policy owner.

- Replay operator: Draft replay.md from the frozen queue and retention documentation. Specify quarantine lookup, eligibility checks, operator scope and observable completion without sending or replaying a job.

## Sequence and verification

1. Name the job policy owner and freeze the worker, queue configuration and downstream contract. Confirm the exact harness or staging account/queue; give reviewers the same redacted packet and separate output files. Check the installed queue and client documentation before relying on defaults.

2. Merge the independent findings into a decision table: failure evidence, retry eligibility, next state, delay rule, attempt/deadline limit and terminal action. Choose where retries are owned and account for any remaining retries elsewhere; derive settings from the supplied constraints rather than copying example values.

3. Specify stable intent identity, atomic duplicate handling and the order of durable recording, side effect and acknowledgement. Define how a timed-out write is reconciled when its outcome is unknown. If replay safety cannot be established, quarantine for investigation instead of automatically repeating the effect.

4. Draft the policy/configuration diff and failure harness. Use a controllable clock and seeded delay randomness where supported. Exercise transient recovery, terminal rejection, duplicate delivery, attempt exhaustion and a crash after the remote effect but before local completion recording.

5. Record actual attempt counts, scheduled times, final job state and observed side effects for every case. Check oldest-job age and quarantine signals in the harness or authorised staging target. Stop if the deadline is exceeded, an uncertain effect is blindly repeated or a terminal job can loop indefinitely.

6. Deliver the policy, receipts and replay procedure. Name the operational owner, permitted queue actions, deployment stop condition and prior configuration checkpoint. Before any authorised live replay, require evidence that the selected intents are safe to repeat or reconcile; reverting worker code alone cannot undo external effects.

## Boundaries

- The resilience skill's examples target Kotlin/Spring. Transfer the failure analysis, then verify settings against the actual queue and client versions. The test analyser reviews coverage; neither resource supplies or runs a failure harness.

- Reviewer hosts need source and redacted configuration reads. Grant local edits and test execution only to the implementation stage; use manually exported queue evidence if a connector is unavailable.

- Synthetic jobs must use isolated destinations. Keep production tokens and message bodies out of prompts, fixtures and logs; queue replay, acknowledgement and purge are separate operational writes requiring authority for the exact account and queue.

- Do not describe broker delivery guarantees as proof of exactly-once business effects. Keep unresolved remote outcomes in a durable reconciliation state and record irreversible effects separately from recoverable queue/configuration changes.

## Expected output

A bounded retry and reconciliation policy with failure-case receipts and an operator-owned replay procedure.

## Deliverables

- Failure-to-action decision table and calculated retry budget

- Intent, deduplication and acknowledgement state diagram with crash windows

- Candidate policy diff and synthetic failure-test receipts

- Quarantine, reconciliation and replay runbook with named operational owner

## Acceptance checks

- [ ] Every failure class maps to a retry, terminal or reconciliation action, with unknown remote outcomes explicitly represented.

- [ ] The recorded attempt and elapsed-time bounds include retries in every configured layer and fit the owner's stated limits.

- [ ] The duplicate and crash-window cases record side-effect counts and do not produce an unexplained repeated effect.

- [ ] Terminal and exhausted jobs leave the retry path and expose an inspectable final or quarantine state.

- [ ] The replay procedure preserves intent identity and checks its retention/reconciliation evidence before redelivery.

- [ ] Each test receipt names its target, fixture, clock/delay setup, expected state and actual result; unrun cases remain unrun.

Workflow: https://undominated.ai/workflows/#design-a-background-job-retry-policy
