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.
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
# 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.