Race condition in the desktop (Tauri) delivery-retry flow:
User is on tauri://localhost/delivery (DeliveryPage) with a FAILED item.
Clicks "Repetir" — DeliveryPage.tsx:139 called api.retryDelivery(orgId, i.id).then(load)without .catch().
The API (delivery/routes.ts) did updateMany with where: { id, organizationId, status: "FAILED" }.
If result.count === 0 (autopilot/queue worker requeued, retried, or retracted the item between render and click), it threw notFound("failed_item_not_found") → 404.
The rejected promise had no handler → unhandledrejection → error loop.
Fix
API (apps/api/src/delivery/routes.ts): when updateMany matches zero rows, fetch the item. If it exists, return its current state (200) — the retry is idempotent. Only 404 (item_not_found) when the row is actually gone.
Frontend (apps/app/src/pages/DeliveryPage.tsx): add a rejection handler to .then(load) that reloads the list (() => load()), so a stale FAILED row refreshes instead of becoming an unhandled rejection.
Test
New case in apps/api/test/delivery.test.ts: enqueues a photo, forces it to FAILED via a 401, then flips the row to QUEUED (simulating the worker requeue) and POSTs /retry. Asserts:
200 with the current QUEUED state (no more 404)
a truly missing item still 404s with item_not_found
Scope
Two-file product fix + test. No schema, no infra, no queue/autopilot logic.
Paperclip-BIT-33418
## Root cause (BIT-33418)
Race condition in the desktop (Tauri) delivery-retry flow:
1. User is on `tauri://localhost/delivery` (DeliveryPage) with a `FAILED` item.
2. Clicks "Repetir" — `DeliveryPage.tsx:139` called `api.retryDelivery(orgId, i.id).then(load)` **without `.catch()`**.
3. The API (`delivery/routes.ts`) did `updateMany` with `where: { id, organizationId, status: "FAILED" }`.
4. If `result.count === 0` (autopilot/queue worker requeued, retried, or retracted the item between render and click), it threw `notFound("failed_item_not_found")` → 404.
5. The rejected promise had no handler → `unhandledrejection` → error loop.
## Fix
- **API** (`apps/api/src/delivery/routes.ts`): when `updateMany` matches zero rows, fetch the item. If it exists, return its current state (200) — the retry is idempotent. Only 404 (`item_not_found`) when the row is actually gone.
- **Frontend** (`apps/app/src/pages/DeliveryPage.tsx`): add a rejection handler to `.then(load)` that reloads the list (`() => load()`), so a stale `FAILED` row refreshes instead of becoming an unhandled rejection.
## Test
New case in `apps/api/test/delivery.test.ts`: enqueues a photo, forces it to `FAILED` via a 401, then flips the row to `QUEUED` (simulating the worker requeue) and POSTs `/retry`. Asserts:
- 200 with the current `QUEUED` state (no more 404)
- a truly missing item still 404s with `item_not_found`
## Scope
Two-file product fix + test. No schema, no infra, no queue/autopilot logic.
Paperclip-BIT-33418
Race condition: between the desktop rendering a FAILED delivery row and the
user clicking "Repetir", the autopilot/queue worker can requeue, retry, or
retract the item. The retry endpoint's updateMany (where status=FAILED)
matched zero rows and threw notFound("failed_item_not_found") -> 404, and
the frontend promise had no .catch -> unhandledrejection -> error loop.
API: when the item no longer matches FAILED, fetch it; if it exists return
its current state (200, idempotent), only 404 when the row is gone.
Frontend: add a rejection handler that reloads the list so a stale FAILED
row refreshes instead of becoming an unhandled rejection.
Paperclip-BIT-33418
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Root cause (BIT-33418)
Race condition in the desktop (Tauri) delivery-retry flow:
tauri://localhost/delivery(DeliveryPage) with aFAILEDitem.DeliveryPage.tsx:139calledapi.retryDelivery(orgId, i.id).then(load)without.catch().delivery/routes.ts) didupdateManywithwhere: { id, organizationId, status: "FAILED" }.result.count === 0(autopilot/queue worker requeued, retried, or retracted the item between render and click), it threwnotFound("failed_item_not_found")→ 404.unhandledrejection→ error loop.Fix
apps/api/src/delivery/routes.ts): whenupdateManymatches zero rows, fetch the item. If it exists, return its current state (200) — the retry is idempotent. Only 404 (item_not_found) when the row is actually gone.apps/app/src/pages/DeliveryPage.tsx): add a rejection handler to.then(load)that reloads the list (() => load()), so a staleFAILEDrow refreshes instead of becoming an unhandled rejection.Test
New case in
apps/api/test/delivery.test.ts: enqueues a photo, forces it toFAILEDvia a 401, then flips the row toQUEUED(simulating the worker requeue) and POSTs/retry. Asserts:QUEUEDstate (no more 404)item_not_foundScope
Two-file product fix + test. No schema, no infra, no queue/autopilot logic.
Paperclip-BIT-33418
Race condition: between the desktop rendering a FAILED delivery row and the user clicking "Repetir", the autopilot/queue worker can requeue, retry, or retract the item. The retry endpoint's updateMany (where status=FAILED) matched zero rows and threw notFound("failed_item_not_found") -> 404, and the frontend promise had no .catch -> unhandledrejection -> error loop. API: when the item no longer matches FAILED, fetch it; if it exists return its current state (200, idempotent), only 404 when the row is gone. Frontend: add a rejection handler that reloads the list so a stale FAILED row refreshes instead of becoming an unhandled rejection. Paperclip-BIT-33418auto-approve: CI success on
a9b7007d5d(gitea_auto_approve_open_prs_once.py)auto-approve: CI success on
a9b7007d5d(gitea_auto_approve_open_prs_once.py)auto-approve: CI success on
a9b7007d5d(gitea_auto_approve_open_prs_once.py)