Skip to content

Resume tokens are minted but never registered #22

@nficano

Description

@nficano

The runtime advertises resume support and sends a freshly minted resume token in session.welcome, but the token is never stored in the server's _resumeTokens map. ArcpServer.TryResume can only succeed when _resumeTokens contains the supplied token, so every reconnect with a valid-looking token misses the lookup and the new SessionState replays from its own empty EventLog. This contradicts the resume guide and conformance page, which both describe gap-free window-bounded replay.

The relevant locations are src/Arcp.Runtime/SessionState.Handshake.cs:22, src/Arcp.Runtime/SessionState.Handshake.cs:24, src/Arcp.Runtime/ArcpServer.cs:25, and src/Arcp.Runtime/ArcpServer.cs:100.

Fix prompt: Implement server-side resume token registration and rotation for SessionState. Add an internal method on ArcpServer that associates the active SessionId with the newly minted ResumeToken, removes the previous token for that session when rotating, and enforces ResumeWindowSec. Update TryResume so it restores the existing session state needed for replay rather than only copying the session id into a new empty session. Add integration tests that submit a job, capture ResumeToken and LastReceivedSeq, reconnect with SessionHelloPayload.ResumeToken and LastEventSeq, and verify missed events replay gap-free; also test expired or unknown tokens return RESUME_WINDOW_EXPIRED or an appropriate session error.

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