Repository navigation
feat: add an AI Gateway data retention endpoint - #32659
Merged
Merged
Conversation
ssncferreira
force-pushed
the
ssncf/ai-gateway-retention-endpoint
branch
from
November 24, 2026 15:16
bf36db9 to
c3a7da7
Compare
ssncferreira
force-pushed
the
ssncf/ai-gateway-retention-endpoint
branch
from
November 24, 2026 15:34
c3a7da7 to
18bd931
Compare
ssncferreira
marked this pull request as ready for review
November 24, 2026 17:05
mollymaefraser
approved these changes
Nov 24, 2026
mollymaefraser
left a comment
Collaborator
There was a problem hiding this comment.
LGTM 🚀 only a few non-blocking nits
pawbana
approved these changes
Nov 24, 2026
ssncferreira
added a commit
that referenced
this pull request
Nov 24, 2026
…32660) ## Description The AI Sessions date picker allows picking times before the AI Gateway data retention, which always return no sessions. It now disables them. ## Changes - Add `getAIGatewayRetention` and the `aiGatewayRetention` query. The AI spend page will reuse them. - Pass `minDate`, now minus the retention, to the Sessions date picker. Days and quick ranges before it can't be picked. - Add the `DatePickerOpenWithRetention` story. Depends on #32659. > [!NOTE] > Generated by Coder Agents on behalf of @ssncferreira.
ssncferreira
had a problem deploying
to
docs-preview
November 24, 2026 18:07 — with
GitHub Actions
Failure
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Pages that read raw AI Gateway data and have a date picker don't handle data retention consistently. AI Sessions allows start dates whose data is already purged. AI spend only learns the retention after a request.
The new AI spend page reads aggregated data, which is never purged, in some views and raw data in others. For consistency, the Overview and Detailed report tabs should accept the same date range, so both are limited to the retention.
The retention is in the deployment config, but only Owners can read it. This adds an experimental endpoint that returns only the retention, so these pages can offer only retained dates.
Changes
GET /api/experimental/ai-gateway/retention, returningretention_ms. Zero means data is never purged.codersdk.AIGatewayRetentionand theExperimentalClient.AIGatewayRetentionmethod.Note
Generated by Coder Agents on behalf of @ssncferreira.