HANDOFF: target project queue

Scope
Only queue requirements are authoritative. Ignore all archived records for other projects. Updates 1–5 have been applied; superseded values are discarded. No later update or question is available.

CURRENT settings
{
  "base_delay": 200,
  "exponential": false,
  "max_attempts": 4,
  "retryable_codes": [408, 503],
  "cancel_wins": false,
  "priority_high_first": false,
  "dedup_key": "key",
  "fifo_ties": false,
  "dead_order": "input",
  "delay_cap": 400,
  "stale_after": 1000,
  "stale_inclusive": true
}

Fixed interface
Implement evaluate(payload) returning:
{ready:[id], waiting:[{id,at}], dead:[id], cancelled:[id]}

Input contains integer now and jobs with:
id, key, priority, created, attempt, last_code, cancelled, due, failed_at.
Numeric inputs are nonnegative integers; last_code=0 means no failure.
Do not mutate input.

Algorithm and precedence
1. Deduplicate jobs by key. Keep the last job for each key and that job's actual original input index, not the first occurrence's index or a compacted index.
2. A job is retryable iff last_code is in [408,503].
3. If a job is cancelled and not retryable, put its id in cancelled before checking dead conditions.
   Exception: cancel_wins=false, so cancelled retryable jobs continue through dead/retry/scheduling rules rather than entering cancelled.
4. Otherwise put the job in dead if any condition holds:
   - now-created >= 1000 (inclusive stale boundary);
   - attempt >= 4;
   - last_code is nonzero and nonretryable.
5. For remaining retryable jobs, effective due is:
   max(original due, failed_at + 200).
   This follows the fixed delay formula with exponential=false and min(200,400)=200. Jobs without failure keep original due.
6. If effective due > now, append {id,at:effective due} to waiting. Otherwise append id to ready. Equality with now is ready.

Ordering
- ready: priority ascending, then created descending, then selected original index ascending.
- dead: selected original index ascending, not id.
- waiting and cancelled: selected original index ascending.

Fixed general contract
Retry delay is min(base_delay * (2**max(0,attempt-1) if exponential else 1), delay_cap); retryable effective due is max(due, failed_at + retry delay).
Cancellation applies first when cancelled and (cancel_wins or not retryable).
Staleness uses >= when stale_inclusive, otherwise >.
Ready ordering switches priority direction via priority_high_first and created direction via fifo_ties; selected original index is the final tie-break.
Dead ordering is by id only when dead_order="id"; otherwise by selected original index.
Future queue updates replace only named keys and leave other current settings unchanged.

Unresolved / continuation
No unresolved requirement is explicitly recorded. Implementation language, implementation, and tests are not supplied here. Continue from these current choices and the fixed contract; do not infer requirements from unrelated archives.