Skip to content

get_session drops state deltas older than config.after_timestamp #2353

Description

@mesutoezdil

KAgentSessionService.get_session passes config.after_timestamp to the API as the after query param, so the server only returns events newer than that timestamp. Session state is then rebuilt by replaying the returned events, which means any state_delta set before the timestamp is dropped. The session comes back with incomplete state and no error.

This is the same bug #2329 fixed for num_recent_events, just on the other filter. ADK's own InMemorySessionService keeps the full state and only trims the events list, so the expected behavior is: full state, events filtered.

Fix is the same shape as #2329: fetch the full history, replay everything, then drop events older than after_timestamp locally. The tradeoff is that server side filtering is lost, so large sessions transfer every event. As noted in the #2329 review, storing serialized session state in the DB would remove the need to replay at all and make both filters cheap. That is probably the right long term fix, and event persistence changes are already planned for v1.

after_timestamp is not currently used anywhere in kagent, so this is not urgent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions