Skip to content

Resume reconnects start fresh sessions and cancel in-flight jobs #22

@nficano

Description

@nficano

The client and documentation expose resume support, but the runtime does not honor it. In arcp-runtime/src/main/java/dev/arcp/runtime/session/SessionLoop.java around line 241, doHandshake ignores SessionHello.resumeToken() and SessionHello.lastEventSeq(), always generates a new SessionId and resume token, and never replays events from ResumeBuffer. In the same file around line 162, shutdown cancels every nonterminal owned job on transport close, which makes the README and resume guide claim that jobs survive reconnects untrue. The ResumeBuffer recorded around line 820 is per SessionLoop, so it is also discarded with the closed loop instead of being addressable by the next session.

Fix prompt: Implement actual session resume semantics. Track resumable session state by resume token in ArcpRuntime for the configured resume window, keep job ownership and event history available after transient transport close, distinguish explicit session.bye or job.cancel from an unplanned transport close, and when a session.hello contains a valid resume_token and last_event_seq, attach the new transport to the existing session identity and replay all buffered envelopes with event_seq greater than last_event_seq. Return a RESUME_WINDOW_EXPIRED job or session error when the token is unknown or expired. Add tests that start a long-running job, drop the transport without sending session.bye, reconnect with the saved token and last seen sequence, verify replay and live continuation, and verify explicit close still cancels when that is the intended lifecycle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity:highHigh severity

    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