Skip to content

Fail pending invocations when the client transport closes #41

@nficano

Description

@nficano

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity:highHigh severity issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions