Get Extraction Stale Count
Count chats the sweep would actually pick up on its next run.
Source-of-truth alignment: the sweep keys eligibility off the episodes_v2 state machine (TOS-39 PR-2), so this banner must do the same. The previous implementation queried only chats with the legacy last_extracted_at denormalized hint, which has no idea about DEAD_LETTER and reported terminally-retired chats as "awaiting" forever (regression observed 2026-05-28 for chat f9ebb5b1 after an OperationalError(AdminShutdown) burst drove its episode to DEAD_LETTER while last_extracted_at stayed NULL).
Predicate mirrors scheduler/jobs/extract_conversations.py:
- chat is alive (deleted_at IS NULL) and not opted out (extraction_excluded = false);
- LATEST episodes_v2 row (by started_at) is one of:
- NULL (never extracted),
- failed (retry-eligible),
- pending (durable worker queue item),
- integrated AND a newer extractable message or dirty marker exists beyond the processed watermark,
- extracting / windowing whose updated_at is older than the 1-hour in-flight cutoff (crashed worker);
- dead_letter (terminal, manual triage) and live extracting/windowing (an active worker is on it) are excluded.
The sweep has separate pending/recent/backlog budgets, but this endpoint is only a count, so it can express the union directly.
Request
- Base URL: https://app.thinqos.com (the document declares no server; this is the origin it was published from)
- URL: https://app.thinqos.com/api/admin/health/extraction/stale-count
- Auth: none declared
Response
Successful Response
Changes
No recorded changes to this operation across all 1 revision of this API.