All challengesCHALLENGE 20 OF 25

Make Background Jobs Retry-Safe

Ensure retryable background work is safe to repeat.

Advanced

Goal

Make background-job instructions safe for systems where failed jobs can be retried and therefore may execute more than once.

Repository Context

This application processes asynchronous jobs.

Code exampleMarkdown
notifications/
├── src/
│   ├── jobs/
│   ├── services/
│   └── repositories/
├── tests/
├── package.json
└── AGENTS.md

The job system retries failed jobs.

A job may therefore execute more than once because of:

  • worker failures,
  • timeouts,
  • retries,
  • or partial processing failures.

Some jobs perform side effects such as sending notifications and updating database records.

Job handlers must be designed so repeated execution does not incorrectly duplicate side effects or corrupt state.

Current AGENTS.md

Code exampleMarkdown
# Project Instructions

## Background Jobs

- Keep job handlers in `src/jobs`.
- Assume each job executes exactly once.
- It is acceptable for retries to repeat side effects because duplicate execution is rare.

## Validation

- Run relevant job tests after changing worker behavior.

Your Task

Repair the background-job instructions so agents account for retries and repeated execution.

Require retry-sensitive job handlers and side effects to be idempotent or otherwise protected against duplicate execution.

YOUR AGENTS.mdEdit the Current AGENTS.md shown in the challenge
AGENTS.mdMarkdown
Loading editor…

Sign in to save progress across devices.

Your answer is checked locally against the challenge rules. No AI is used for evaluation.