# provider-session-lifecycle Specification ## Purpose TBD - created by archiving change phase3c-gateway-audit-remediation. Update Purpose after archive. ## Requirements ### Requirement: Provider terminal events end forwarding Encrypted provider termination and unexpected provider disconnect SHALL quiesce provider ingestion and queued/new media forwarding before the existing reliable typed terminal event is delivered, close the Verse tunnel within a bounded interval, release the session reservation, and report the appropriate durable provider/session state. A fixed drain delay MUST NOT stand in for reliable control delivery. #### Scenario: Host termination closes the tunnel - **WHEN** the native provider emits an authenticated termination event - **THEN** queued and newly injected media cannot cross the Verse transport after observation, and the client tunnel, reservation, and durable lifecycle transition complete #### Scenario: Unexpected provider disconnect is reconnectable - **WHEN** required provider transport disconnects without acknowledged termination - **THEN** forwarding stops and the Server receives the existing reconnectable lifecycle state rather than a termination claim ### Requirement: Cleanup failure remains durable Gateway cleanup MUST preserve `cleanup_pending` when provider input release, transport cleanup, authorized cancellation, or durable reporting fails. #### Scenario: Terminal cleanup fails - **WHEN** a provider terminal event is handled but required cleanup cannot complete - **THEN** the session is not reported released or reusable and durable state remains cleanup pending