fix: backport fix for managed agent tracking (#21696)#21729
Merged
david-fraley merged 1 commit intodean/release/2.28/ai-usagefrom Jan 29, 2026
Merged
fix: backport fix for managed agent tracking (#21696)#21729david-fraley merged 1 commit intodean/release/2.28/ai-usagefrom
david-fraley merged 1 commit intodean/release/2.28/ai-usagefrom
Conversation
mafredri
approved these changes
Jan 28, 2026
Emyrk
approved these changes
Jan 28, 2026
b2674a8 to
58bfed7
Compare
johnstcn
commented
Jan 28, 2026
|
|
||
| // Create one AI workspace, which should succeed. | ||
| workspace := coderdtest.CreateWorkspace(t, cli, aiTemplate.ID) | ||
| // Create one AI workspace, which should succeed. |
Member
Author
There was a problem hiding this comment.
Suggested change
| // Create one AI workspace, which should succeed. |
johnstcn
commented
Jan 28, 2026
Comment on lines
2934
to
+2935
| expectHasAiTask: false, | ||
| expectUsageEvent: false, | ||
| expectUsageEvent: true, |
Member
Author
There was a problem hiding this comment.
review: to keep the scope of this change small, I'm not changing the semantics of has_ai_task but just fixing the usage events.
Emyrk
approved these changes
Jan 28, 2026
johnstcn
commented
Jan 28, 2026
Comment on lines
+726
to
+737
| // Create a second AI task, which should fail due to breaching the limit. | ||
| _, err = codersdk.NewExperimentalClient(cli).CreateTask(ctx, owner.UserID.String(), codersdk.CreateTaskRequest{ | ||
| Name: "test-task-2", | ||
| TemplateVersionID: aiTemplate.ActiveVersionID, | ||
| }) | ||
| require.ErrorContains(t, err, "You have breached the managed agent limit in your license") | ||
|
|
||
| // Create a third non-AI workspace, which should succeed. | ||
| // Create a third workspace using the same template, which should succeed. | ||
| workspace = coderdtest.CreateWorkspace(t, cli, aiTemplate.ID) | ||
| coderdtest.AwaitWorkspaceBuildJobCompleted(t, cli, workspace.LatestBuild.ID) | ||
|
|
||
| // Create a fourth non-AI workspace, which should also succeed. |
Member
Author
There was a problem hiding this comment.
review: this updated test is doing most of the heavy lifting here.
mafredri
approved these changes
Jan 28, 2026
deansheather
approved these changes
Jan 29, 2026
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.
Depends on #21724
Backports the following:
Note: This PR does not change the semantics of
has_ai_taskbut simply fixes the incorrect usage insertion.