ARCPClient.finishUnhandled() resumes only pending pong continuations when the receive loop ends at Sources/ARCP/Client/ARCPClient.swift:294. Pending invocations stored in pendingByInvoke, their progress continuations, and any result chunk streams are left unresolved. An invoke call that has sent a request but never receives a terminal job.completed, job.failed, or job.cancelled envelope can therefore hang forever after transport closure. The same public path also leaks state if transport.send(envelope) throws in ARCPClient.invoke after pendingByInvoke[invokeId] has been populated at Sources/ARCP/Client/ARCPClient.swift:390.
Fix prompt: Teach finishUnhandled() and the invoke send-error path to fail every pending invocation with ARCPError.unavailable, finish every progress stream, remove invokeByJobId mappings, and fail or finish any open ResultChunkStream. Add tests that close the MemoryTransport before a terminal job envelope and that use a transport whose send throws, then assert that invoke returns a thrown error instead of suspending.
ARCPClient.finishUnhandled()resumes only pending pong continuations when the receive loop ends atSources/ARCP/Client/ARCPClient.swift:294. Pending invocations stored inpendingByInvoke, their progress continuations, and any result chunk streams are left unresolved. Aninvokecall that has sent a request but never receives a terminaljob.completed,job.failed, orjob.cancelledenvelope can therefore hang forever after transport closure. The same public path also leaks state iftransport.send(envelope)throws inARCPClient.invokeafterpendingByInvoke[invokeId]has been populated atSources/ARCP/Client/ARCPClient.swift:390.Fix prompt: Teach
finishUnhandled()and theinvokesend-error path to fail every pending invocation withARCPError.unavailable, finish every progress stream, removeinvokeByJobIdmappings, and fail or finish any openResultChunkStream. Add tests that close theMemoryTransportbefore a terminal job envelope and that use a transport whosesendthrows, then assert thatinvokereturns a thrown error instead of suspending.