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.
KAgentSessionService.get_sessionpassesconfig.after_timestampto the API as theafterquery param, so the server only returns events newer than that timestamp. Session state is then rebuilt by replaying the returned events, which means anystate_deltaset 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 ownInMemorySessionServicekeeps 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_timestamplocally. 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_timestampis not currently used anywhere in kagent, so this is not urgent.