[Feature]: add time-range filters to the session listing (GET /api/v1/sessions)
Summary
GET /api/v1/sessions returns every session of the current user with no way to narrow the result.
The only predicate a caller has today is "fetch all of them and filter in the client". An agent that needs "what happened in the last 7 days" has to either
- pull the whole listing and filter it locally, or
- fall back to a semantic query and bake the window into the query text.
The second option costs a model round-trip on every call, and it is not deterministic: the model may or may not express the window, and the recall that follows is bounded by the semantic match rather than by the timestamp.
Proposal
Accept the same time-bound syntax that /api/v1/search/find already uses (openviking/utils/search_filters.py):
| Parameter | Type | Description |
|---|---|---|
since |
str | Lower bound. Relative (2h, 7d) or absolute (ISO 8601 / YYYY-MM-DD). Timezone-less values are UTC. |
until |
str | Upper bound, same syntax. |
time_field |
str | Which session timestamp the bounds apply to: updated_at (default), created_at, last_message_at, mod_time. |
limit |
int | Maximum number of sessions to return. |
offset |
int | Number of matched sessions to skip. |
The window is evaluated against the session metadata (.meta.json), not the session directory, so updated_at reflects the last write of the session rather than the creation time of its directory. When a window is given, the matched sessions also carry their created_at / updated_at / last_message_at values so a caller can sort or display them.
Why this shape
- Deterministic. The filter is a plain metadata predicate computed by the server. It needs no model call and no extra embedding, so it does not change the recall or the accuracy of the retrieval path and it does not add latency.
- Cheap. The metadata read only happens when a window is requested, and the reads are issued concurrently with a bounded fan-out.
- Consistent.
since/until/time_fieldalready exist on/api/v1/search/findand/api/v1/search/search, and the Python and TypeScript SDKs expose them throughFindOptions/SearchOptions. The session listing is the one listing surface that cannot express a window.
Notes
- The listing keeps the newest sessions first and stays inside the existing storage listing limit (see #6326), so
offset/limitpage within that window rather than reaching past it. - An inverted window (
sincelater thanuntil) and an unknowntime_fieldare rejected with400.
Acceptance
GET /api/v1/sessions?since=7dreturns only the sessions touched in the last seven days.GET /api/v1/sessions?since=7d&time_field=created_atfilters on the creation time instead.GET /api/v1/sessions?since=2099-01-01returns an empty list.GET /api/v1/sessions?since=7d&until=<older>returns400.
Implemented in https://github.com/volcengine/OpenViking/pull/7324 - the session listing accepts since / until / time_field (updated_at, created_at, last_message_at, mod_time) plus limit / offset, and the window is evaluated against the session metadata with the directory modification time used to reject a session before its metadata is read.