Resume queued delivery after operator sign-in #266

Closed
opened 2026-08-08 05:28:47 +00:00 by timmy · 0 comments
Owner

Problem

Background delivery authenticates, then performs a separate mutation. If the eight-hour operator session expires between those requests, the mutation returns 401 and the current worker incorrectly marks valid queued work as permanent Attention. This loses automatic delivery and requires a manual retry. Existing #250/#252 background sync and #258 operator sessions do not cover this race.

User flow

  • Treat mutation-time 401 as recoverable session expiry.
  • Release the in-flight claim, abort the drain, and keep the original idempotency key.
  • Generate no Attention receipt for authentication expiry.
  • After a successful sign-in, request background delivery again so pending work resumes automatically.
  • Preserve permanent handling for 422 and retry handling for 5xx.

Acceptance tests

  • A mutation 401 releases the claim, rejects the flush, and does not fail the item or emit Attention.
  • No later queued mutation is attempted in that drain.
  • A later authenticated flush delivers the same operation once with its original idempotency key.
  • Successful sign-in asks the service worker to resume pending delivery.
  • Existing 422, 5xx, cross-account, and race behavior remains green.
## Problem Background delivery authenticates, then performs a separate mutation. If the eight-hour operator session expires between those requests, the mutation returns 401 and the current worker incorrectly marks valid queued work as permanent Attention. This loses automatic delivery and requires a manual retry. Existing #250/#252 background sync and #258 operator sessions do not cover this race. ## User flow - Treat mutation-time 401 as recoverable session expiry. - Release the in-flight claim, abort the drain, and keep the original idempotency key. - Generate no Attention receipt for authentication expiry. - After a successful sign-in, request background delivery again so pending work resumes automatically. - Preserve permanent handling for 422 and retry handling for 5xx. ## Acceptance tests - A mutation 401 releases the claim, rejects the flush, and does not fail the item or emit Attention. - No later queued mutation is attempted in that drain. - A later authenticated flush delivers the same operation once with its original idempotency key. - Successful sign-in asks the service worker to resume pending delivery. - Existing 422, 5xx, cross-account, and race behavior remains green.
timmy self-assigned this 2026-08-08 05:32:29 +00:00
timmy closed this issue 2026-08-08 05:34:03 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stackchain/stackchain-dashboard#266
No description provided.