-
Notifications
You must be signed in to change notification settings - Fork 925
feat: persist AI task state in template imports & workspace builds #18449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9848749
to
213ba4a
Compare
Signed-off-by: Danny Kopping <[email protected]> # Conflicts: # go.sum
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
…e changed Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
…tions, add test Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
…required Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]> # Conflicts: # go.sum
Signed-off-by: Danny Kopping <[email protected]>
d240c0e
to
0b2b732
Compare
…is PR This will be done in a separate PR Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
@@ -584,8 +584,6 @@ func (r *Runner) runTemplateImport(ctx context.Context) (*proto.CompletedJob, *p | |||
externalAuthProviderNames = append(externalAuthProviderNames, it.Id) | |||
} | |||
|
|||
// fmt.Println("completed job: template import: graph:", startProvision.Graph) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by.
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
-- if has_ai_task is true, ai_task_sidebar_app_id MUST be set | ||
-- ai_task_sidebar_app_id can ONLY be set if has_ai_task is true | ||
-- | ||
-- has_ai_task | ai_task_sidebar_app_id | Result | ||
-- ------------|------------------------|--------------- | ||
-- NULL | NULL | TRUE (passes) | ||
-- NULL | NOT NULL | FALSE (fails) | ||
-- FALSE | NULL | TRUE (passes) | ||
-- FALSE | NOT NULL | FALSE (fails) | ||
-- TRUE | NULL | FALSE (fails) | ||
-- TRUE | NOT NULL | TRUE (passes) | ||
ALTER TABLE workspace_builds | ||
ADD CONSTRAINT workspace_builds_ai_task_sidebar_app_id_required CHECK ( | ||
((has_ai_task IS NULL OR has_ai_task = false) AND ai_task_sidebar_app_id IS NULL) | ||
OR (has_ai_task = true AND ai_task_sidebar_app_id IS NOT NULL) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally wondered why has_ai_task
was nullable by default, but the provisionerdserver changes below explain why:
- New build: has_ai_task = null (unknown yet)
- After build completes: provisionerdserver sets has_ai_task to (true|false).
My next question would be: in which case do we need to know the difference between has_ai_task = null
and has_ai_task = false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My next question would be: in which case do we need to know the difference between has_ai_task = null and has_ai_task = false?
While has_ai_task
is null
(AND a build's provisioner job is in progress) we use other data (build params + template version has_ai_task
) to determine if the build might be an AI task, but if it's false
then we know for certain it is not. For builds at rest (i.e. no provisioner job in progress) they're functionally the same.
Signed-off-by: Danny Kopping <[email protected]>
Closes #18453