feat: add managed agent license limit checks (#18937)

- Adds a query for counting managed agent workspace builds between two
timestamps
- The "Actual" field in the feature entitlement for managed agents is
now populated with the value read from the database
- The wsbuilder package now validates AI agent usage against the limit
when a license is installed

Closes coder/internal#777
This commit is contained in:
Dean Sheather
2025-07-22 13:39:26 +10:00
committed by GitHub
parent aa1a985381
commit 9a6dd73f68
24 changed files with 586 additions and 74 deletions
+5
View File
@@ -1864,6 +1864,7 @@ func TestExecutorPrebuilds(t *testing.T) {
clock,
prometheus.NewRegistry(),
notificationsNoop,
api.AGPL.BuildUsageChecker,
)
var claimer agplprebuilds.Claimer = prebuilds.NewEnterpriseClaimer(db)
api.AGPL.PrebuildsClaimer.Store(&claimer)
@@ -2004,6 +2005,7 @@ func TestExecutorPrebuilds(t *testing.T) {
clock,
prometheus.NewRegistry(),
notificationsNoop,
api.AGPL.BuildUsageChecker,
)
var claimer agplprebuilds.Claimer = prebuilds.NewEnterpriseClaimer(db)
api.AGPL.PrebuildsClaimer.Store(&claimer)
@@ -2134,6 +2136,7 @@ func TestExecutorPrebuilds(t *testing.T) {
clock,
prometheus.NewRegistry(),
notificationsNoop,
api.AGPL.BuildUsageChecker,
)
var claimer agplprebuilds.Claimer = prebuilds.NewEnterpriseClaimer(db)
api.AGPL.PrebuildsClaimer.Store(&claimer)
@@ -2266,6 +2269,7 @@ func TestExecutorPrebuilds(t *testing.T) {
clock,
prometheus.NewRegistry(),
notificationsNoop,
api.AGPL.BuildUsageChecker,
)
var claimer agplprebuilds.Claimer = prebuilds.NewEnterpriseClaimer(db)
api.AGPL.PrebuildsClaimer.Store(&claimer)
@@ -2376,6 +2380,7 @@ func TestExecutorPrebuilds(t *testing.T) {
clock,
prometheus.NewRegistry(),
notificationsNoop,
api.AGPL.BuildUsageChecker,
)
var claimer agplprebuilds.Claimer = prebuilds.NewEnterpriseClaimer(db)
api.AGPL.PrebuildsClaimer.Store(&claimer)