TARGET PROJECT: queue — HANDOFF NOTE

Current authoritative configuration (later target-project updates supersede earlier values; archived/unrelated projects excluded):
{
  "base_delay": 100,
  "exponential": true,
  "max_attempts": 3,
  "retryable_codes": [429, 500],
  "cancel_wins": true,
  "dedup_key": "id",
  "fifo_ties": true,
  "priority_high_first": true,
  "dead_order": "id",
  "delay_cap": 150,
  "stale_after": 2000,
  "stale_inclusive": false
}

Fixed contract to preserve:
- Interface: evaluate(payload) returns {ready:[id], waiting:[{id,at}], dead:[id], cancelled:[id]}.
- Input: now integer; jobs have id, key, priority, created, attempt, last_code, cancelled, due, failed_at.
- Nonnegative integers; zero last_code means no failure. Do not mutate input.
- Deduplicate by dedup_key (currently "id"), keeping the last value and its actual original index.
- Retryable means last_code is in retryable_codes.
- Cancelled handling: a cancelled job goes to cancelled if cancel_wins or if not retryable.
- Otherwise dead if: now-created is stale — with stale_inclusive=false, dead when now-created > stale_after (2000); or attempt >= max_attempts; or last_code is nonzero and nonretryable.
- Otherwise, for a retryable job, effective due = max(due, failed_at + min(base_delay * (2 ** max(0, attempt-1) if exponential else 1), delay_cap)). Jobs without failure keep due.
- If effective due > now, place in waiting with that due as at; otherwise ready.
- Ready sorting: priority descending because priority_high_first=true; then created ascending because fifo_ties=true; then selected original index.
- Dead sorting: by id because dead_order="id".
- Waiting and cancelled sorting: always by selected original index.

Exceptions / boundary semantics:
- stale boundary is exclusive under current settings.
- Cancellation wins over other outcomes under current settings when cancelled, including retryable jobs; nonretryable cancelled jobs also go to cancelled.

Unresolved items: none. All 12 configuration keys above are currently set.