mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd): resolve effective user AI budget (#26142)
Closes https://linear.app/codercom/issue/AIGOV-287/add-effective-group-resolution Implements the effective AI budget resolution from the AI Governance cost-controls RFC: for a given user, a `user_ai_budget_overrides` row wins if present, otherwise the deployment budget policy (`highest`) picks the largest group budget across the user's groups, ties broken alphabetically. For now, I keep the logic under `coderd/aibridge/budget`, but that may change during the implementation of budget enforcement.
This commit is contained in:
Generated
+7
@@ -503,6 +503,13 @@ type sqlcQuerier interface {
|
||||
// A limit of 0 means "no limit".
|
||||
GetGroups(ctx context.Context, arg GetGroupsParams) ([]GetGroupsRow, error)
|
||||
GetHealthSettings(ctx context.Context) (string, error)
|
||||
// Returns the highest group AI budget across the groups the user belongs to,
|
||||
// breaking ties by group name ascending. Implements the "highest" budget policy.
|
||||
// group_members_expanded is a UNION of group_members and organization_members,
|
||||
// so the implicit "Everyone" group (group_id == organization_id) is included.
|
||||
// Returns no rows when the user has no budgeted groups; callers should treat
|
||||
// sql.ErrNoRows as "no group budget".
|
||||
GetHighestGroupAIBudgetByUser(ctx context.Context, userID uuid.UUID) (GetHighestGroupAIBudgetByUserRow, error)
|
||||
GetInboxNotificationByID(ctx context.Context, id uuid.UUID) (InboxNotification, error)
|
||||
// Fetches inbox notifications for a user filtered by templates and targets
|
||||
// param user_id: The user ID
|
||||
|
||||
Reference in New Issue
Block a user