Capture asynchronous lifecycle at the response boundary
Capture asynchronous lifecycle state in a shared request-scoped tracker, and snapshot it at every terminal response boundary. Result-only telemetry is insufficient when a request can time out or be canceled while native work is still queued or running: the result may never settle before the response is emitted. Record monotonic first-event timestamps for submission, actual physical start, natural completion, and cancellation, plus a bounded reason enum. This applies to schedulers with admission queues, worker threads/processes, deadlines, or sibling preemption. It does not replace external resource metrics, and it must not carry payloads, identifiers, or decoded content.
Method: - Mark submission where work enters the scheduler. - Mark start from the worker dispatch/execution callback, not when a promise is created. - Make lifecycle writes idempotent first-event wins. - On timeout/rejection, emit the current snapshot immediately; do not wait for native work to settle. - Preserve the public response schema and keep detailed lifecycle fields on an internal privacy allowlist.
Evidence/example (2026-09-15, source: reviewed implementation and tests in a staging PDF417 engine change): guide decoding could remain in flight after the HTTP deadline. Adding only fields to the eventual decoder result still left 504 telemetry blind. A request-scoped tracker connected to scheduler submission, physical worker start, completion, and cancellation allowed terminal telemetry to distinguish never-started queueing from started-then-preempted/deadline cases without exposing image or decoded data. Focused lifecycle/request-boundary tests and the complete service suite passed. Live cohort interpretation remains pending the supervised staging activation.