Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(coderd/provisionerdserver): avoid fk error on invalid ai_task_sidebar_app_id#19253

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 5 commits intomainfromcj/18776/workaround-sidebar-app-id-fk
Aug 8, 2025

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedAug 8, 2025
edited
Loading

This is a workaround for#18776

We avoid the foreign key issue by checking the previously inserted workspace applications before calling UpdateWorkspaceAITask. Now, affected workspaces will show as "not running an AI task" on the single task view, which is technically correct.

We also insert a provisioner job log at WARN level to ensure that the user sees some information that they have run into this issue, as well as logging on the server side.

Longer term, we plan to modify how the workspace tasks view is presented. This is a stopgap measure until we solidify that plan.

NOTE: this doesnot address the fact that stopping a workspace withhas_ai_task: true will result in the completed stop build no longer havinghas_ai_task: true, resulting in tasks "disappearing" on stop.

@johnstcnjohnstcn self-assigned thisAug 8, 2025
@johnstcnjohnstcn marked this pull request as ready for reviewAugust 8, 2025 12:20
Level: []database.LogLevel{database.LogLevelWarn},
Stage: []string{"Cleaning Up"},
Output: []string{
fmt.Sprintf("Unknown ai_task_sidebar_app_id %q. This workspace will be unable to run AI tasks. This may be due to a template configuration issue, please check with the template author.",sidebarAppID.UUID.String()),
Copy link
Member

@mafredrimafredriAug 8, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Linking to some docs could be beneficial if this is the template author viewing the message. I.e. how will the author know how to resolve this/why it happened?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That's a good point. Which documentation should we link to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ah, it looks like we don't really have any related docs yet. Perhaps we could give a hint as to what the most common cause of the error is, as well as link tohttps://registry.terraform.io/providers/coder/coder/latest/docs/resources/ai_task?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

How does this look?

Screenshot 2025-08-08 at 16 00 56

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

¡Muy caliente!

task:=jobType.WorkspaceBuild.AiTasks[0]
iftask.SidebarApp==nil {
returnxerrors.Errorf("update ai task: sidebar app is nil")
iftask.SidebarApp==nil||len(task.SidebarApp.Id)==0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggestion: Use getters for safer access (fixing all non-getter uses is out of scope though)

@johnstcnjohnstcn merged commit155c7bb intomainAug 8, 2025
26 checks passed
@johnstcnjohnstcn deleted the cj/18776/workaround-sidebar-app-id-fk branchAugust 8, 2025 17:06
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 8, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@DanielleMaywoodDanielleMaywoodDanielleMaywood approved these changes

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@johnstcn@mafredri@DanielleMaywood

[8]ページ先頭

©2009-2025 Movatter.jp