# Context pack — Fix lease renewal in worker queue

Demo pack. Built for billing-service @ 9f949e9.

## Files (9)

- billing/workers/lease.py — lease token acquire/release
- billing/workers/queue.py — job claim loop
- billing/db/jobs.py — commit fencing
- tests/test_lease.py — fencing regression tests
- billing/payments/retry.py — uses the renewed lease
- docs/runbooks/worker-ops.md — restart order
- billing/config.py — lease TTL settings
- migrations/0041_job_leases.sql — lease table
- billing/workers/__init__.py — exports

## Decisions carried

- D-38 Invoice numbering moves to a DB sequence
- D-41 Stripe webhooks handled out of the request path

## Rules delivered

- R-014 Payments code never touches the ORM session directly (block)
- R-021 Every migration ships a matching down-revision (warn)

Budget: medium · 6,120 tokens.