feat: default AI Gateway sessions list to a 24h time range (#28256)

The AI Gateway sessions list page takes 5-13 seconds to load because
`ListAIBridgeSessions` scans all `aibridge_interceptions` rows (~1M on
dogfood) when no time filter is set. This PR defaults the list to the
last 24 hours of sessions, reducing the scan by roughly two orders of
magnitude without any backend or migration changes: the
`started_after`/`started_before` filters already exist end-to-end in
SQL, searchquery, and the API.

The default range is held in component state (not the URL) and merged
into every query payload including prefetches, so the unbounded query
never runs on page load. A time range filter in the filter bar lets
users override the window explicitly, which doubles as a forensic tool.
Picking a range writes quoted RFC 3339 timestamps into the existing
filter query. There are no presets and no unbounded "all time" mode, so
the fast path is the only path. Existing "All sessions"/"My sessions"
presets reset the filter query, which resets the time window to the
default 24 hours; that is intentional.

Also makes the five filter triggers a uniform width and left-aligns the
new picker so the search input keeps room on wide viewports.

Depends on #28255 (the DateTimeRangeFilter component) and #28254
(filterQuery serialization).


Part of
[AIGOV-580](https://linear.app/codercom/issue/AIGOV-580/ai-gateway-sessions-page-takes-5-10-seconds-to-load)

---
_Generated by Coder Agents on behalf of @johnstcn._$

---

**Stack:** #28254 (filterQuery fix) \u2192 #28255 (component) \u2192
#28256 (sessions page)
This commit is contained in:
Cian Johnston
2026-08-19 16:42:43 +01:00
committed by GitHub
parent 05699c4d55
commit 023f61626d
10 changed files with 339 additions and 40 deletions
+7 -3
View File
@@ -46,9 +46,13 @@ not just what was called.
### Sessions list
The sessions page (`http://<deployment-url>/ai-gateway/sessions`) lists all sessions in
reverse-chronological order. Each row shows the last prompt, initiator, provider,
client, token usage, network requests, thread count, and timestamp.
The sessions page (`http://<deployment-url>/ai-gateway/sessions`) lists sessions in
reverse-chronological order. By default it shows sessions with activity in the
last 24 hours. Use the time range filter in the filter bar to widen or narrow
the window, for example to see older sessions.
Each row shows the last prompt, initiator, provider, client, token usage,
network requests, thread count, and timestamp.
The **Network Requests** column reports the total and blocked
[Agent Firewall](../agent-firewall/index.md) requests for the session. It shows